diff --git a/lib/ui/fading_app_bar.dart b/lib/ui/fading_app_bar.dart index c3d12a4d8..90eba4f30 100644 --- a/lib/ui/fading_app_bar.dart +++ b/lib/ui/fading_app_bar.dart @@ -11,6 +11,7 @@ import 'package:photos/db/files_db.dart'; import 'package:photos/events/local_photos_updated_event.dart'; import 'package:photos/models/file.dart'; import 'package:photos/models/file_type.dart'; +import 'package:photos/models/trash_file.dart'; import 'package:photos/services/favorites_service.dart'; import 'package:photos/services/local_sync_service.dart'; import 'package:photos/ui/custom_app_bar.dart'; @@ -90,6 +91,8 @@ class FadingAppBarState extends State { AppBar _buildAppBar() { final List actions = []; + final shouldShowActions = + widget.shouldShowActions && widget.file is! TrashFile; // only show fav option for files owned by the user if (widget.file.ownerID == null || widget.file.ownerID == widget.userID) { actions.add(_getFavoriteButton()); @@ -152,7 +155,7 @@ class FadingAppBarState extends State { fontSize: 14, ), ), - actions: widget.shouldShowActions ? actions : [], + actions: shouldShowActions ? actions : [], backgroundColor: Color(0x00000000), elevation: 0, ); diff --git a/lib/ui/fading_bottom_bar.dart b/lib/ui/fading_bottom_bar.dart index 9239f4d35..134171fdf 100644 --- a/lib/ui/fading_bottom_bar.dart +++ b/lib/ui/fading_bottom_bar.dart @@ -6,9 +6,11 @@ import 'package:photos/core/configuration.dart'; import 'package:photos/models/file.dart'; import 'package:photos/models/file_type.dart'; import 'package:photos/models/magic_metadata.dart'; +import 'package:photos/models/trash_file.dart'; import 'package:photos/ui/file_info_dialog.dart'; import 'package:photos/utils/archive_util.dart'; import 'package:photos/utils/share_util.dart'; +import 'package:photos/utils/toast_util.dart'; class FadingBottomBar extends StatefulWidget { final File file; @@ -69,7 +71,10 @@ class FadingBottomBarState extends State { ), ), ); - if (!widget.showOnlyInfoButton) { + if (widget.file is TrashFile) { + _addTrashOptions(children); + } + if (!widget.showOnlyInfoButton && widget.file is! TrashFile) { if (widget.file.fileType == FileType.image || widget.file.fileType == FileType.livePhoto) { children.add( @@ -162,6 +167,38 @@ class FadingBottomBarState extends State { ); } + void _addTrashOptions(List children) { + children.add( + Tooltip( + message: "restore", + child: Padding( + padding: const EdgeInsets.only(top: 12, bottom: 12), + child: IconButton( + icon: Icon(Icons.restore_outlined), + onPressed: () { + showToast("coming soon"); + }, + ), + ), + ), + ); + + children.add( + Tooltip( + message: "delete", + child: Padding( + padding: const EdgeInsets.only(top: 12, bottom: 12), + child: IconButton( + icon: Icon(Icons.delete_forever_outlined), + onPressed: () { + showToast("coming soon"); + }, + ), + ), + ), + ); + } + Future _displayInfo(File file) async { return showDialog( context: context,