Use new bottom bar for gallery folder page

This commit is contained in:
Neeraj Gupta 2022-12-16 15:29:48 +05:30
parent b06fc72614
commit 66c5e0f24f
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1
3 changed files with 22 additions and 6 deletions

View file

@ -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() { bool showDeleteOption() {
switch (this) { switch (this) {
case GalleryType.ownedCollection: case GalleryType.ownedCollection:
@ -54,8 +72,8 @@ extension GalleyTypeExtension on GalleryType {
case GalleryType.favorite: case GalleryType.favorite:
case GalleryType.archive: case GalleryType.archive:
case GalleryType.hidden: case GalleryType.hidden:
return true;
case GalleryType.localFolder: case GalleryType.localFolder:
return true;
case GalleryType.trash: case GalleryType.trash:
case GalleryType.sharedCollection: case GalleryType.sharedCollection:
return false; return false;

View file

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

View file

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