|
|
@@ -2,6 +2,10 @@ import 'dart:async';
|
|
|
|
|
|
import 'package:clean/base/base_controller.dart';
|
|
|
import 'package:clean/data/bean/photos_type.dart';
|
|
|
+import 'package:clean/data/consts/constants.dart';
|
|
|
+import 'package:clean/dialog/photo_delete_finish_dialog.dart';
|
|
|
+import 'package:clean/dialog/photo_deleting_dialog.dart';
|
|
|
+import 'package:clean/dialog/photo_preview_tip_dialog.dart';
|
|
|
import 'package:clean/module/image_picker/image_picker_util.dart';
|
|
|
import 'package:clean/module/locations_photo/locations_single_photo_controller.dart';
|
|
|
import 'package:clean/module/people_photo/people_photo_controller.dart';
|
|
|
@@ -50,6 +54,18 @@ class PhotoPreviewController extends BaseController {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ @override
|
|
|
+ void onReady() {
|
|
|
+ // TODO: implement onReady
|
|
|
+ super.onReady();
|
|
|
+
|
|
|
+ if (isFirstOpenPhotoPreview()) {
|
|
|
+ photoPreviewTipDialog(clickCallback: () {
|
|
|
+ setFirstOpenPhotoPreview(false);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 获取参数
|
|
|
void _getArgs() {
|
|
|
photosType = parameters?['photosType'];
|
|
|
@@ -101,15 +117,14 @@ class PhotoPreviewController extends BaseController {
|
|
|
}
|
|
|
|
|
|
void restoreSelections() async {
|
|
|
-
|
|
|
- photoGroups.removeWhere((element) => selectedPhotosIds.contains(element.id));
|
|
|
+ photoGroups
|
|
|
+ .removeWhere((element) => selectedPhotosIds.contains(element.id));
|
|
|
selectedPhotosIds.clear();
|
|
|
if (photoGroups.isNotEmpty) {
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
groupIndex.value = 0;
|
|
|
cardSwiperController.value.moveTo(0);
|
|
|
});
|
|
|
-
|
|
|
}
|
|
|
updateSelectedFilesSize();
|
|
|
selectedFileCount.value = selectedPhotosIds.length;
|
|
|
@@ -256,6 +271,7 @@ class PhotoPreviewController extends BaseController {
|
|
|
|
|
|
clickDelete() async {
|
|
|
print('clickDelete');
|
|
|
+
|
|
|
switch (photosType) {
|
|
|
case PhotosType.peoplePhotos:
|
|
|
ImagePickerUtil.selectedPeoplePhotosIds.assignAll(selectedPhotosIds);
|
|
|
@@ -293,34 +309,38 @@ class PhotoPreviewController extends BaseController {
|
|
|
if (result.length == selectedPhotosIds.length) {
|
|
|
switch (photosType) {
|
|
|
case PhotosType.peoplePhotos:
|
|
|
- ImagePickerUtil.updatePhotoGroupDate(photosType,ImagePickerUtil.selectedPeoplePhotosIds);
|
|
|
+ ImagePickerUtil.updatePhotoGroupDate(
|
|
|
+ photosType, ImagePickerUtil.selectedPeoplePhotosIds);
|
|
|
|
|
|
break;
|
|
|
case PhotosType.screenshots:
|
|
|
- ImagePickerUtil.updatePhotoGroupDate(photosType,ImagePickerUtil.selectedScreenshotPhotosIds);
|
|
|
+ ImagePickerUtil.updatePhotoGroupDate(
|
|
|
+ photosType, ImagePickerUtil.selectedScreenshotPhotosIds);
|
|
|
|
|
|
break;
|
|
|
case PhotosType.similarPhotos:
|
|
|
- ImagePickerUtil.updatePhotoGroupDate(photosType,ImagePickerUtil.selectedSimilarPhotosIds);
|
|
|
+ ImagePickerUtil.updatePhotoGroupDate(
|
|
|
+ photosType, ImagePickerUtil.selectedSimilarPhotosIds);
|
|
|
|
|
|
break;
|
|
|
case PhotosType.locationPhotos:
|
|
|
- ImagePickerUtil.updatePhotoGroupDate(photosType,ImagePickerUtil.selectedLocationPhotosIds);
|
|
|
+ ImagePickerUtil.updatePhotoGroupDate(
|
|
|
+ photosType, ImagePickerUtil.selectedLocationPhotosIds);
|
|
|
|
|
|
break;
|
|
|
case PhotosType.blurryPhotos:
|
|
|
- ImagePickerUtil.updatePhotoGroupDate(photosType,ImagePickerUtil.selectedBlurryPhotosIds);
|
|
|
+ ImagePickerUtil.updatePhotoGroupDate(
|
|
|
+ photosType, ImagePickerUtil.selectedBlurryPhotosIds);
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
restoreSelections();
|
|
|
+
|
|
|
} else {
|
|
|
// 删除失败
|
|
|
ToastUtil.show("Delete failed");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|