From 66c5e0f24f5bd24bb04f3cce24e371c6e6d00af0 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Fri, 16 Dec 2022 15:29:48 +0530 Subject: [PATCH] Use new bottom bar for gallery folder page --- lib/models/gallery_type.dart | 20 ++++++++++++++++++- .../actions/file_selection_overlay_bar.dart | 4 +--- lib/ui/viewer/gallery/device_folder_page.dart | 4 ++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lib/models/gallery_type.dart b/lib/models/gallery_type.dart index f407fbc37..df365c517 100644 --- a/lib/models/gallery_type.dart +++ b/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; diff --git a/lib/ui/viewer/actions/file_selection_overlay_bar.dart b/lib/ui/viewer/actions/file_selection_overlay_bar.dart index c5cf0c5b3..db2471cf7 100644 --- a/lib/ui/viewer/actions/file_selection_overlay_bar.dart +++ b/lib/ui/viewer/actions/file_selection_overlay_bar.dart @@ -40,9 +40,7 @@ class _FileSelectionOverlayBarState extends State { @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(); } diff --git a/lib/ui/viewer/gallery/device_folder_page.dart b/lib/ui/viewer/gallery/device_folder_page.dart index b2116affc..64ff7be1a 100644 --- a/lib/ui/viewer/gallery/device_folder_page.dart +++ b/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, )