|
|
@@ -1,10 +1,15 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
+import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart';
|
|
|
import 'package:keyboard/base/base_view.dart';
|
|
|
|
|
|
+import '../../../../data/bean/option_select_config.dart';
|
|
|
+import '../../../../data/bean/option_select_item.dart';
|
|
|
import '../../../../resource/assets.gen.dart';
|
|
|
import '../../../../resource/colors.gen.dart';
|
|
|
import '../../../../resource/string.gen.dart';
|
|
|
+import '../../intimacy_analyse_upload/widget/upload_item_widget.dart';
|
|
|
+import '../../widget/option_select_widget.dart';
|
|
|
import '../../widget/step_card.dart';
|
|
|
import 'package:keyboard/module/intimacy_analyse/screenshot_reply/scan_image_reply/scan_image_reply_controller.dart';
|
|
|
|
|
|
@@ -21,11 +26,18 @@ class ScanImageReplyView extends BaseView<ScanImageReplyController> {
|
|
|
Widget buildBody(BuildContext context) {
|
|
|
return Stack(
|
|
|
children: [
|
|
|
- Column(
|
|
|
- children: [
|
|
|
- // 上传截图例子卡片
|
|
|
- _buildUploadScreenshotSampleCard(),
|
|
|
- ],
|
|
|
+ SingleChildScrollView(
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ // 上传截图的卡片
|
|
|
+ _buildUploadScreenshotCard(false),
|
|
|
+ SizedBox(height: 14.h),
|
|
|
+ // 选项卡片
|
|
|
+ _buildOptionCard(),
|
|
|
+ // 距离底部有一定间距
|
|
|
+ SizedBox(height: 90.h),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
// 上传截图按钮
|
|
|
Positioned.fill(
|
|
|
@@ -38,8 +50,83 @@ class ScanImageReplyView extends BaseView<ScanImageReplyController> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- /// 上传截图例子卡片
|
|
|
- Widget _buildUploadScreenshotSampleCard() {
|
|
|
+ /// 上传截图的卡片
|
|
|
+ /// [isSample] 是否是样例图片
|
|
|
+ Widget _buildUploadScreenshotCard(bool isSample) {
|
|
|
+ Widget actionBtn;
|
|
|
+
|
|
|
+ // 例子,示例图
|
|
|
+ if (isSample) {
|
|
|
+ actionBtn = Container(
|
|
|
+ padding: EdgeInsets.all(6.w),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: ColorName.black28,
|
|
|
+ borderRadius: BorderRadius.circular(9.r),
|
|
|
+ ),
|
|
|
+ child: Text(
|
|
|
+ StringName.intimacyAnalyseSampleImage,
|
|
|
+ style: TextStyle(
|
|
|
+ color: ColorName.white,
|
|
|
+ fontSize: 12.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ // 重新上传按钮
|
|
|
+ actionBtn = Container(
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 12.w),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: ColorName.black80,
|
|
|
+ borderRadius: BorderRadius.circular(30.r),
|
|
|
+ ),
|
|
|
+ child: Text(
|
|
|
+ StringName.intimacyAnalyseReUpload,
|
|
|
+ style: TextStyle(
|
|
|
+ color: ColorName.white,
|
|
|
+ fontSize: 12.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget imageWidget;
|
|
|
+ // 样例图片
|
|
|
+ if (isSample) {
|
|
|
+ imageWidget = Assets.images.iconUploadScreenshotSampleImage.image(
|
|
|
+ width: 288.w,
|
|
|
+ height: 290.h,
|
|
|
+ fit: BoxFit.cover,
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ // 上传
|
|
|
+ imageWidget = UploadItemWidget(
|
|
|
+ imageSrc: "",
|
|
|
+ hasDeleteBtn: false,
|
|
|
+ uploadState: UploadState.fail,
|
|
|
+ // 失败时的遮罩
|
|
|
+ uploadFailMaskWidget: UploadFailMaskWidget(
|
|
|
+ iconWidget: Assets.images.iconUploadFail.image(
|
|
|
+ width: 40.w,
|
|
|
+ height: 40.w,
|
|
|
+ ),
|
|
|
+ spaceWidget: SizedBox(height: 12.h),
|
|
|
+ textWidget: Text(
|
|
|
+ StringName.intimacyAnalyseUploadFail,
|
|
|
+ style: TextStyle(
|
|
|
+ color: ColorName.white,
|
|
|
+ fontSize: 16.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ onClickItemCallback: () {
|
|
|
+ // 预览图片
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
return StepCard(
|
|
|
bgImageProvider: Assets.images.bgIntimacyAnalyseUploadCard.provider(),
|
|
|
stepLabel: "",
|
|
|
@@ -68,34 +155,11 @@ class ScanImageReplyView extends BaseView<ScanImageReplyController> {
|
|
|
child: ClipRRect(
|
|
|
// 图片裁切成圆角
|
|
|
borderRadius: BorderRadius.circular(16.r),
|
|
|
- child: Assets.images.iconUploadScreenshotSampleImage
|
|
|
- .image(
|
|
|
- width: 288.w,
|
|
|
- height: 290.h,
|
|
|
- fit: BoxFit.cover,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- Positioned(
|
|
|
- right: 0,
|
|
|
- bottom: 0,
|
|
|
- child: Container(
|
|
|
- padding: EdgeInsets.all(6.w),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: ColorName.black28,
|
|
|
- borderRadius: BorderRadius.circular(9.r),
|
|
|
- ),
|
|
|
- child: Text(
|
|
|
- StringName.intimacyAnalyseSampleImage,
|
|
|
- style: TextStyle(
|
|
|
- color: ColorName.white,
|
|
|
- fontSize: 12.sp,
|
|
|
- fontWeight: FontWeight.w500,
|
|
|
- ),
|
|
|
+ child: imageWidget,
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
+ Positioned(right: 0, bottom: 0, child: actionBtn),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
@@ -104,6 +168,76 @@ class ScanImageReplyView extends BaseView<ScanImageReplyController> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ /// 选项卡片
|
|
|
+ Widget _buildOptionCard() {
|
|
|
+ return Container(
|
|
|
+ width: double.maxFinite,
|
|
|
+ margin: EdgeInsets.only(left: 14.w, right: 14.w),
|
|
|
+ // 圆角背景
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ gradient: LinearGradient(
|
|
|
+ colors: [Color(0xFFEFE9FF), Color(0xFFFBFAFF)],
|
|
|
+ begin: Alignment.topCenter,
|
|
|
+ end: Alignment.bottomRight,
|
|
|
+ ),
|
|
|
+ shape: BoxShape.rectangle,
|
|
|
+ border: Border.all(color: ColorName.white80, width: 1.w),
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(20.r)),
|
|
|
+ ),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.only(
|
|
|
+ left: 12.w,
|
|
|
+ top: 17.h,
|
|
|
+ right: 12.w,
|
|
|
+ bottom: 12.h,
|
|
|
+ ),
|
|
|
+ padding: EdgeInsets.only(
|
|
|
+ left: 12.w,
|
|
|
+ top: 12.h,
|
|
|
+ right: 12.w,
|
|
|
+ bottom: 12.h,
|
|
|
+ ),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: ColorName.white,
|
|
|
+ borderRadius: BorderRadius.circular(16.r),
|
|
|
+ ),
|
|
|
+ child: Obx(() {
|
|
|
+ return Column(
|
|
|
+ children: [
|
|
|
+ // 添加选项行
|
|
|
+ for (var optionConfig
|
|
|
+ in controller.replyToneOptionSelectConfigList)
|
|
|
+ _buildOptionRow(optionConfig),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 构建一行选择选项行
|
|
|
+ Widget _buildOptionRow(OptionSelectConfig config) {
|
|
|
+ return Column(
|
|
|
+ children: [
|
|
|
+ // 选择项
|
|
|
+ OptionSelectWidget(
|
|
|
+ optionSelect: config,
|
|
|
+ optionSelectCallback: (
|
|
|
+ OptionSelectConfig rowConfig,
|
|
|
+ OptionSelectItem optionItem,
|
|
|
+ ) {
|
|
|
+ controller.selectReplyToneOption(rowConfig, optionItem);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ SizedBox(height: 20.h),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
/// 上传截图按钮
|
|
|
Widget _buildUploadScreenshotBtn() {
|
|
|
return GestureDetector(
|