Trash: hide app bar actions & placeholder for trash actions
This commit is contained in:
parent
ceaed8def3
commit
676a193d4f
|
@ -11,6 +11,7 @@ import 'package:photos/db/files_db.dart';
|
||||||
import 'package:photos/events/local_photos_updated_event.dart';
|
import 'package:photos/events/local_photos_updated_event.dart';
|
||||||
import 'package:photos/models/file.dart';
|
import 'package:photos/models/file.dart';
|
||||||
import 'package:photos/models/file_type.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/favorites_service.dart';
|
||||||
import 'package:photos/services/local_sync_service.dart';
|
import 'package:photos/services/local_sync_service.dart';
|
||||||
import 'package:photos/ui/custom_app_bar.dart';
|
import 'package:photos/ui/custom_app_bar.dart';
|
||||||
|
@ -90,6 +91,8 @@ class FadingAppBarState extends State<FadingAppBar> {
|
||||||
|
|
||||||
AppBar _buildAppBar() {
|
AppBar _buildAppBar() {
|
||||||
final List<Widget> actions = [];
|
final List<Widget> actions = [];
|
||||||
|
final shouldShowActions =
|
||||||
|
widget.shouldShowActions && widget.file is! TrashFile;
|
||||||
// only show fav option for files owned by the user
|
// only show fav option for files owned by the user
|
||||||
if (widget.file.ownerID == null || widget.file.ownerID == widget.userID) {
|
if (widget.file.ownerID == null || widget.file.ownerID == widget.userID) {
|
||||||
actions.add(_getFavoriteButton());
|
actions.add(_getFavoriteButton());
|
||||||
|
@ -152,7 +155,7 @@ class FadingAppBarState extends State<FadingAppBar> {
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: widget.shouldShowActions ? actions : [],
|
actions: shouldShowActions ? actions : [],
|
||||||
backgroundColor: Color(0x00000000),
|
backgroundColor: Color(0x00000000),
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
);
|
);
|
||||||
|
|
|
@ -6,9 +6,11 @@ import 'package:photos/core/configuration.dart';
|
||||||
import 'package:photos/models/file.dart';
|
import 'package:photos/models/file.dart';
|
||||||
import 'package:photos/models/file_type.dart';
|
import 'package:photos/models/file_type.dart';
|
||||||
import 'package:photos/models/magic_metadata.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/ui/file_info_dialog.dart';
|
||||||
import 'package:photos/utils/archive_util.dart';
|
import 'package:photos/utils/archive_util.dart';
|
||||||
import 'package:photos/utils/share_util.dart';
|
import 'package:photos/utils/share_util.dart';
|
||||||
|
import 'package:photos/utils/toast_util.dart';
|
||||||
|
|
||||||
class FadingBottomBar extends StatefulWidget {
|
class FadingBottomBar extends StatefulWidget {
|
||||||
final File file;
|
final File file;
|
||||||
|
@ -69,7 +71,10 @@ class FadingBottomBarState extends State<FadingBottomBar> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (!widget.showOnlyInfoButton) {
|
if (widget.file is TrashFile) {
|
||||||
|
_addTrashOptions(children);
|
||||||
|
}
|
||||||
|
if (!widget.showOnlyInfoButton && widget.file is! TrashFile) {
|
||||||
if (widget.file.fileType == FileType.image ||
|
if (widget.file.fileType == FileType.image ||
|
||||||
widget.file.fileType == FileType.livePhoto) {
|
widget.file.fileType == FileType.livePhoto) {
|
||||||
children.add(
|
children.add(
|
||||||
|
@ -162,6 +167,38 @@ class FadingBottomBarState extends State<FadingBottomBar> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _addTrashOptions(List<Widget> 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<void> _displayInfo(File file) async {
|
Future<void> _displayInfo(File file) async {
|
||||||
return showDialog<void>(
|
return showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
Loading…
Reference in a new issue