Преглед на файлове

[fit]增加描扫状态,去掉埋点toast

云天逵 преди 10 месеца
родител
ревизия
e5cce57fc3
променени са 4 файла, в които са добавени 121 реда и са изтрити 115 реда
  1. 1 1
      lib/data/consts/build_config.dart
  2. 1 1
      lib/handler/event_handler.dart
  3. 7 2
      lib/module/home/home_controller.dart
  4. 112 111
      lib/module/home/home_view.dart

+ 1 - 1
lib/data/consts/build_config.dart

@@ -12,7 +12,7 @@ final class UmengConfig {
   UmengConfig._();
 
   //友盟统计配置
-  static const umengAndroidAppKey = "678617728f232a05f1f8de39";
+  static const umengAndroidAppKey = "67c6e1a08f232a05f12680a8";
   static const umengIosAppKey = "678617728f232a05f1f8de39";
 
 

+ 1 - 1
lib/handler/event_handler.dart

@@ -5,7 +5,7 @@ import '../data/consts/constants.dart';
 import '../utils/toast_util.dart';
 
 class EventHandler {
-  static const bool isShowToast = true;
+  static const bool isShowToast = false;
 
   EventHandler._();
 

+ 7 - 2
lib/module/home/home_controller.dart

@@ -62,6 +62,9 @@ class HomeController extends BaseController {
   // 是否扫描完成
   RxBool isScanned = false.obs;
 
+  // 存储是否扫描完成
+  RxBool isStorageScanned = false.obs;
+
   UserInfoResponse? get userInfo => userRepository.userInfo.value;
 
   @override
@@ -95,6 +98,7 @@ class HomeController extends BaseController {
     super.onReady();
     // EventHandler.report(EventId.event_03000);
   }
+
   Future<void> loadPhotosFromDirectory() async {
     if (ImagePickerUtil.peoplePhotos.isEmpty ||
         ImagePickerUtil.similarPhotos.isEmpty ||
@@ -151,6 +155,7 @@ class HomeController extends BaseController {
       print('可用空间: $freeSpaceStr');
       print('已用空间: $usedSpaceStr');
       print('照片占用: $photoSpaceStr');
+      isStorageScanned.value = true;
     } catch (e) {
       print('获取存储信息失败: $e');
     }
@@ -219,6 +224,7 @@ class HomeController extends BaseController {
       print('Stack trace: $stackTrace');
     }
   }
+
   void _navigateAndStartPage(Function pageStartFunction) {
     // if (isFirstClickHomeClean()) {
     //   setFirstClickHomeClean(false);
@@ -226,7 +232,7 @@ class HomeController extends BaseController {
     //     pageStartFunction();
     //   });
     // } else {
-      pageStartFunction();
+    pageStartFunction();
     // }
   }
 
@@ -264,5 +270,4 @@ class HomeController extends BaseController {
     EventHandler.report(EventId.event_02000);
     Get.toNamed(RoutePath.store);
   }
-
 }

+ 112 - 111
lib/module/home/home_view.dart

@@ -34,22 +34,21 @@ class HomePage extends BaseView<HomeController> {
         SafeArea(
           child: SingleChildScrollView(
               child: Column(
-                children: [
-                  titleCard(),
-                  storageCard(),
-                  similarCard(),
-                  quickPhotoCard(),
-                  peopleCard(),
-                  locationsCard(),
-                  screenshotsAndBlurryCard(),
-                  SizedBox(height: 40.h),
-                ],
-              )),
+            children: [
+              titleCard(),
+              storageCard(),
+              similarCard(),
+              quickPhotoCard(),
+              peopleCard(),
+              locationsCard(),
+              screenshotsAndBlurryCard(),
+              SizedBox(height: 40.h),
+            ],
+          )),
         ),
         IgnorePointer(
           child: Assets.images.bgHome.image(
             width: 360.w,
-
           ),
         ),
       ],
@@ -120,7 +119,7 @@ class HomePage extends BaseView<HomeController> {
                     Colors.red),
                 PieData(
                   'Unused Space',
-                  controller.freeSpacePercentage,
+                 controller.isStorageScanned.value?  controller.freeSpacePercentage: 100,
                   Colors.white.withValues(alpha: 0.10000000149011612),
                 ),
               ],
@@ -141,51 +140,53 @@ class HomePage extends BaseView<HomeController> {
             CircularChartAnnotation(
               widget: Container(
                   child: Column(
-                    mainAxisSize: MainAxisSize.min,
-                    crossAxisAlignment: CrossAxisAlignment.center,
+                mainAxisSize: MainAxisSize.min,
+                crossAxisAlignment: CrossAxisAlignment.center,
+                children: [
+                  Row(
+                    mainAxisAlignment: MainAxisAlignment.center,
+                    crossAxisAlignment: CrossAxisAlignment.end,
                     children: [
-                      Row(
-                        mainAxisAlignment: MainAxisAlignment.center,
-                        crossAxisAlignment: CrossAxisAlignment.end,
-                        children: [
-                          Obx(() {
-                            return Text(
-                              controller.usedSpacePercentage.toStringAsFixed(0),
-                              textAlign: TextAlign.end,
-                              style: TextStyle(
-                                color: Colors.white
-                                    .withValues(alpha: 0.8999999761581421),
-                                fontSize: 30.sp,
-                                height: 1,
-                                fontWeight: FontWeight.w400,
-                              ),
-                            );
-                          }),
-                          Text(
-                            '%',
-                            textAlign: TextAlign.end,
-                            style: TextStyle(
-                              color: Colors.white
-                                  .withValues(alpha: 0.8999999761581421),
-                              fontSize: 14.87.r,
-                              fontWeight: FontWeight.w500,
-                            ),
+                      Obx(() {
+                        return Text(
+                          controller.isStorageScanned.value
+                              ? controller.usedSpacePercentage
+                                  .toStringAsFixed(0)
+                              : "0",
+                          textAlign: TextAlign.end,
+                          style: TextStyle(
+                            color: Colors.white
+                                .withValues(alpha: 0.8999999761581421),
+                            fontSize: 30.sp,
+                            height: 1,
+                            fontWeight: FontWeight.w400,
                           ),
-                        ],
-                      ),
+                        );
+                      }),
                       Text(
-                        'used',
-                        textAlign: TextAlign.center,
+                        '%',
+                        textAlign: TextAlign.end,
                         style: TextStyle(
-                          color: Colors.white.withValues(
-                              alpha: 0.6000000238418579),
+                          color: Colors.white
+                              .withValues(alpha: 0.8999999761581421),
                           fontSize: 14.87.r,
-                          height: 1,
                           fontWeight: FontWeight.w500,
                         ),
-                      )
+                      ),
                     ],
-                  )),
+                  ),
+                  Text(
+                    controller.isStorageScanned.value ? 'used' : 'Scanning...',
+                    textAlign: TextAlign.center,
+                    style: TextStyle(
+                      color: Colors.white.withValues(alpha: 0.6000000238418579),
+                      fontSize:controller.isStorageScanned.value?  14.87.sp: 12.sp,
+                      height: 1,
+                      fontWeight: FontWeight.w500,
+                    ),
+                  )
+                ],
+              )),
               horizontalAlignment: ChartAlignment.center,
               verticalAlignment: ChartAlignment.center,
               radius: '0%',
@@ -256,7 +257,7 @@ class HomePage extends BaseView<HomeController> {
                           controller.totalSpace.value),
                       style: TextStyle(
                         color:
-                        Colors.white.withValues(alpha: 0.6000000238418579),
+                            Colors.white.withValues(alpha: 0.6000000238418579),
                         fontSize: 13.sp,
                         fontWeight: FontWeight.w400,
                       ),
@@ -265,7 +266,7 @@ class HomePage extends BaseView<HomeController> {
                       text: 'GB',
                       style: TextStyle(
                         color:
-                        Colors.white.withValues(alpha: 0.6000000238418579),
+                            Colors.white.withValues(alpha: 0.6000000238418579),
                         fontSize: 13.sp,
                         fontWeight: FontWeight.w500,
                       ),
@@ -426,7 +427,7 @@ class HomePage extends BaseView<HomeController> {
               Obx(() {
                 return CleanUpButton(
                   label:
-                  !controller.isScanned.value ? 'Scanning...' : 'Clean up',
+                      !controller.isScanned.value ? 'Scanning...' : 'Clean up',
                   size: ImagePickerUtil.formatFileSize(
                       ImagePickerUtil.similarPhotosSize.value),
                   onTap: () {
@@ -455,11 +456,11 @@ class HomePage extends BaseView<HomeController> {
                       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 Assets.images.iconHomeNoPhoto.image(
+                      width: 70.w * 0.45,
+                      height: 70.w * 0.45,
+                    );
+                  });
                 }
                 return ImageContainer(
                   size: 70.w,
@@ -549,11 +550,11 @@ class HomePage extends BaseView<HomeController> {
                           thumbnailSize: const ThumbnailSize.square(300),
                           fit: BoxFit.cover,
                           errorBuilder: (context, error, stackTrace) {
-                            return Assets.images.iconHomeNoPhoto.image(
-                              width: 146.w * 0.45,
-                              height: 146.w * 0.45,
-                            );
-                          });
+                        return Assets.images.iconHomeNoPhoto.image(
+                          width: 146.w * 0.45,
+                          height: 146.w * 0.45,
+                        );
+                      });
                     }
                     return ImageContainer(
                       image: image,
@@ -632,23 +633,23 @@ class HomePage extends BaseView<HomeController> {
                   return Center(
                     child: controller.locationPhoto.value == null
                         ? Assets.images.iconHomeNoPhoto.image(
-                      width: 60.w,
-                      height: 60.h,
-                    )
+                            width: 60.w,
+                            height: 60.h,
+                          )
                         : AssetEntityImage(
-                      width: 304.w,
-                      height: 171.h,
-                      controller.locationPhoto.value!,
-                      isOriginal: false,
-                      thumbnailSize: const ThumbnailSize.square(300),
-                      fit: BoxFit.cover,
-                      errorBuilder: (context, error, stackTrace) {
-                        return Assets.images.iconHomeNoPhoto.image(
-                          width: 60.w,
-                          height: 60.h,
-                        );
-                      },
-                    ),
+                            width: 304.w,
+                            height: 171.h,
+                            controller.locationPhoto.value!,
+                            isOriginal: false,
+                            thumbnailSize: const ThumbnailSize.square(300),
+                            fit: BoxFit.cover,
+                            errorBuilder: (context, error, stackTrace) {
+                              return Assets.images.iconHomeNoPhoto.image(
+                                width: 60.w,
+                                height: 60.h,
+                              );
+                            },
+                          ),
                     // Image.file(
                     //         width: 304.w,
                     //         height: 171.h,
@@ -695,23 +696,23 @@ class HomePage extends BaseView<HomeController> {
                   ImagePickerUtil.screenshotsSize.value),
               controller.screenshotPhoto.value == null
                   ? Assets.images.iconHomeNoPhoto.image(
-                width: 60.w,
-                height: 60.h,
-              )
+                      width: 60.w,
+                      height: 60.h,
+                    )
                   : AssetEntityImage(
-                width: 144.w,
-                height: 142.h,
-                controller.screenshotPhoto.value!,
-                isOriginal: false,
-                thumbnailSize: const ThumbnailSize.square(300),
-                fit: BoxFit.cover,
-                errorBuilder: (context, error, stackTrace) {
-                  return Assets.images.iconHomeNoPhoto.image(
-                    width: 60.w,
-                    height: 60.h,
-                  );
-                },
-              ),
+                      width: 144.w,
+                      height: 142.h,
+                      controller.screenshotPhoto.value!,
+                      isOriginal: false,
+                      thumbnailSize: const ThumbnailSize.square(300),
+                      fit: BoxFit.cover,
+                      errorBuilder: (context, error, stackTrace) {
+                        return Assets.images.iconHomeNoPhoto.image(
+                          width: 60.w,
+                          height: 60.h,
+                        );
+                      },
+                    ),
               onTap: () {
                 controller.screenshotCleanClick();
               },
@@ -723,23 +724,23 @@ class HomePage extends BaseView<HomeController> {
                     ImagePickerUtil.blurrySize.value),
                 controller.blurryPhoto.value == null
                     ? Assets.images.iconHomeNoPhoto.image(
-                  width: 60.w,
-                  height: 60.h,
-                )
+                        width: 60.w,
+                        height: 60.h,
+                      )
                     : AssetEntityImage(
-                  width: 144.w,
-                  height: 142.h,
-                  controller.blurryPhoto.value!,
-                  isOriginal: false,
-                  thumbnailSize: const ThumbnailSize.square(300),
-                  fit: BoxFit.cover,
-                  errorBuilder: (context, error, stackTrace) {
-                    return Assets.images.iconHomeNoPhoto.image(
-                      width: 60.w,
-                      height: 60.h,
-                    );
-                  },
-                ), onTap: () {
+                        width: 144.w,
+                        height: 142.h,
+                        controller.blurryPhoto.value!,
+                        isOriginal: false,
+                        thumbnailSize: const ThumbnailSize.square(300),
+                        fit: BoxFit.cover,
+                        errorBuilder: (context, error, stackTrace) {
+                          return Assets.images.iconHomeNoPhoto.image(
+                            width: 60.w,
+                            height: 60.h,
+                          );
+                        },
+                      ), onTap: () {
               controller.blurryCleanClick();
             }),
           ],