|
|
@@ -13,7 +13,6 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
|
|
|
const SimilarPhotoPage({super.key});
|
|
|
|
|
|
static void start() {
|
|
|
- Get.put((SimilarPhotoController()));
|
|
|
Get.toNamed(RoutePath.similarPhoto);
|
|
|
}
|
|
|
|
|
|
@@ -37,14 +36,15 @@ 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(
|
|
|
+ imagesList: group.images,
|
|
|
+ title: group.title,
|
|
|
+ imageCount: group.imageCount,
|
|
|
+ ),
|
|
|
+ SizedBox(height: 15.h),
|
|
|
+ ],
|
|
|
+ ))
|
|
|
],
|
|
|
);
|
|
|
}),
|
|
|
@@ -111,25 +111,14 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
children: [
|
|
|
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,
|
|
|
- ),
|
|
|
- );
|
|
|
- }
|
|
|
- },
|
|
|
+ return Text(
|
|
|
+ '${controller.selectedFileCount.value} files selected (${controller.selectedFilesSize.value.toStringAsFixed(1)} KB)',
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.white.withValues(alpha: 0.9),
|
|
|
+ fontSize: 13.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
);
|
|
|
}),
|
|
|
Container(
|
|
|
@@ -166,6 +155,7 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
|
|
|
}
|
|
|
|
|
|
Widget _buildPhotoGroup({
|
|
|
+ required List<AssetEntity> imagesList,
|
|
|
required String title,
|
|
|
required int imageCount,
|
|
|
}) {
|
|
|
@@ -200,20 +190,20 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
|
|
|
],
|
|
|
),
|
|
|
GestureDetector(
|
|
|
- onTap: () => controller.toggleGroupSelection(title),
|
|
|
+ onTap: () => controller.toggleGroupSelection(imagesList),
|
|
|
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.images == imagesList)
|
|
|
+ .isSelected
|
|
|
+ .value
|
|
|
+ ? 'Deselect All'
|
|
|
+ : 'Select All',
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.white.withValues(alpha: 0.7),
|
|
|
+ fontSize: 14.sp,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
+ ),
|
|
|
+ )),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
@@ -226,13 +216,13 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
|
|
|
// 第一张大图
|
|
|
if (imageCount > 0)
|
|
|
GestureDetector(
|
|
|
- onTap: () => controller.toggleImageSelection(title, 0),
|
|
|
+ onTap: () => controller.clickImage(imagesList, 0),
|
|
|
child: SizedBox(
|
|
|
width: 148.w,
|
|
|
height: 148.h,
|
|
|
child: Obx(() {
|
|
|
final group = controller.photoGroups
|
|
|
- .firstWhere((g) => g.title == title);
|
|
|
+ .firstWhere((g) => g.images == imagesList);
|
|
|
return Stack(
|
|
|
children: [
|
|
|
Container(
|
|
|
@@ -243,7 +233,7 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
|
|
|
),
|
|
|
image: DecorationImage(
|
|
|
image:
|
|
|
- AssetEntityImageProvider(group.images[0]),
|
|
|
+ AssetEntityImageProvider(group.images[0]),
|
|
|
fit: BoxFit.cover,
|
|
|
),
|
|
|
),
|
|
|
@@ -262,12 +252,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,
|
|
|
@@ -289,20 +279,25 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
|
|
|
Positioned(
|
|
|
right: 4.w,
|
|
|
bottom: 4.h,
|
|
|
- child: Container(
|
|
|
- child: group.selectedImages[0]
|
|
|
- ? Center(
|
|
|
- child: Assets.images.iconSelected.image(
|
|
|
- width: 16.w,
|
|
|
- height: 16.h,
|
|
|
- ),
|
|
|
- )
|
|
|
- : Center(
|
|
|
- child:
|
|
|
- Assets.images.iconUnselected.image(
|
|
|
- width: 16.w,
|
|
|
- height: 16.h,
|
|
|
- ),
|
|
|
+ child: GestureDetector(
|
|
|
+ onTap: () =>
|
|
|
+ controller.toggleImageSelection(imagesList, 0),
|
|
|
+ child: Container(
|
|
|
+ child: group.selectedImages[0]
|
|
|
+ ? Center(
|
|
|
+ child:
|
|
|
+ Assets.images.iconSelected.image(
|
|
|
+ width: 16.w,
|
|
|
+ height: 16.h,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ : Center(
|
|
|
+ child: Assets.images.iconUnselected
|
|
|
+ .image(
|
|
|
+ width: 16.w,
|
|
|
+ height: 16.h,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
@@ -324,14 +319,14 @@ 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(
|
|
|
- title, realIndex),
|
|
|
+ onTap: () => controller.clickImage(
|
|
|
+ imagesList, realIndex),
|
|
|
child: Obx(() {
|
|
|
final group = controller.photoGroups
|
|
|
- .firstWhere((g) => g.title == title);
|
|
|
+ .firstWhere((g) => g.images == imagesList);
|
|
|
return Container(
|
|
|
decoration: ShapeDecoration(
|
|
|
color: Colors.white.withOpacity(0.12),
|
|
|
@@ -351,24 +346,28 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
|
|
|
bottom: 4.h,
|
|
|
child: Obx(() {
|
|
|
final isSelected =
|
|
|
- group.selectedImages[realIndex];
|
|
|
- return Container(
|
|
|
- child: isSelected
|
|
|
- ? Center(
|
|
|
- child: Assets
|
|
|
- .images.iconSelected
|
|
|
- .image(
|
|
|
- width: 16.w,
|
|
|
- height: 16.h,
|
|
|
- ),
|
|
|
- )
|
|
|
- : Center(
|
|
|
- child: Assets
|
|
|
- .images.iconUnselected
|
|
|
- .image(
|
|
|
- width: 16.w,
|
|
|
- height: 16.h,
|
|
|
- ),
|
|
|
+ group.selectedImages[realIndex];
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: () => controller.toggleImageSelection(
|
|
|
+ imagesList, realIndex),
|
|
|
+ child: Container(
|
|
|
+ child: isSelected
|
|
|
+ ? Center(
|
|
|
+ child: Assets
|
|
|
+ .images.iconSelected
|
|
|
+ .image(
|
|
|
+ width: 16.w,
|
|
|
+ height: 16.h,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ : Center(
|
|
|
+ child: Assets
|
|
|
+ .images.iconUnselected
|
|
|
+ .image(
|
|
|
+ width: 16.w,
|
|
|
+ height: 16.h,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
);
|
|
|
}),
|
|
|
@@ -397,13 +396,13 @@ class SimilarPhotoPage extends BasePage<SimilarPhotoController> {
|
|
|
),
|
|
|
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.images == imagesList).selectedCount} to trash',
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.white,
|
|
|
+ fontSize: 16.sp,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ),
|
|
|
+ )),
|
|
|
),
|
|
|
),
|
|
|
],
|