Explorar el Código

Use new bottom bar for gallery folder page

Neeraj Gupta hace 2 años
padre
commit
66c5e0f24f

+ 19 - 1
lib/models/gallery_type.dart

@@ -46,6 +46,24 @@ extension GalleyTypeExtension on GalleryType {
     }
   }
 
+  // showDeleteTopOption indicates whether we should show
+  // delete icon as iconButton
+  bool showDeleteIconOption() {
+    switch (this) {
+      case GalleryType.ownedCollection:
+      case GalleryType.searchResults:
+      case GalleryType.homepage:
+      case GalleryType.favorite:
+      case GalleryType.localFolder:
+        return true;
+      case GalleryType.trash:
+      case GalleryType.archive:
+      case GalleryType.hidden:
+      case GalleryType.sharedCollection:
+        return false;
+    }
+  }
+
   bool showDeleteOption() {
     switch (this) {
       case GalleryType.ownedCollection:
@@ -54,8 +72,8 @@ extension GalleyTypeExtension on GalleryType {
       case GalleryType.favorite:
       case GalleryType.archive:
       case GalleryType.hidden:
-        return true;
       case GalleryType.localFolder:
+        return true;
       case GalleryType.trash:
       case GalleryType.sharedCollection:
         return false;

+ 1 - 3
lib/ui/viewer/actions/file_selection_overlay_bar.dart

@@ -40,9 +40,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
 
   @override
   void initState() {
-    showDeleteOption = (widget.galleryType == GalleryType.homepage ||
-        widget.galleryType == GalleryType.ownedCollection ||
-        widget.galleryType == GalleryType.favorite);
+    showDeleteOption = widget.galleryType.showDeleteIconOption();
     widget.selectedFiles.addListener(_selectedFilesListener);
     super.initState();
   }

+ 2 - 2
lib/ui/viewer/gallery/device_folder_page.dart

@@ -12,9 +12,9 @@ import 'package:photos/models/device_collection.dart';
 import 'package:photos/models/gallery_type.dart';
 import 'package:photos/models/selected_files.dart';
 import 'package:photos/services/remote_sync_service.dart';
+import 'package:photos/ui/viewer/actions/file_selection_overlay_bar.dart';
 import 'package:photos/ui/viewer/gallery/gallery.dart';
 import 'package:photos/ui/viewer/gallery/gallery_app_bar_widget.dart';
-import 'package:photos/ui/viewer/gallery/gallery_overlay_widget.dart';
 
 class DeviceFolderPage extends StatelessWidget {
   final DeviceCollection deviceCollection;
@@ -61,7 +61,7 @@ class DeviceFolderPage extends StatelessWidget {
         alignment: Alignment.bottomCenter,
         children: [
           gallery,
-          GalleryOverlayWidget(
+          FileSelectionOverlayBar(
             GalleryType.localFolder,
             _selectedFiles,
           )