|
|
@@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
import 'package:keyboard/base/base_view.dart';
|
|
|
import 'package:keyboard/data/bean/upload_info.dart';
|
|
|
+import 'package:keyboard/module/intimacy_analyse/intimacy_analyse_upload/widget/upload_nine_grid.dart';
|
|
|
import 'package:keyboard/module/intimacy_analyse/widget/creating_loading_widget.dart';
|
|
|
import '../../../../data/bean/image_viewer_item.dart';
|
|
|
import '../../../../data/bean/option_select_config.dart';
|
|
|
@@ -95,146 +96,156 @@ class ScanImageReplyView extends BaseView<ScanImageReplyController> {
|
|
|
/// 上传截图的卡片
|
|
|
/// [isSample] 是否是样例图片
|
|
|
Widget _buildUploadScreenshotCard(bool isSample) {
|
|
|
- Widget actionBtn;
|
|
|
+ return Obx(() {
|
|
|
+ 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 = GestureDetector(
|
|
|
- onTap: () {
|
|
|
- BuildContext? context = Get.context;
|
|
|
- if (context != null) {
|
|
|
- controller.clickUploadScreenshotBtn(context);
|
|
|
- }
|
|
|
- },
|
|
|
- child: Container(
|
|
|
- padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 12.w),
|
|
|
+ // 例子,示例图
|
|
|
+ if (isSample) {
|
|
|
+ actionBtn = Container(
|
|
|
+ padding: EdgeInsets.all(6.w),
|
|
|
decoration: BoxDecoration(
|
|
|
- color: ColorName.black80,
|
|
|
- borderRadius: BorderRadius.circular(30.r),
|
|
|
+ color: ColorName.black28,
|
|
|
+ borderRadius: BorderRadius.circular(9.r),
|
|
|
),
|
|
|
child: Text(
|
|
|
- StringName.intimacyAnalyseReUpload,
|
|
|
+ StringName.intimacyAnalyseSampleImage,
|
|
|
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(
|
|
|
- imageUploadInfo: controller.uploadInfo.value!,
|
|
|
- hasDeleteBtn: false,
|
|
|
- // 失败时的遮罩
|
|
|
- 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,
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ // 重新上传按钮
|
|
|
+ actionBtn = GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ BuildContext? context = Get.context;
|
|
|
+ if (context != null) {
|
|
|
+ controller.clickUploadScreenshotBtn(context);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ child: 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,
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- onClickItemCallback: (UploadInfo uploadInfo) {
|
|
|
- // 预览图片
|
|
|
- ImageViewerItem imageViewerItem;
|
|
|
- String src = FileDataSourceUtil.getFileDataSourceSrc(uploadInfo);
|
|
|
- // 远程图片
|
|
|
- if (PrefixUtil.isRemoteImage(src)) {
|
|
|
- imageViewerItem = ImageViewerItem.network(src);
|
|
|
- } else {
|
|
|
- // 本地图片
|
|
|
- imageViewerItem = ImageViewerItem.file(src);
|
|
|
- }
|
|
|
- ImageViewerPage.start([imageViewerItem]);
|
|
|
- },
|
|
|
- onClickDeleteCallback: (UploadInfo uploadInfo) {
|
|
|
- controller.deleteUploadInfo(uploadInfo);
|
|
|
- },
|
|
|
- );
|
|
|
- }
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
- // 识图回复,只有1张图
|
|
|
- int uploadItemCount = 1;
|
|
|
- return StepCard(
|
|
|
- bgImageProvider: StepCardUtil.getCardBgImageProvider(uploadItemCount),
|
|
|
- topTitleWidget: StepTitleWidget(
|
|
|
- stepTitle: StringName.intimacyUploadScreenshot,
|
|
|
- stepDesc: StringName.intimacyAnalyseUploadScreenshotCardTip,
|
|
|
- ),
|
|
|
- topIconWidget: Assets.images.iconIntimacyAnalyseUploadTop.image(
|
|
|
- height: 63.h,
|
|
|
- width: 103.w,
|
|
|
- ),
|
|
|
- // 顶部图标的位置
|
|
|
- topIconWidgetLocation: StepCardUtil.calculateTopIconWidgetLocation(
|
|
|
- uploadItemCount,
|
|
|
- ),
|
|
|
- contentWidget: Column(
|
|
|
- children: [
|
|
|
- Container(
|
|
|
- width: 312.w,
|
|
|
- height: 314.h,
|
|
|
- margin: EdgeInsets.only(left: 12.w, top: 17.h, right: 12.w),
|
|
|
- padding: EdgeInsets.all(12.w),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: ColorName.white,
|
|
|
- borderRadius: BorderRadius.circular(16.r),
|
|
|
+ Widget imageWidget;
|
|
|
+ // 样例图片
|
|
|
+ if (isSample) {
|
|
|
+ imageWidget = Assets.images.iconUploadScreenshotSampleImage.image(
|
|
|
+ width: 288.w,
|
|
|
+ height: 290.h,
|
|
|
+ fit: BoxFit.cover,
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ // 上传
|
|
|
+ imageWidget = UploadItemWidget(
|
|
|
+ imageUploadInfo: controller.uploadInfo.value!,
|
|
|
+ hasDeleteBtn: false,
|
|
|
+ // 失败时的遮罩
|
|
|
+ uploadFailMaskWidget: UploadFailMaskWidget(
|
|
|
+ iconWidget: Assets.images.iconUploadFail.image(
|
|
|
+ width: 40.w,
|
|
|
+ height: 40.w,
|
|
|
),
|
|
|
- child: Stack(
|
|
|
- children: [
|
|
|
- Positioned.fill(
|
|
|
- child: Container(
|
|
|
- padding: EdgeInsets.all(12.w),
|
|
|
- child: ClipRRect(
|
|
|
- // 图片裁切成圆角
|
|
|
- borderRadius: BorderRadius.circular(16.r),
|
|
|
- child: imageWidget,
|
|
|
+ spaceWidget: SizedBox(height: 12.h),
|
|
|
+ textWidget: Text(
|
|
|
+ StringName.intimacyAnalyseUploadFail,
|
|
|
+ style: TextStyle(
|
|
|
+ color: ColorName.white,
|
|
|
+ fontSize: 16.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ onClickItemCallback: (UploadInfo uploadInfo) {
|
|
|
+ // 预览图片
|
|
|
+ ImageViewerItem imageViewerItem;
|
|
|
+ String src = FileDataSourceUtil.getFileDataSourceSrc(uploadInfo);
|
|
|
+ // 远程图片
|
|
|
+ if (PrefixUtil.isRemoteImage(src)) {
|
|
|
+ imageViewerItem = ImageViewerItem.network(src);
|
|
|
+ } else {
|
|
|
+ // 本地图片
|
|
|
+ imageViewerItem = ImageViewerItem.file(src);
|
|
|
+ }
|
|
|
+ ImageViewerPage.start([imageViewerItem]);
|
|
|
+ },
|
|
|
+ onClickDeleteCallback: (UploadInfo uploadInfo) {
|
|
|
+ controller.deleteUploadInfo(uploadInfo);
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 识图回复,只有1张图
|
|
|
+ int uploadItemCount = 1;
|
|
|
+ Mode mode =
|
|
|
+ controller.uploadInfo.value == null ? Mode.preview : Mode.edit;
|
|
|
+ return StepCard(
|
|
|
+ bgImageProvider: StepCardUtil.getCardBgImageProvider(
|
|
|
+ itemCount: uploadItemCount,
|
|
|
+ sceneType: controller.uploadSceneType,
|
|
|
+ mode: mode,
|
|
|
+ ),
|
|
|
+ topTitleWidget: StepTitleWidget(
|
|
|
+ stepTitle: StringName.intimacyUploadScreenshot,
|
|
|
+ stepDesc: StringName.intimacyAnalyseUploadScreenshotCardTip,
|
|
|
+ ),
|
|
|
+ topIconWidget: Assets.images.iconIntimacyAnalyseUploadTop.image(
|
|
|
+ height: 63.h,
|
|
|
+ width: 103.w,
|
|
|
+ ),
|
|
|
+ // 顶部图标的位置
|
|
|
+ topIconWidgetLocation: StepCardUtil.calculateTopIconWidgetLocation(
|
|
|
+ itemCount: uploadItemCount,
|
|
|
+ sceneType: controller.uploadSceneType,
|
|
|
+ mode: mode,
|
|
|
+ ),
|
|
|
+ contentWidget: Column(
|
|
|
+ children: [
|
|
|
+ Container(
|
|
|
+ width: 312.w,
|
|
|
+ height: 314.h,
|
|
|
+ margin: EdgeInsets.only(left: 12.w, top: 17.h, right: 12.w),
|
|
|
+ padding: EdgeInsets.all(12.w),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: ColorName.white,
|
|
|
+ borderRadius: BorderRadius.circular(16.r),
|
|
|
+ ),
|
|
|
+ child: Stack(
|
|
|
+ children: [
|
|
|
+ Positioned.fill(
|
|
|
+ child: Container(
|
|
|
+ padding: EdgeInsets.all(12.w),
|
|
|
+ child: ClipRRect(
|
|
|
+ // 图片裁切成圆角
|
|
|
+ borderRadius: BorderRadius.circular(16.r),
|
|
|
+ child: imageWidget,
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- Positioned(right: 0, bottom: 0, child: actionBtn),
|
|
|
- ],
|
|
|
+ Positioned(right: 0, bottom: 0, child: actionBtn),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- );
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/// 选项卡片
|