Browse Source

[fix]修复了一些bug

Destiny 1 year ago
parent
commit
dca4bf4c5a

+ 2 - 46
ios/Podfile

@@ -37,7 +37,9 @@ target 'Runner' do
   end
 end
 
+
 post_install do |installer|
+  flutter_post_install(installer) if defined?(flutter_post_install)
   installer.pods_project.targets.each do |target|
     flutter_additional_ios_build_settings(target)
 
@@ -48,58 +50,12 @@ target.build_configurations.each do |config|
       config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
         '$(inherited)',
 
-        ## dart: PermissionGroup.calendar
-        #'PERMISSION_EVENTS=1',
-        
-        ## dart: PermissionGroup.calendarFullAccess
-        #'PERMISSION_EVENTS_FULL_ACCESS=1',
-
-        ## dart: PermissionGroup.reminders
-        #'PERMISSION_REMINDERS=1',
-
-        ## dart: PermissionGroup.contacts
-        #'PERMISSION_CONTACTS=1',
-
         ## dart: PermissionGroup.camera
         'PERMISSION_CAMERA=1',
 
-        ## dart: PermissionGroup.microphone
-        #'PERMISSION_MICROPHONE=1',
-
-        ## dart: PermissionGroup.speech
-        #'PERMISSION_SPEECH_RECOGNIZER=1',
-
         ## dart: PermissionGroup.photos
         'PERMISSION_PHOTOS=1',
 
-        ## The 'PERMISSION_LOCATION' macro enables the `locationWhenInUse` and `locationAlways` permission. If
-        ## the application only requires `locationWhenInUse`, only specify the `PERMISSION_LOCATION_WHENINUSE`
-        ## macro.
-        ##
-        ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
-        #'PERMISSION_LOCATION=1',
-        #'PERMISSION_LOCATION_WHENINUSE=0',
-
-        ## dart: PermissionGroup.notification
-        #'PERMISSION_NOTIFICATIONS=1',
-
-        ## dart: PermissionGroup.mediaLibrary
-        #'PERMISSION_MEDIA_LIBRARY=1',
-
-        ## dart: PermissionGroup.sensors
-        #'PERMISSION_SENSORS=1',
-
-        ## dart: PermissionGroup.bluetooth
-        #'PERMISSION_BLUETOOTH=1',
-
-        ## dart: PermissionGroup.appTrackingTransparency
-        'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
-
-        ## dart: PermissionGroup.criticalAlerts
-        #'PERMISSION_CRITICAL_ALERTS=1',
-
-        ## dart: PermissionGroup.criticalAlerts
-        #'PERMISSION_ASSISTANT=1',
       ]
     end
   end

+ 1 - 1
ios/Podfile.lock

@@ -130,6 +130,6 @@ SPEC CHECKSUMS:
   video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3
   webview_flutter_wkwebview: 0982481e3d9c78fd5c6f62a002fcd24fc791f1e4
 
-PODFILE CHECKSUM: 5a5209ae115459a6ee3f7221309da6047ec32ac5
+PODFILE CHECKSUM: 9cb569fbad751252ed253ec4acef25285b9cb2bd
 
 COCOAPODS: 1.16.2

+ 2 - 2
lib/data/consts/constants.dart

