Просмотр исходного кода

统一用AssetEntity来加载图片

云天逵 1 год назад
Родитель
Сommit
7cd05bfd70

+ 3 - 0
android/app/src/main/AndroidManifest.xml

@@ -1,8 +1,11 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android">
+    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
+    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
     <application
         android:label="clean"
         android:name="${applicationName}"
         android:icon="@mipmap/ic_launcher">
+
         <activity
             android:name=".MainActivity"
             android:exported="true"

+ 13 - 31
lib/module/locations_photo/locations_photo_controller.dart

@@ -4,6 +4,7 @@ import 'package:clean/module/people_photo/photo_group.dart';
 import 'package:get/get.dart';
 import 'package:path_provider/path_provider.dart';
 import 'package:path/path.dart' as p;
+import 'package:wechat_assets_picker/wechat_assets_picker.dart';
 class LocationsPhotoController extends GetxController {
   final RxList<PhotoGroup> photoGroups = <PhotoGroup>[].obs;
   @override
@@ -11,42 +12,23 @@ class LocationsPhotoController extends GetxController {
     super.onInit();
     loadPhotosFromDirectory();
   }
+
   Future<void> loadPhotosFromDirectory() async {
     try {
-      final Directory appDir = await getApplicationDocumentsDirectory();
-      final String photosPath = '${appDir.path}/photos';
-
-      final Directory photosDir = Directory(photosPath);
-      if (!await photosDir.exists()) {
-        return;
-      }
-
-      final List<Directory> subDirs = await photosDir
-          .list()
-          .where((entity) => entity is Directory)
-          .map((e) => e as Directory)
-          .toList();
-
-      for (final dir in subDirs) {
-        final List<FileSystemEntity> files = await dir
-            .list()
-            .where((entity) =>
-        entity is File &&
-            ['.jpg', '.jpeg', '.png']
-                .contains(p.extension(entity.path).toLowerCase()))
-            .toList();
-
-        if (files.isNotEmpty) {
-          photoGroups.add(PhotoGroup(
-            title: 'photo: ${files.length}',
-            imageCount: files.length,
-            isSelected: false,
-            images: files.map((file) => file.path).toList(),
-          ));
-        }
+      final List<AssetEntity>? result = await AssetPicker.pickAssets(
+        Get.context!,
+      );
+      if (result != null && result.isNotEmpty) {
+        photoGroups.add(PhotoGroup(
+          title: 'photo: ${result.length}',
+          imageCount: result.length,
+          isSelected: false,
+          images: result,
+        ));
       }
     } catch (e) {
       print('Error loading photos: $e');
     }
   }
+
 }

+ 3 - 1
lib/module/locations_photo/locations_photo_view.dart

@@ -7,6 +7,7 @@ import 'package:clean/router/app_pages.dart';
 import 'package:flutter/Material.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
 import 'package:get/get.dart';
+import 'package:wechat_assets_picker/wechat_assets_picker.dart';
 
 class LocationsPhotoPage extends BasePage<LocationsPhotoController> {
   @override
@@ -136,7 +137,8 @@ class LocationsPhotoPage extends BasePage<LocationsPhotoController> {
                           borderRadius: BorderRadius.circular(8.r),
                         ),
                         image: DecorationImage(
-                          image: FileImage(File(imagePath)),
+                          image:
+                          AssetEntityImageProvider(imagePath),
                           fit: BoxFit.cover,
                         ),
                       ),

+ 42 - 40
lib/module/people_photo/people_photo_controller.dart

@@ -1,9 +1,11 @@
 import 'dart:io';
 
+import 'package:clean/module/image_picker/image_picker_util.dart';
 import 'package:clean/module/people_photo/photo_group.dart';
 import 'package:get/get.dart';
 import 'package:path_provider/path_provider.dart';
 import 'package:path/path.dart' as p;
+import 'package:wechat_assets_picker/wechat_assets_picker.dart';
 
 class PeoplePhotoController extends GetxController {
   final RxList<PhotoGroup> photoGroups = <PhotoGroup>[].obs;
@@ -14,12 +16,15 @@ class PeoplePhotoController extends GetxController {
   int get selectedFileCount =>
       photoGroups.fold(0, (sum, group) => sum + group.selectedCount);
 
-  double get selectedFilesSize {
+  Future<double> getSelectedFilesSize() async {
     double totalSize = 0;
     for (var group in photoGroups) {
       for (int i = 0; i < group.images.length; i++) {
         if (group.selectedImages[i]) {
-          totalSize += File(group.images[i]).lengthSync();
+          final file = await group.images[i].file;
+          if (file != null) {
+            totalSize += file.lengthSync();
+          }
         }
       }
     }
@@ -43,12 +48,16 @@ class PeoplePhotoController extends GetxController {
   @override
   void onInit() {
     super.onInit();
-    loadPhotosFromDirectory().then((_) {
-      // 恢复保存的选择状态
+    loadSimilarPhotos();
       if (_hasInitializedSelections) {
         _restoreSelections();
       }
-    });
+    // loadPhotosFromDirectory().then((_) {
+    //   // 恢复保存的选择状态
+    //   if (_hasInitializedSelections) {
+    //     _restoreSelections();
+    //   }
+    // });
   }
 
   void _saveSelections() {
@@ -69,44 +78,37 @@ class PeoplePhotoController extends GetxController {
   }
   Future<void> loadPhotosFromDirectory() async {
     try {
-      final Directory appDir = await getApplicationDocumentsDirectory();
-      final String photosPath = '${appDir.path}/photos';
-
-      final Directory photosDir = Directory(photosPath);
-      if (!await photosDir.exists()) {
-        return;
-      }
-      // 获取photos目录下的所有文件夹
-      final List<Directory> subDirs = await photosDir
-          .list()
-          .where((entity) => entity is Directory)
-          .map((e) => e as Directory)
-          .toList();
-
-      // 遍历每个文件夹
-      for (final dir in subDirs) {
-        // 获取文件夹中的所有图片
-        final List<FileSystemEntity> files = await dir
-            .list()
-            .where((entity) =>
-        entity is File &&
-            ['.jpg', '.jpeg', '.png']
-                .contains(p.extension(entity.path).toLowerCase()))
-            .toList();
-
-        if (files.isNotEmpty) {
-          // 为每个文件夹创建一个PhotoGroup
-          photoGroups.add(PhotoGroup(
-            // title: '${p.basename(dir.path)}: ${files.length}', // 使用文件夹名作为标题
-            title: 'people : ${files.length}', // 使用文件夹名作为标题
-            imageCount: files.length,
-            isSelected: false,
-            images: files.map((file) => file.path).toList(),
-          ));
-        }
+      final List<AssetEntity>? result = await AssetPicker.pickAssets(
+        Get.context!,
+      );
+      if (result != null && result.isNotEmpty) {
+        photoGroups.add(PhotoGroup(
+          title: 'photo: ${result.length}',
+          imageCount: result.length,
+          isSelected: false,
+          images: result,
+        ));
       }
     } catch (e) {
       print('Error loading photos: $e');
     }
   }
+
+  void loadSimilarPhotos() {
+    // 清空现有数据
+    photoGroups.clear();
+
+    // 将 ImagePickerUtil 中的相似照片转换为 PhotoGroup
+
+      final photoGroup = ImagePickerUtil.peoplePhotos;
+      if (photoGroup.isNotEmpty) {
+        photoGroups.add(PhotoGroup(
+          title: 'photo : ${photoGroup.length}',
+          imageCount: photoGroup.length,
+          isSelected: false,
+          images: photoGroup,
+        ));
+      }
+
+  }
 }

+ 77 - 65
lib/module/people_photo/people_photo_view.dart

@@ -8,6 +8,7 @@ import 'package:flutter/Material.dart';
 import 'package:flutter/cupertino.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
 import 'package:get/get.dart';
+import 'package:wechat_assets_picker/wechat_assets_picker.dart';
 
 class PeoplePhotoPage extends BasePage<PeoplePhotoController> {
   const PeoplePhotoPage({super.key});
@@ -44,14 +45,14 @@ class PeoplePhotoPage extends BasePage<PeoplePhotoController> {
                     padding: EdgeInsets.symmetric(horizontal: 16.w),
                     children: [
                       ...controller.photoGroups.map((group) => Column(
-                            children: [
-                              _buildPhotoGroup(
-                                title: group.title,
-                                imageCount: group.imageCount,
-                              ),
-                              SizedBox(height: 15.h),
-                            ],
-                          ))
+                        children: [
+                          _buildPhotoGroup(
+                            title: group.title,
+                            imageCount: group.imageCount,
+                          ),
+                          SizedBox(height: 15.h),
+                        ],
+                      ))
                     ],
                   );
                 }),
@@ -118,15 +119,27 @@ class PeoplePhotoPage extends BasePage<PeoplePhotoController> {
       child: Row(
         mainAxisAlignment: MainAxisAlignment.spaceBetween,
         children: [
-          Obx(() => Text(
-                '${controller.selectedFileCount} files selected (${controller.selectedFilesSize.toStringAsFixed(1)} KB)',
-                textAlign: TextAlign.center,
-                style: TextStyle(
-                  color: Colors.white.withValues(alpha: 0.9),
-                  fontSize: 13.sp,
-                  fontWeight: FontWeight.w500,
-                ),
-              )),
+          Obx(() => FutureBuilder<double>(
+            future: controller.getSelectedFilesSize(),
+            builder: (context, snapshot) {
+              if (snapshot.connectionState == ConnectionState.waiting) {
+                return CircularProgressIndicator();
+              } else if (snapshot.hasError) {
+                return Text('Error: ${snapshot.error}');
+              } else {
+                return Text(
+                  '${controller.selectedFileCount} files selected (${snapshot.data?.toStringAsFixed(1)} KB)',
+                  textAlign: TextAlign.center,
+                  style: TextStyle(
+                    color: Colors.white.withValues(alpha: 0.9),
+                    fontSize: 13.sp,
+                    fontWeight: FontWeight.w500,
+                  ),
+                );
+              }
+            },
+          )
+          ),
           Container(
             width: 108.w,
             height: 38.h,
@@ -148,7 +161,6 @@ class PeoplePhotoPage extends BasePage<PeoplePhotoController> {
                     fontWeight: FontWeight.w500,
                   ),
                 ),
-
                 Assets.images.iconDelete.image(
                   width: 18.w,
                   height: 18.h,
@@ -194,18 +206,18 @@ class PeoplePhotoPage extends BasePage<PeoplePhotoController> {
               GestureDetector(
                 onTap: () => controller.toggleGroupSelection(title),
                 child: Obx(() => Text(
-                      controller.photoGroups
-                              .firstWhere((g) => g.title == title)
-                              .isSelected
-                              .value
-                          ? 'Deselect All'
-                          : 'Select All',
-                      style: TextStyle(
-                        color: Colors.white.withValues(alpha: 0.7),
-                        fontSize: 14.sp,
-                        fontWeight: FontWeight.w400,
-                      ),
-                    )),
+                  controller.photoGroups
+                      .firstWhere((g) => g.title == title)
+                      .isSelected
+                      .value
+                      ? 'Deselect All'
+                      : 'Select All',
+                  style: TextStyle(
+                    color: Colors.white.withValues(alpha: 0.7),
+                    fontSize: 14.sp,
+                    fontWeight: FontWeight.w400,
+                  ),
+                )),
               ),
             ],
           ),
@@ -213,28 +225,28 @@ class PeoplePhotoPage extends BasePage<PeoplePhotoController> {
             height: imageCount <= 8 ? null : 148.w,
             child: imageCount <= 8
                 ? GridView.builder(
-                    shrinkWrap: true,
-                    physics: NeverScrollableScrollPhysics(),
-                    gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
-                      crossAxisCount: 4,
-                      mainAxisSpacing: 8.w,
-                      crossAxisSpacing: 8.h,
-                    ),
-                    itemCount: imageCount,
-                    itemBuilder: _buildPhotoItem(title),
-                  )
+              shrinkWrap: true,
+              physics: NeverScrollableScrollPhysics(),
+              gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
+                crossAxisCount: 4,
+                mainAxisSpacing: 8.w,
+                crossAxisSpacing: 8.h,
+              ),
+              itemCount: imageCount,
+              itemBuilder: _buildPhotoItem(title),
+            )
                 : GridView.builder(
-                    scrollDirection: Axis.horizontal,
-                    physics: BouncingScrollPhysics(),
-                    gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
-                      crossAxisCount: 2,
-                      mainAxisSpacing: 8.w,
-                      crossAxisSpacing: 8.h,
-                      childAspectRatio: 1,
-                    ),
-                    itemCount: imageCount,
-                    itemBuilder: _buildPhotoItem(title),
-                  ),
+              scrollDirection: Axis.horizontal,
+              physics: BouncingScrollPhysics(),
+              gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
+                crossAxisCount: 2,
+                mainAxisSpacing: 8.w,
+                crossAxisSpacing: 8.h,
+                childAspectRatio: 1,
+              ),
+              itemCount: imageCount,
+              itemBuilder: _buildPhotoItem(title),
+            ),
           ),
         ],
       ),
