Browse Source

[fit]增加隐私分析改成背景图,修改存储环形数据填充的问题

云天逵 9 tháng trước cách đây
mục cha
commit
4acb59cf47

BIN
assets/images/bg_photo_analyze.webp


+ 3 - 3
lib/module/home/home_controller.dart

@@ -85,7 +85,7 @@ class HomeController extends BaseController {
   List<PieData> get pieDataList => [
         PieData("PhotoSpace", photoSpacePercentage, Colors.blue),
         PieData("OtherUsed", usedSpacePercentage - photoSpacePercentage, Colors.red),
-        PieData("Unused", freeSpacePercentage, Colors.grey.withOpacity(0.1)),
+        PieData("totalSpace", totalSpace.value, Colors.grey.withOpacity(0.1)),
       ];
 
   @override
@@ -98,10 +98,10 @@ class HomeController extends BaseController {
       // 延迟3秒
       Future.delayed(const Duration(seconds: 3), () {
         isStorageScanned.value = true;
-        totalSpace.value = 100.0;
+        totalSpace.value = 200.0;
         usedSpace.value = 50.0;
         photoSpace.value = 30.0;
-        freeSpace.value = 50.0;
+        freeSpace.value = 0.0;
       });
 
 

+ 53 - 57
lib/module/home/home_view.dart

@@ -361,7 +361,7 @@ class HomePage extends BaseView<HomeController> {
                   ),
                   Obx(() {
                     return CleanUpButton(
-                      label: !controller.isScanned.value
+                      label: !controller.isSimilarScanned.value
                           ? 'Scanning...'
                           : 'Clean up',
                       size: ImagePickerUtil.formatFileSize(
@@ -376,62 +376,52 @@ class HomePage extends BaseView<HomeController> {
               // SizedBox(height: 19.h),
               Spacer(),
               Obx(() {
-                return CleanUpButton(
-                  label:
-                  !controller.isSimilarScanned.value ? 'Scanning...' : 'Clean up',
-                  size: ImagePickerUtil.formatFileSize(
-                      ImagePickerUtil.similarPhotosSize.value),
-                  onTap: () {
-                    controller.similarCleanClick();
-                  },
-                );
-              }),
-            ],
-          ),
-          // SizedBox(height: 19.h),
-          Spacer(),
-          Obx(() {
-            return Row(
-              mainAxisAlignment: MainAxisAlignment.spaceBetween,
-              children: List.generate(4, (index) {
-                var image = Assets.images.iconHomeNoPhoto.image(
-                  width: 70.w * 0.45,
-                  height: 70.w * 0.45,
-                );
-                if (controller.similarPhotos.length > index) {
-                  image = AssetEntityImage(
-                      width: 70.w,
-                      height: 70.w,
-                      controller.similarPhotos[index],
-                      isOriginal: false,
-                      thumbnailSize: const ThumbnailSize.square(300),
-                      fit: BoxFit.cover,
-                      errorBuilder: (context, error, stackTrace) {
+                return Row(
+                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                  children: List.generate(4, (index) {
+                    var image = Assets.images.iconHomeNoPhoto.image(
+                      width: 70.w * 0.45,
+                      height: 70.w * 0.45,
+                    );
+                    if (controller.similarPhotos.length > index) {
+                      image = AssetEntityImage(
+                          width: 70.w,
+                          height: 70.w,
+                          controller.similarPhotos[index],
+                          isOriginal: false,
+                          thumbnailSize: const ThumbnailSize.square(300),
+                          fit: BoxFit.cover,
+                          errorBuilder: (context, error, stackTrace) {
                         return Assets.images.iconHomeNoPhoto.image(
                           width: 70.w * 0.45,
                           height: 70.w * 0.45,
                         );
                       });
-                }
-                return ImageContainer(
-                  size: 70.w,
-                  image: controller.similarPhotos.length > index ? image : Opacity(
-                    opacity: 0.22,
-                    child: const CircularProgressIndicator(color: Colors.white38,)
-                  ),
-                  // AssetEntityImage(
-                  //         width: 70.w,
-                  //         height: 70.w,
-                  //         controller.similarPhotos[index],
-                  //         isOriginal: false,
-                  //         thumbnailSize: const ThumbnailSize.square(300),
-                  //         fit: BoxFit.cover,
-                  //         errorBuilder: (context, error, stackTrace) {
-                  //           return Assets.images.iconHomeNoPhoto.image(
-                  //             width: 70.w * 0.45,
-                  //             height: 70.w * 0.45,
-                  //           );
-                  //         },
+                    }
+                    return controller.similarPhotos.isNotEmpty
+                        ? image
+                        : ImageContainer(
+                            size: 70.w,
+                            image: Opacity(
+                              opacity: 0.22,
+                              child: Lottie.asset(Assets.anim.animNoPhoto,
+                                  repeat: true, width: 100.w, height: 100.w),
+                            ),
+                            // AssetEntityImage(
+                            //         width: 70.w,
+                            //         height: 70.w,
+                            //         controller.similarPhotos[index],
+                            //         isOriginal: false,
+                            //         thumbnailSize: const ThumbnailSize.square(300),
+                            //         fit: BoxFit.cover,
+                            //         errorBuilder: (context, error, stackTrace) {
+                            //           return Assets.images.iconHomeNoPhoto.image(
+                            //             width: 70.w * 0.45,
+                            //             height: 70.w * 0.45,
+                            //           );
+                            //         },
+                          );
+                  }),
                 );
               }),
               Spacer(),
@@ -513,10 +503,14 @@ class HomePage extends BaseView<HomeController> {
                           });
                         }
                         return ImageContainer(
-                          image: controller.peoplePhotos.length > index ? image : Opacity(
-                            opacity: 0.22,
-                            child: const CircularProgressIndicator(color: Colors.white38,),
-                          ),
+                          image: controller.peoplePhotos.length > index
+                              ? image
+                              : Opacity(
+                                  opacity: 0.22,
+                                  child: const CircularProgressIndicator(
+                                    color: Colors.white38,
+                                  ),
+                                ),
                           size: 146.w,
                           // Image.file(
                           //   width: 146.w,
@@ -657,7 +651,9 @@ class HomePage extends BaseView<HomeController> {
           children: [
             _buildCard(
               'Screenshots',
-              !controller.isScreenShotScanned.value ? 'Scanning...' : 'Clean up',
+              !controller.isScreenShotScanned.value
+                  ? 'Scanning...'
+                  : 'Clean up',
               ImagePickerUtil.formatFileSize(
                   ImagePickerUtil.screenshotsSize.value),
               controller.screenshotPhoto.value == null

+ 3 - 1
lib/module/photo_info/photo_info_view.dart

@@ -78,8 +78,10 @@ class PhotoInfoPage extends BasePage<PhotoInfoController> {
                     crossAxisAlignment: CrossAxisAlignment.start,
                     children: [
                       Container(
+                        width:double.infinity,
                         decoration: BoxDecoration(
-                          color: Colors.black.withValues(alpha: 0.10), // 半透明黑色遮罩
+                          image: DecorationImage(image:
+                              Assets.images.bgPhotoAnalyze.provider(),fit: BoxFit.fill),
                           borderRadius: BorderRadius.circular(12.r),
                         ),
                         margin: EdgeInsets.only(left: 18.w),