@@ -3,7 +3,7 @@ import 'package:clean/utils/mmkv_util.dart';
 class Constants {
   Constants._();
 
-  static const String env = envDev;
+  static const String env = envProd;
 
   static const String envDev = 'dev';
 
@@ -15,7 +15,7 @@ class Constants {
 
   static const String _testBaseUrl = "http://42.193.245.11";
 
-  static const String _prodBaseUrl = "https://project-api.atmob.com";
+  static const String _prodBaseUrl = "https://clean-os-api.supercleaner.club";
 
   static const String privacyPolicy =
       "https://cdn.supercleaner.club/static/cleanpro/clean_pro_privacy.html";

+ 145 - 0
lib/dialog/photo_uploading_dialog.dart

@@ -0,0 +1,145 @@
+import 'package:clean/utils/expand.dart';
+import 'package:flutter/Material.dart';
+import 'package:flutter_screenutil/flutter_screenutil.dart';
+
+import '../resource/assets.gen.dart';
+
+class UploadingDialog extends StatefulWidget {
+  final Duration duration;
+  final VoidCallback? onComplete;
+
+  const UploadingDialog({
+    super.key,
+    this.duration = const Duration(seconds: 3),
+    this.onComplete,
+  });
+
+  @override
+  State<UploadingDialog> createState() => _UploadingDialogState();
+}
+
+class _UploadingDialogState extends State<UploadingDialog>
+    with SingleTickerProviderStateMixin {
+  late AnimationController _controller;
+  late Animation<double> _animation;
+
+  @override
+  void initState() {
+    super.initState();
+    _controller = AnimationController(
+      duration: widget.duration,
+      vsync: this,
+    );
+
+    _animation = Tween<double>(begin: 0, end: 1).animate(_controller)
+      ..addStatusListener((status) {
+        if (status == AnimationStatus.completed) {
+          widget.onComplete?.call();
+          Navigator.of(context).pop();
+        }
+      });
+
+    _controller.forward();
+  }
+
+  @override
+  void dispose() {
+    _controller.dispose();
+    super.dispose();
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Dialog(
+      backgroundColor: Colors.transparent,
+      elevation: 0,
+      child: Container(
+        padding: EdgeInsets.all(25.w),
+        decoration: BoxDecoration(
+          color: "#23232A".color,
+          borderRadius: BorderRadius.circular(20.r),
+        ),
+        child: Column(
+          mainAxisSize: MainAxisSize.min,
+          children: [
+            Stack(
+              alignment: Alignment.center,
+              children: [
+                Container(
+                  width: 240.w,
+                  height: 20.h,
+                  decoration: BoxDecoration(
+                    borderRadius: BorderRadius.circular(26.r),
+                    color: Colors.transparent,
+                  ),
+                ),
+                // 进度条背景
+                Container(
+                  width: 240.w,
+                  height: 13.h,
+                  decoration: BoxDecoration(
+                    borderRadius: BorderRadius.circular(26.r),
+                    color: "#44444D".color,
+                  ),
+                ),
+                // 进度条
+                AnimatedBuilder(
+                  animation: _animation,
+                  builder: (context, child) {
+                    return Align(
+                      alignment: Alignment.centerLeft,
+                      child: Container(
+                        width: 240.w * _animation.value,
+                        height: 13.h,
+                        decoration: BoxDecoration(
+                          borderRadius: BorderRadius.circular(26.r),
+                          gradient: LinearGradient(
+                            begin: Alignment.centerLeft,
+                            end: Alignment.centerRight,
+                            colors: ['#0279FB'.color, '#61A5F8'.color],
+                          ),
+                        ),
+                      ),
+                    );
+                  },
+                ),
+                // 图标
+                AnimatedBuilder(
+                  animation: _animation,
+                  builder: (context, child) {
+                    return Positioned(
+                      left: (226.w * _animation.value) - 10.w, // 调整图标位置
+                      child: Container(
+                        width: 20.w,
+                        height: 20.h,
+                        decoration: const BoxDecoration(
+                          color: Colors.blue,
+                          shape: BoxShape.circle,
+                        ),
+                        child: const Center(
+                          child: Icon(
+                            Icons.rocket_launch,
+                            color: Colors.white,
+                            size: 12,
+                          ),
+                        ),
+                      ),
+                    );
+                  },
+                ),
+              ],
+            ),
+            SizedBox(height: 22.h),
+            Text(
+              'Uploading...',
+              style: TextStyle(
+                  color: Colors.white,
+                  fontSize: 14.sp,
+                  fontWeight: FontWeight.w500),
+            ),
+          ],
+        ),
+      ),
+    );
+  }
+}

+ 68 - 54
lib/module/analysis/analysis_controller.dart

@@ -2,8 +2,10 @@ import 'dart:math';
 
 import 'package:classify_photo/classify_photo.dart';
 import 'package:clean/base/base_controller.dart';
+import 'package:clean/dialog/photo_uploading_dialog.dart';
 import 'package:clean/module/analysis/analysis_state.dart';
 import 'package:clean/utils/expand.dart';
+import 'package:flutter/Material.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
 import 'package:get/get.dart';
@@ -93,58 +95,59 @@ class AnalysisController extends BaseController {
 
   // 上传按钮点击
   void uploadBtnClick() {
-    showCupertinoModalPopup(
-      context: Get.context!,
-      builder: (context) {
-        return CupertinoActionSheet(
-          actions: <Widget>[
-            //操作按钮集合
-            CupertinoActionSheetAction(
-              onPressed: () {
-                Navigator.pop(context);
-                openGallery();
-              },
-              child: Text(
-                'Upload from Gallery',
-                style: TextStyle(
-                  color: "#007AFF".color,
-                  fontWeight: FontWeight.w500,
-                  fontSize: 16.sp,
-                ),
-              ),
-            ),
-            CupertinoActionSheetAction(
-              onPressed: () {
-                Navigator.pop(context);
-                openCamera();
-              },
-              child: Text(
-                'Take and Upload',
-                style: TextStyle(
-                  color: "#007AFF".color,
-                  fontWeight: FontWeight.w500,
-                  fontSize: 16.sp,
-                ),
-              ),
-            ),
-          ],
-          cancelButton: CupertinoActionSheetAction(
-            //取消按钮
-            onPressed: () {
-              Navigator.pop(context);
-            },
-            child: Text(
-              'Cancel',
-              style: TextStyle(
-                color: "#007AFF".color,
-                fontWeight: FontWeight.w500,
-                fontSize: 16.sp,
-              ),
-            ),
-          ),
-        );
-      },
-    );
+    openGallery();
+    // showCupertinoModalPopup(
+    //   context: Get.context!,
+    //   builder: (context) {
+    //     return CupertinoActionSheet(
+    //       actions: <Widget>[
+    //         //操作按钮集合
+    //         CupertinoActionSheetAction(
+    //           onPressed: () {
+    //             Navigator.pop(context);
+    //             openGallery();
+    //           },
+    //           child: Text(
+    //             'Upload from Gallery',
+    //             style: TextStyle(
+    //               color: "#007AFF".color,
+    //               fontWeight: FontWeight.w500,
+    //               fontSize: 16.sp,
+    //             ),
+    //           ),
+    //         ),
+    //         CupertinoActionSheetAction(
+    //           onPressed: () {
+    //             Navigator.pop(context);
+    //             openCamera();
+    //           },
+    //           child: Text(
+    //             'Take and Upload',
+    //             style: TextStyle(
+    //               color: "#007AFF".color,
+    //               fontWeight: FontWeight.w500,
+    //               fontSize: 16.sp,
+    //             ),
+    //           ),
+    //         ),
+    //       ],
+    //       cancelButton: CupertinoActionSheetAction(
+    //         //取消按钮
+    //         onPressed: () {
+    //           Navigator.pop(context);
+    //         },
+    //         child: Text(
+    //           'Cancel',
+    //           style: TextStyle(
+    //             color: "#007AFF".color,
+    //             fontWeight: FontWeight.w500,
+    //             fontSize: 16.sp,
+    //           ),
+    //         ),
+    //       ),
+    //     );
+    //   },
+    // );
   }
 
 // 保存并刷新图片列表
@@ -152,8 +155,19 @@ class AnalysisController extends BaseController {
     for (var asset in assets) {
       await FileUtils.saveAsset(FileType.analysis, asset);
     }
+    showDialog(
+      context: Get.context!,
+      barrierDismissible: false, // 防止点击外部关闭
+      builder: (context) => UploadingDialog(
+        duration: const Duration(seconds: 3),
+        onComplete: () {
+          loadAssets();
+          ToastUtil.show("Successful");
+          // 这里可以添加完成后的操作
+        },
+      ),
+    );
     // 重新加载图片列表
-    loadAssets();
   }
 
   // 选择/取消选择图片
@@ -250,7 +264,7 @@ class AnalysisController extends BaseController {
     }
   }
 
-// 开启相机
+  // 开启相机
   Future<void> openCamera() async {
     final entity = await CameraPicker.pickFromCamera(
       Get.context!,

+ 3 - 1
lib/module/analysis/analysis_view.dart

@@ -124,7 +124,9 @@ class AnalysisPage extends BasePage<AnalysisController> {
                           controller.toggleSelectAll();
                         },
                         child: Text(
-                          "Select All",
+                            controller.isAllSelected.value
+                                ? "Deselect all"
+                                : "Select All",
                           style: TextStyle(
                             color: Colors.white.withOpacity(0.65),
                             fontSize: 14.sp,

+ 1 - 1
lib/module/home/home_view.dart

@@ -72,7 +72,7 @@ class HomePage extends BaseView<HomeController> {
           ),
           GestureDetector(
             onTap: () {
-              Get.toNamed(RoutePath.discount);
+              Get.toNamed(RoutePath.store);
             },
             child: Assets.images.iconHomeTitleVip
                 .image(width: 60.8.w, height: 20.h),

+ 14 - 6
lib/module/photo_info/photo_info_controller.dart

@@ -80,12 +80,20 @@ class PhotoInfoController extends BaseController {
     if (photoDetails.isNotEmpty) {
       createTime.value = photoDetails["createDate"] as String;
       fileName.value = photoDetails["fileName"] as String;
-      model.value = photoDetails["model"] as String;
-      focalLength.value =
-      "${photoDetails["focalLength"] as String}mm f/${photoDetails["aperture"] as String}";
-      var imageSize = ImagePickerUtil.formatFileSize(photoDetails["size"], decimals: 1);
-      size.value = "${photoDetails["width"] as int} X ${photoDetails["height"] as int} $imageSize";
-      iso.value = "ISO${photoDetails["iso"]} ${photoDetails["exposureTime"]}s";
+      if (photoDetails["model"] != null) {
+        model.value = (photoDetails["model"] as String);
+      }
+      if (photoDetails["focalLength"] != null && photoDetails["aperture"] != null) {
+        focalLength.value =
+        "${photoDetails["focalLength"] as String}mm f/${photoDetails["aperture"] as String}";
+      }
+      if (photoDetails["size"] != null && photoDetails["width"] != null && photoDetails["height"] != null) {
+        var imageSize = ImagePickerUtil.formatFileSize(photoDetails["size"], decimals: 1);
+        size.value = "${photoDetails["width"] as int} X ${photoDetails["height"] as int} $imageSize";
+      }
+      if (photoDetails["iso"] != null && photoDetails["exposureTime"] != null) {
+        iso.value = "ISO${photoDetails["iso"]} ${photoDetails["exposureTime"]}s";
+      }
     }
   }
 

+ 183 - 179
lib/module/photo_info/photo_info_view.dart

@@ -4,6 +4,7 @@ import 'package:clean/base/base_page.dart';
 import 'package:clean/module/image_picker/image_picker_util.dart';
 import 'package:clean/module/photo_info/photo_info_controller.dart';
 import 'package:clean/utils/expand.dart';
+import 'package:clean/utils/file_utils.dart';
 import 'package:flutter/Material.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
 import 'package:get/get.dart';
@@ -66,208 +67,211 @@ class PhotoInfoPage extends BasePage<PhotoInfoController> {
                   _buildImageCarousel(),
                 ],
               ),
-              Positioned(
-                left: 0,
-                right: 0,
-                bottom: 0,
-                child: Column(
-                  crossAxisAlignment: CrossAxisAlignment.start,
-                  children: [
-                    Container(
-                      margin: EdgeInsets.only(left: 18.w),
-                      child: Obx(() {
-                        return Column(
-                          crossAxisAlignment: CrossAxisAlignment.start,
-                          children: [
-                            Text(
-                              "Analysis Results",
-                              style: TextStyle(
-                                color: Colors.white,
-                                fontWeight: FontWeight.w900,
-                                fontSize: 16.sp,
+              Visibility(
+                visible: controller.type.value == FileType.analysis,
+                child: Positioned(
+                  left: 0,
+                  right: 0,
+                  bottom: 0,
+                  child: Column(
+                    crossAxisAlignment: CrossAxisAlignment.start,
+                    children: [
+                      Container(
+                        margin: EdgeInsets.only(left: 18.w),
+                        child: Obx(() {
+                          return Column(
+                            crossAxisAlignment: CrossAxisAlignment.start,
+                            children: [
+                              Text(
+                                "Analysis Results",
+                                style: TextStyle(
+                                  color: Colors.white,
+                                  fontWeight: FontWeight.w900,
+                                  fontSize: 16.sp,
+                                ),
                               ),
-                            ),
-                            Visibility(
-                              visible: controller.createTime.value.isNotEmpty,
-                              child: Column(
-                                children: [
-                                  SizedBox(
-                                    height: 20.h,
-                                  ),
-                                  Text(
-                                    controller.createTime.value,
-                                    style: TextStyle(
-                                      color: Colors.white,
-                                      fontWeight: FontWeight.w500,
-                                      fontSize: 13.sp,
+                              Visibility(
+                                visible: controller.createTime.value.isNotEmpty,
+                                child: Column(
+                                  children: [
+                                    SizedBox(
+                                      height: 20.h,
                                     ),
-                                  ),
-                                ],
+                                    Text(
+                                      controller.createTime.value,
+                                      style: TextStyle(
+                                        color: Colors.white,
+                                        fontWeight: FontWeight.w500,
+                                        fontSize: 13.sp,
+                                      ),
+                                    ),
+                                  ],
+                                ),
                               ),
-                            ),
-                            Visibility(
-                              visible: controller.fileName.value.isNotEmpty,
-                              child: Column(
-                                children: [
-                                  SizedBox(
-                                    height: 12.h,
-                                  ),
-                                  Text(
-                                    controller.fileName.value,
-                                    style: TextStyle(
-                                      color: Colors.white,
-                                      fontWeight: FontWeight.w500,
-                                      fontSize: 13.sp,
+                              Visibility(
+                                visible: controller.fileName.value.isNotEmpty,
+                                child: Column(
+                                  children: [
+                                    SizedBox(
+                                      height: 12.h,
                                     ),
-                                  ),
-                                ],
+                                    Text(
+                                      controller.fileName.value,
+                                      style: TextStyle(
+                                        color: Colors.white,
+                                        fontWeight: FontWeight.w500,
+                                        fontSize: 13.sp,
+                                      ),
+                                    ),
+                                  ],
+                                ),
                               ),
-                            ),
-                            Visibility(
-                              visible: controller.model.value.isNotEmpty,
-                              child: Column(
-                                children: [
-                                  SizedBox(
-                                    height: 12.h,
-                                  ),
-                                  Text(
-                                    controller.model.value,
-                                    style: TextStyle(
-                                      color: Colors.white,
-                                      fontWeight: FontWeight.w500,
-                                      fontSize: 13.sp,
+                              Visibility(
+                                visible: controller.model.value.isNotEmpty,
+                                child: Column(
+                                  children: [
+                                    SizedBox(
+                                      height: 12.h,
                                     ),
-                                  ),
-                                ],
+                                    Text(
+                                      controller.model.value,
+                                      style: TextStyle(
+                                        color: Colors.white,
+                                        fontWeight: FontWeight.w500,
+                                        fontSize: 13.sp,
+                                      ),
+                                    ),
+                                  ],
+                                ),
                               ),
-                            ),
-                            Visibility(
-                              visible: controller.focalLength.value.isNotEmpty,
-                              child: Column(
-                                children: [
-                                  SizedBox(
-                                    height: 12.h,
-                                  ),
-                                  Text(
-                                    controller.focalLength.value,
-                                    style: TextStyle(
-                                      color: Colors.white,
-                                      fontWeight: FontWeight.w500,
-                                      fontSize: 13.sp,
+                              Visibility(
+                                visible: controller.focalLength.value.isNotEmpty,
+                                child: Column(
+                                  children: [
+                                    SizedBox(
+                                      height: 12.h,
                                     ),
-                                  ),
-                                ],
+                                    Text(
+                                      controller.focalLength.value,
+                                      style: TextStyle(
+                                        color: Colors.white,
+                                        fontWeight: FontWeight.w500,
+                                        fontSize: 13.sp,
+                                      ),
+                                    ),
+                                  ],
+                                ),
                               ),
-                            ),
-                            Visibility(
-                              visible: controller.size.value.isNotEmpty,
-                              child: Column(
-                                children: [
-                                  SizedBox(
-                                    height: 12.h,
-                                  ),
-                                  Text(
-                                    controller.size.value,
-                                    style: TextStyle(
-                                      color: Colors.white,
-                                      fontWeight: FontWeight.w500,
-                                      fontSize: 13.sp,
+                              Visibility(
+                                visible: controller.size.value.isNotEmpty,
+                                child: Column(
+                                  children: [
+                                    SizedBox(
+                                      height: 12.h,
                                     ),
-                                  ),
-                                ],
+                                    Text(
+                                      controller.size.value,
+                                      style: TextStyle(
+                                        color: Colors.white,
+                                        fontWeight: FontWeight.w500,
+                                        fontSize: 13.sp,
+                                      ),
+                                    ),
+                                  ],
+                                ),
                               ),
-                            ),
-                            Visibility(
-                              visible: controller.iso.value.isNotEmpty,
-                              child: Column(
-                                children: [
-                                  SizedBox(
-                                    height: 12.h,
-                                  ),
-                                  Text(
-                                    controller.iso.value,
-                                    style: TextStyle(
-                                      color: Colors.white,
-                                      fontWeight: FontWeight.w500,
-                                      fontSize: 13.sp,
+                              Visibility(
+                                visible: controller.iso.value.isNotEmpty,
+                                child: Column(
+                                  children: [
+                                    SizedBox(
+                                      height: 12.h,
                                     ),
-                                  ),
-                                ],
+                                    Text(
+                                      controller.iso.value,
+                                      style: TextStyle(
+                                        color: Colors.white,
+                                        fontWeight: FontWeight.w500,
+                                        fontSize: 13.sp,
+                                      ),
+                                    ),
+                                  ],
+                                ),
+                              ),
+                              Visibility(
+                                visible: controller.address.value.isNotEmpty,
+                                child: Column(
+                                  children: [
+                                    SizedBox(
+                                      height: 12.h,
+                                    ),
+                                    Text(
+                                      controller.address.value,
+                                      style: TextStyle(
+                                        color: Colors.white,
+                                        fontWeight: FontWeight.w500,
+                                        fontSize: 13.sp,
+                                      ),
+                                    ),
+                                  ],
+                                ),
+                              ),
+                              SizedBox(height: 32.h,),
+                            ],
+                          );
+                        }),
+                      ),
+                      Center(
+                        child: GestureDetector(
+                          onTap: () {
+                            controller.deleteBtnClick(
+                                controller.imageList[
+                                controller.currentImageIndex.value],
+                                controller.currentImageIndex.value);
+                          },
+                          child: Container(
+                            width: 328.w,
+                            height: 48.h,
+                            decoration: BoxDecoration(
+                              color: "#0279FB".color,
+                              borderRadius: BorderRadius.all(
+                                Radius.circular(10.r),
                               ),
                             ),
-                            Visibility(
-                              visible: controller.address.value.isNotEmpty,
-                              child: Column(
+                            child: Center(
+                              child: Row(
+                                mainAxisAlignment: MainAxisAlignment.center,
                                 children: [
+                                  Assets.images.iconPrivacyPhotoDelete
+                                      .image(width: 18.w, height: 18.h),
                                   SizedBox(
-                                    height: 12.h,
-                                  ),
-                                  Text(
-                                    controller.address.value,
-                                    style: TextStyle(
-                                      color: Colors.white,
-                                      fontWeight: FontWeight.w500,
-                                      fontSize: 13.sp,
-                                    ),
+                                    width: 5.w,
                                   ),
+                                  Obx(() {
+                                    if (controller.imageList.isEmpty) {
+                                      return SizedBox.shrink();
+                                    }
+                                    return Text(
+                                      controller.formatFileSize(controller
+                                          .imageList[controller
+                                          .currentImageIndex.value]
+                                          .size ??
+                                          0),
+                                      style: TextStyle(
+                                        color: Colors.white,
+                                        fontSize: 16.sp,
+                                        fontWeight: FontWeight.w500,
+                                      ),
+                                    );
+                                  }),
                                 ],
                               ),
                             ),
-                            SizedBox(height: 32.h,),
-                          ],
-                        );
-                      }),
-                    ),
-                    Center(
-                      child: GestureDetector(
-                        onTap: () {
-                          controller.deleteBtnClick(
-                              controller.imageList[
-                              controller.currentImageIndex.value],
-                              controller.currentImageIndex.value);
-                        },
-                        child: Container(
-                          width: 328.w,
-                          height: 48.h,
-                          decoration: BoxDecoration(
-                            color: "#0279FB".color,
-                            borderRadius: BorderRadius.all(
-                              Radius.circular(10.r),
-                            ),
-                          ),
-                          child: Center(
-                            child: Row(
-                              mainAxisAlignment: MainAxisAlignment.center,
-                              children: [
-                                Assets.images.iconPrivacyPhotoDelete
-                                    .image(width: 18.w, height: 18.h),
-                                SizedBox(
-                                  width: 5.w,
-                                ),
-                                Obx(() {
-                                  if (controller.imageList.isEmpty) {
-                                    return SizedBox.shrink();
-                                  }
-                                  return Text(
-                                    controller.formatFileSize(controller
-                                        .imageList[controller
-                                        .currentImageIndex.value]
-                                        .size ??
-                                        0),
-                                    style: TextStyle(
-                                      color: Colors.white,
-                                      fontSize: 16.sp,
-                                      fontWeight: FontWeight.w500,
-                                    ),
-                                  );
-                                }),
-                              ],
-                            ),
                           ),
                         ),
                       ),
-                    ),
-                  ],
+                    ],
+                  ),
                 ),
               ),
             ],

+ 23 - 7
lib/module/privacy/privacy_controller.dart

@@ -16,6 +16,7 @@ import 'package:permission_handler/permission_handler.dart';
 import 'package:wechat_assets_picker/wechat_assets_picker.dart';
 import 'package:wechat_camera_picker/wechat_camera_picker.dart';
 
+import '../../dialog/photo_uploading_dialog.dart';
 import '../../utils/toast_util.dart';
 import '../image_picker/image_picker_assets.dart';
 
@@ -222,15 +223,18 @@ class PrivacyController extends BaseController {
   }
 
   void dialogSetPassword() {
-    // 存在密码情况下
-    if (isPrivacyExistPasswd.value) {
+    // // 存在密码情况下
+    // if (isPrivacyExistPasswd.value) {
+    //   isConfirm.value = false;
+    //   isUnlock.value = false;
+    //   passwordTitle.value = "Input password";
+    //   isReset = true;
+    // } else {
       isConfirm.value = false;
       isUnlock.value = false;
-      passwordTitle.value = "Input password";
+      passwordTitle.value = "Create New Password";
       isReset = true;
-    } else {
-      isUnlock.value = false;
-    }
+    // }
   }
 
 // 设置公开状态
@@ -304,8 +308,20 @@ class PrivacyController extends BaseController {
     for (var asset in assets) {
       await FileUtils.saveAsset(FileType.privacy, asset);
     }
+    showDialog(
+      context: Get.context!,
+      barrierDismissible: false, // 防止点击外部关闭
+      builder: (context) => UploadingDialog(
+        duration: const Duration(seconds: 3),
+        onComplete: () {
+          loadAssets();
+          ToastUtil.show("Successful");
+          // 这里可以添加完成后的操作
+        },
+      ),
+    );
     // 重新加载图片列表
-    loadAssets();
+    // loadAssets();
   }
 
   // 选择/取消选择图片

+ 7 - 3
lib/module/privacy/privacy_view.dart

@@ -330,7 +330,9 @@ class PrivacyPage extends BaseView<PrivacyController> {
                                 controller.toggleSelectAll();
                               },
                               child: Text(
-                                "Select All",
+                                controller.isAllSelected.value
+                                    ? "Deselect all"
+                                    : "Select All",
                                 style: TextStyle(
                                   color: Colors.white.withOpacity(0.65),
                                   fontSize: 14.sp,
@@ -569,8 +571,10 @@ class PrivacyPage extends BaseView<PrivacyController> {
     return GestureDetector(
       onTap: () async {
         // 获取当前资产在列表中的索引
-        final index = PrivacyState.imageList.indexWhere((item) => item.id == asset.id);
-        if (index != -1) { // 确保找到了索引
+        final index =
+            PrivacyState.imageList.indexWhere((item) => item.id == asset.id);
+        if (index != -1) {
+          // 确保找到了索引
           final result = await Get.toNamed(RoutePath.photoInfo, arguments: {
             "type": "privacy",
             "list": PrivacyState.imageList,

+ 8 - 6
lib/utils/file_utils.dart

@@ -43,7 +43,7 @@ class FileUtils {
       // 保存原始图片文件
       final file = await asset.file;
       if (file != null) {
-        final imageFile = File('$assetPath/$title.jpg');
+        final imageFile = File('$assetPath/$title.PNG');
         await imageFile.writeAsBytes(await file.readAsBytes());
 
         final originalFile = await asset.originFile;
@@ -56,17 +56,19 @@ class FileUtils {
           if (index != -1) {
             // 截取 "o_" 后面的字符串
             mediaPath += originalPath.substring(index + 3);
+            mediaPath = mediaPath.replaceAll("jpg", "PNG");
           }
         }
 
         // 保存缩略图
         final thumbData = await asset.thumbnailDataWithSize(ThumbnailSize(200, 200));
         if (thumbData != null) {
-          final thumbFile = File('$assetPath/${title}thumb.jpg');
+          final thumbFile = File('$assetPath/${title}thumb.PNG');
           await thumbFile.writeAsBytes(thumbData);
 
           // 创建并保存 AssetInfo
-          final assetInfo = AssetInfo.fromAssetEntity(asset, '$assetPath/$title.jpg', '$assetPath/${title}thumb.jpg', mediaPath);
+          final assetInfo = AssetInfo.fromAssetEntity(asset, '$assetPath/$title.PNG',
+              '$assetPath/${title}thumb.PNG', mediaPath);
           final assetFile = File('$assetPath/$title.json');
           await assetFile.writeAsString(jsonEncode(assetInfo.toJson()));
         }
@@ -83,7 +85,7 @@ class FileUtils {
   static Future<Uint8List?> getThumbData(FileType type, String assetId) async {
     try {
       final assetPath = await getAssetPath(type);
-      final thumbFile = File('$assetPath/${assetId}thumb.jpg');
+      final thumbFile = File('$assetPath/${assetId}thumb.PNG');
       if (await thumbFile.exists()) {
         return await thumbFile.readAsBytes();
       }
@@ -154,12 +156,12 @@ class FileUtils {
         await assetFile.delete();
       }
 
-      final assetFileImage = File('$assetPath/$fileName.jpg');
+      final assetFileImage = File('$assetPath/$fileName.PNG');
       if (await assetFileImage.exists()) {
         await assetFileImage.delete();
       }
 
-      final assetFileIThumb = File('$assetPath/${fileName}thumb.jpg');
+      final assetFileIThumb = File('$assetPath/${fileName}thumb.PNG');
       if (await assetFileIThumb.exists()) {
         await assetFileIThumb.delete();
       }

+ 1 - 1
lib/utils/image_util.dart

@@ -71,7 +71,7 @@ class ImageUtil {
     try {
       // 先尝试从本地读取
       final assetPath = await FileUtils.getAssetPath(type);
-      final localFile = File('$assetPath/${asset.id.substring(0, 36)}.jpg');
+      final localFile = File('$assetPath/${asset.id.substring(0, 36)}.PNG');
       if (await localFile.exists()) {
         return localFile;
       }

+ 0 - 8
pubspec.lock

@@ -364,14 +364,6 @@ packages:
       url: "https://pub.flutter-io.cn"
     source: hosted
     version: "0.2.1"
-  dsbridge_flutter:
-    dependency: "direct main"
-    description:
-      name: dsbridge_flutter
-      sha256: "887ee2b50f43be294815af33f9a8499f35ce7e7bbb8eeb2234a0e1984d1254e0"
-      url: "https://pub.flutter-io.cn"
-    source: hosted
-    version: "1.2.0"
   exif:
     dependency: "direct main"
     description:

+ 1 - 4
pubspec.yaml

@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
 # In Windows, build-name is used as the major, minor, and patch parts
 # of the product and file versions while build-number is used as the build suffix.
-version: 1.0.0+8
+version: 1.0.0+9
 
 environment:
   sdk: ^3.6.0
@@ -111,9 +111,6 @@ dependencies:
   # 存储空间
   disk_space: ^0.2.1
 
-  #web通信
-  dsbridge_flutter: ^1.1.0
-
   #网页跳转
   webview_flutter: ^4.10.0