@@ -242,10 +254,10 @@ class PeoplePhotoPage extends BasePage<PeoplePhotoController> {
   }
 
   Widget Function(BuildContext, int) _buildPhotoItem(String title) =>
-      (context, index) {
+          (context, index) {
         final group =
-            controller.photoGroups.firstWhere((group) => group.title == title);
-        final imagePath = group.images[index];
+        controller.photoGroups.firstWhere((group) => group.title == title);
+        final assetEntity = group.images[index];
 
         return GestureDetector(
           onTap: () => controller.toggleImageSelection(title, index),
@@ -257,12 +269,12 @@ class PeoplePhotoPage extends BasePage<PeoplePhotoController> {
                   width: 70.w,
                   height: 70.w,
                   decoration: ShapeDecoration(
-                    color: Colors.white.withValues(alpha: 0.12),
+                    color: Colors.white.withOpacity(0.12),
                     shape: RoundedRectangleBorder(
                       borderRadius: BorderRadius.circular(9.27.sp),
                     ),
                     image: DecorationImage(
-                      image: FileImage(File(imagePath)),
+                      image: AssetEntityImageProvider(assetEntity),
                       fit: BoxFit.cover,
                     ),
                   ),
@@ -273,16 +285,16 @@ class PeoplePhotoPage extends BasePage<PeoplePhotoController> {
                   child: Container(
                     child: isSelected
                         ? Center(
-                            child: Assets.images.iconSelected.image(
-                              width: 20.w,
-                              height: 20.h,
-                            ),
-                          )
+                      child: Assets.images.iconSelected.image(
+                        width: 20.w,
+                        height: 20.h,
+                      ),
+                    )
                         : Center(
-                            child: Assets.images.iconUnselected.image(
-                            width: 20.w,
-                            height: 20.h,
-                          )),
+                        child: Assets.images.iconUnselected.image(
+                          width: 20.w,
+                          height: 20.h,
+                        )),
                   ),
                 ),
               ],

+ 10 - 2
lib/module/people_photo/photo_group.dart

@@ -1,11 +1,19 @@
 import 'package:get/get.dart';
+import 'package:wechat_assets_picker/wechat_assets_picker.dart';
+
 class PhotoGroup {
+
   final String title;
+  //照片组的总数。
   final int imageCount;
+  // 照片组是否被全选中
   final RxBool isSelected;
-  final List<String> images;
+  // 照片组的列表。
+  final List<AssetEntity> images;
+  //单个照片是否被选中
   final RxList<bool> selectedImages;
 
+  // 选中的照片数量
   int get selectedCount => selectedImages.where((selected) => selected).length;
 
   PhotoGroup({
@@ -20,4 +28,4 @@ class PhotoGroup {
     isSelected.value = value;
     selectedImages.assignAll(List.generate(images.length, (_) => value));
   }
-}
+}

+ 6 - 0
lib/module/screenshots_blurry/screenshots_controller.dart

@@ -0,0 +1,6 @@
+import 'package:get/get_state_manager/src/simple/get_controllers.dart';
+
+class ScreenShotsController extends GetxController {
+
+
+}

+ 29 - 0
lib/module/screenshots_blurry/screenshots_view.dart

@@ -0,0 +1,29 @@
+import 'package:clean/base/base_page.dart';
+import 'package:clean/module/screenshots_blurry/screenshots_controller.dart';
+import 'package:clean/router/app_pages.dart';
+import 'package:flutter/Material.dart';
+import 'package:get/get.dart';
+class ScreenshotsPage extends BasePage<ScreenShotsController> {
+
+
+  static start() {
+    Get.put((ScreenShotsController()));
+    Get.toNamed(RoutePath.screenshots, arguments: {});
+  }
+
+  @override
+  bool statusBarDarkFont() {
+    return false;
+  }
+
+  @override
+  bool immersive() {
+    return true;
+  }
+
+  @override
+  Widget buildBody(BuildContext context) {
+    return Container();
+  }
+
+}

+ 27 - 65
lib/module/similar_photo/similar_photo_controller.dart

@@ -1,33 +1,10 @@
 import 'dart:io';
 
 import 'package:clean/module/image_picker/image_picker_util.dart';
+import 'package:clean/module/people_photo/photo_group.dart';
 import 'package:get/get.dart';
-import 'package:path_provider/path_provider.dart';
-import 'package:path/path.dart' as p;
-import 'package:wechat_assets_picker/wechat_assets_picker.dart';
 
-class PhotoGroup {
-  final String title;
-  final int imageCount;
-  final RxBool isSelected;
-  final List<String> images;
-  final RxList<bool> selectedImages;
-
-  int get selectedCount => selectedImages.where((selected) => selected).length;
-
-  PhotoGroup({
-    required this.title,
-    required this.imageCount,
-    required bool isSelected,
-    required this.images,
-  })  : isSelected = isSelected.obs,
-        selectedImages = List.generate(imageCount, (_) => isSelected).obs;
-
-  void toggleSelectAll(bool value) {
-    isSelected.value = value;
-    selectedImages.assignAll(List.generate(images.length, (_) => value));
-  }
-}
+import 'package:wechat_assets_picker/wechat_assets_picker.dart';
 
 class SimilarPhotoController extends GetxController {
   final RxList<PhotoGroup> photoGroups = <PhotoGroup>[].obs;
@@ -38,18 +15,22 @@ class SimilarPhotoController extends GetxController {
   int get selectedFileCount =>
       photoGroups.fold(0, (sum, group) => sum + group.selectedCount);
 
-  double get selectedFilesSize {
+  Future<double> getSelectedFilesSize() async {
     double totalSize = 0;
     for (var group in photoGroups) {
       for (int i = 0; i < group.images.length; i++) {
         if (group.selectedImages[i]) {
-          totalSize += File(group.images[i]).lengthSync();
+          final file = await group.images[i].file;
+          if (file != null) {
+            totalSize += file.lengthSync();
+          }
         }
       }
     }
     return totalSize / 1024; // Convert to KB
   }
 
+
   void toggleImageSelection(String groupTitle, int imageIndex) {
     final group = photoGroups.firstWhere((g) => g.title == groupTitle);
     group.selectedImages[imageIndex] = !group.selectedImages[imageIndex];
@@ -82,46 +63,27 @@ class SimilarPhotoController extends GetxController {
   @override
   void onInit() {
     super.onInit();
-    loadPhotosFromDirectory().then((_) {
-      if (_hasInitializedSelections) {
-        _restoreSelections();
-      }
-    });
+    loadSimilarPhotos();
+    if (_hasInitializedSelections) {
+          _restoreSelections();
+        }
+    // loadPhotosFromDirectory().then((_) {
+    //
+    // });
   }
 
   Future<void> loadPhotosFromDirectory() async {
     try {
-      final Directory appDir = await getApplicationDocumentsDirectory();
-      final String photosPath = '${appDir.path}/photos';
-
-      final Directory photosDir = Directory(photosPath);
-      if (!await photosDir.exists()) {
-        return;
-      }
-
-      final List<Directory> subDirs = await photosDir
-          .list()
-          .where((entity) => entity is Directory)
-          .map((e) => e as Directory)
-          .toList();
-
-      for (final dir in subDirs) {
-        final List<FileSystemEntity> files = await dir
-            .list()
-            .where((entity) =>
-                entity is File &&
-                ['.jpg', '.jpeg', '.png']
-                    .contains(p.extension(entity.path).toLowerCase()))
-            .toList();
-
-        if (files.isNotEmpty) {
-          photoGroups.add(PhotoGroup(
-            title: 'photo: ${files.length}',
-            imageCount: files.length,
-            isSelected: false,
-            images: files.map((file) => file.path).toList(),
-          ));
-        }
+      final List<AssetEntity>? result = await AssetPicker.pickAssets(
+        Get.context!,
+      );
+      if (result != null && result.isNotEmpty) {
+        photoGroups.add(PhotoGroup(
+          title: 'photo: ${result.length}',
+          imageCount: result.length,
+          isSelected: false,
+          images: result,
+        ));
       }
     } catch (e) {
       print('Error loading photos: $e');
@@ -137,10 +99,10 @@ class SimilarPhotoController extends GetxController {
       final photoGroup = ImagePickerUtil.similarPhotos[i];
       if (photoGroup.isNotEmpty) {
         photoGroups.add(PhotoGroup(
-          title: '相似照片组 ${i + 1}: ${photoGroup.length}张',
+          title: 'photo : ${photoGroup.length}',
           imageCount: photoGroup.length,
           isSelected: false,
-          images: photoGroup.map((asset) => asset.id).toList(),
+          images: photoGroup,
         ));
       }
     }

+ 84 - 76
lib/module/similar_photo/similar_photo_view.dart

@@ -7,6 +7,7 @@ import 'package:clean/router/app_pages.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter_screenutil/flutter_screenutil.dart';
 import 'package:get/get.dart';
+import 'package:wechat_assets_picker/wechat_assets_picker.dart';
 
 class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
   const SimilarPhotoPage({super.key});
@@ -36,15 +37,14 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
                     padding: EdgeInsets.symmetric(horizontal: 16.w),
                     children: [
                       ...controller.photoGroups.map((group) => Column(
-                            children: [
-                              _buildPhotoGroup(
-                                title: group.title,
-                                imageCount: group.imageCount,
-
-                              ),
-                              SizedBox(height: 15.h),
-                            ],
-                          ))
+                        children: [
+                          _buildPhotoGroup(
+                            title: group.title,
+                            imageCount: group.imageCount,
+                          ),
+                          SizedBox(height: 15.h),
+                        ],
+                      ))
                     ],
                   );
                 }),
@@ -110,15 +110,28 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
       child: Row(
         mainAxisAlignment: MainAxisAlignment.spaceBetween,
         children: [
-          Obx(() => Text(
-                '${controller.selectedFileCount} files selected (${controller.selectedFilesSize.toStringAsFixed(1)} KB)',
-                textAlign: TextAlign.center,
-                style: TextStyle(
-                  color: Colors.white.withValues(alpha: 0.9),
-                  fontSize: 13.sp,
-                  fontWeight: FontWeight.w500,
-                ),
-              )),
+          Obx(() {
+            return FutureBuilder<double>(
+              future: controller.getSelectedFilesSize(),
+              builder: (context, snapshot) {
+                if (snapshot.connectionState == ConnectionState.waiting) {
+                  return CircularProgressIndicator();
+                } else if (snapshot.hasError) {
+                  return Text('Error: ${snapshot.error}');
+                } else {
+                  return Text(
+                    '${controller.selectedFileCount} files selected (${snapshot.data?.toStringAsFixed(1)} KB)',
+                    textAlign: TextAlign.center,
+                    style: TextStyle(
+                      color: Colors.white.withValues(alpha: 0.9),
+                      fontSize: 13.sp,
+                      fontWeight: FontWeight.w500,
+                    ),
+                  );
+                }
+              },
+            );
+          }),
           Container(
             width: 108.w,
             height: 38.h,
@@ -155,7 +168,6 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
   Widget _buildPhotoGroup({
     required String title,
     required int imageCount,
-
   }) {
     return Container(
       padding: EdgeInsets.symmetric(horizontal: 12.w),
@@ -185,24 +197,23 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
                       fontWeight: FontWeight.w500,
                     ),
                   ),
-
                 ],
               ),
               GestureDetector(
                 onTap: () => controller.toggleGroupSelection(title),
                 child: Obx(() => Text(
-                      controller.photoGroups
-                              .firstWhere((g) => g.title == title)
-                              .isSelected
-                              .value
-                          ? 'Deselect All'
-                          : 'Select All',
-                      style: TextStyle(
-                        color: Colors.white.withValues(alpha: 0.7),
-                        fontSize: 14.sp,
-                        fontWeight: FontWeight.w400,
-                      ),
-                    )),
+                  controller.photoGroups
+                      .firstWhere((g) => g.title == title)
+                      .isSelected
+                      .value
+                      ? 'Deselect All'
+                      : 'Select All',
+                  style: TextStyle(
+                    color: Colors.white.withValues(alpha: 0.7),
+                    fontSize: 14.sp,
+                    fontWeight: FontWeight.w400,
+                  ),
+                )),
               ),
             ],
           ),
@@ -226,12 +237,13 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
                           children: [
                             Container(
                               decoration: ShapeDecoration(
-                                color: Colors.white.withValues(alpha: 0.12),
+                                color: Colors.white.withOpacity(0.12),
                                 shape: RoundedRectangleBorder(
                                   borderRadius: BorderRadius.circular(8.r),
                                 ),
                                 image: DecorationImage(
-                                  image: FileImage(File(group.images[0])),
+                                  image:
+                                  AssetEntityImageProvider(group.images[0]),
                                   fit: BoxFit.cover,
                                 ),
                               ),
@@ -240,7 +252,6 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
                               left: 8.w,
                               top: 8.h,
                               child: Container(
-
                                 width: 108.w,
                                 height: 26.h,
                                 padding: EdgeInsets.symmetric(
@@ -251,12 +262,12 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
                                   color: Colors.black.withValues(alpha: 0.74),
                                   shape: RoundedRectangleBorder(
                                     borderRadius:
-                                        BorderRadius.circular(14.21.r),
+                                    BorderRadius.circular(14.21.r),
                                   ),
                                 ),
                                 child: Row(
                                   mainAxisAlignment:
-                                      MainAxisAlignment.spaceAround,
+                                  MainAxisAlignment.spaceAround,
                                   children: [
                                     Assets.images.iconSimilarBest.image(
                                       width: 11.37.w,
@@ -281,18 +292,18 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
                               child: Container(
                                 child: group.selectedImages[0]
                                     ? Center(
-                                        child: Assets.images.iconSelected.image(
-                                          width: 16.w,
-                                          height: 16.h,
-                                        ),
-                                      )
+                                  child: Assets.images.iconSelected.image(
+                                    width: 16.w,
+                                    height: 16.h,
+                                  ),
+                                )
                                     : Center(
-                                        child:
-                                            Assets.images.iconUnselected.image(
-                                          width: 16.w,
-                                          height: 16.h,
-                                        ),
-                                      ),
+                                  child:
+                                  Assets.images.iconUnselected.image(
+                                    width: 16.w,
+                                    height: 16.h,
+                                  ),
+                                ),
                               ),
                             ),
                           ],
@@ -313,7 +324,7 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
                         crossAxisSpacing: 8.w,
                         children: List.generate(
                           min(4, imageCount - 1 - gridIndex * 4),
-                          (index) {
+                              (index) {
                             final realIndex = gridIndex * 4 + index + 1;
                             return GestureDetector(
                               onTap: () => controller.toggleImageSelection(
@@ -328,8 +339,8 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
                                       borderRadius: BorderRadius.circular(8.r),
                                     ),
                                     image: DecorationImage(
-                                      image: FileImage(
-                                          File(group.images[realIndex])),
+                                      image: AssetEntityImageProvider(
+                                          group.images[realIndex]),
                                       fit: BoxFit.cover,
                                     ),
                                   ),
@@ -340,25 +351,25 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
                                         bottom: 4.h,
                                         child: Obx(() {
                                           final isSelected =
-                                              group.selectedImages[realIndex];
+                                          group.selectedImages[realIndex];
                                           return Container(
                                             child: isSelected
                                                 ? Center(
-                                                    child: Assets
-                                                        .images.iconSelected
-                                                        .image(
-                                                      width: 16.w,
-                                                      height: 16.h,
-                                                    ),
-                                                  )
+                                              child: Assets
+                                                  .images.iconSelected
+                                                  .image(
+                                                width: 16.w,
+                                                height: 16.h,
+                                              ),
+                                            )
                                                 : Center(
-                                                    child: Assets
-                                                        .images.iconUnselected
-                                                        .image(
-                                                      width: 16.w,
-                                                      height: 16.h,
-                                                    ),
-                                                  ),
+                                              child: Assets
+                                                  .images.iconUnselected
+                                                  .image(
+                                                width: 16.w,
+                                                height: 16.h,
+                                              ),
+                                            ),
                                           );
                                         }),
                                       ),
@@ -376,7 +387,6 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
             ),
           ),
           Container(
-
             width: 162.w,
             height: 38.h,
             decoration: ShapeDecoration(
@@ -385,17 +395,15 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
                 borderRadius: BorderRadius.circular(10.r),
               ),
             ),
-
-
             child: Center(
               child: Obx(() => Text(
-                    'Move ${controller.photoGroups.firstWhere((g) => g.title == title).selectedCount} to trash',
-                    style: TextStyle(
-                      color: Colors.white,
-                      fontSize: 16.sp,
-                      fontWeight: FontWeight.w500,
-                    ),
-                  )),
+                'Move ${controller.photoGroups.firstWhere((g) => g.title == title).selectedCount} to trash',
+                style: TextStyle(
+                  color: Colors.white,
+                  fontSize: 16.sp,
+                  fontWeight: FontWeight.w500,
+                ),
+              )),
             ),
           ),
         ],

+ 3 - 0
lib/router/app_pages.dart

@@ -26,6 +26,7 @@ abstract class RoutePath {
   static const peoplePhoto = '/peoplePhoto';
   static const similarPhoto = '/similarPhoto';
   static const locationsPhoto = '/locationsPhoto';
+  static const screenshots = '/screenshots';
 }
 
 class AppBinding extends Bindings {
@@ -37,6 +38,8 @@ class AppBinding extends Bindings {
     lazyPut(() => PeoplePhotoController());
     lazyPut(() => SimilarPhotoController());
     lazyPut(() => LocationsPhotoController());
+    lazyPut(() => LocationsPhotoPage());
+
   }
 
   void lazyPut<S>(InstanceBuilderCallback<S> builder) {