Move hide option in overflow

This commit is contained in:
Neeraj Gupta 2022-10-31 14:11:56 +05:30
parent 9d9c19ab8b
commit 59f956f308
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1

View file

@ -393,47 +393,77 @@ class _OverlayWidgetState extends State<OverlayWidget> {
} }
} }
final List<PopupMenuItem<String>> items = [];
if (widget.type == GalleryType.homepage || if (widget.type == GalleryType.homepage ||
widget.type == GalleryType.archive) { widget.type == GalleryType.archive) {
final bool showArchive = widget.type == GalleryType.homepage; final bool showArchive = widget.type == GalleryType.homepage;
actions.add( items.add(
Tooltip( PopupMenuItem(
message: showArchive ? "Hide" : "Unhide", value: showArchive ? "archive" : 'unarchive',
child: IconButton( child: Row(
color: Theme.of(context).colorScheme.iconColor, children: [
icon: Icon( Icon(
showArchive ? Icons.visibility_off : Icons.visibility, showArchive ? Icons.archive_outlined : Icons.unarchive_outlined,
), ),
onPressed: () { const Padding(
_handleVisibilityChangeRequest( padding: EdgeInsets.all(8),
context, ),
showArchive ? visibilityArchive : visibilityVisible, Text(
); showArchive ? "Archive" : "UnArchive",
}, ),
],
), ),
), ),
); );
} }
if (widget.type == GalleryType.homepage && enableBeta) { if (widget.type == GalleryType.homepage && enableBeta) {
actions.add( items.add(
Tooltip( PopupMenuItem(
message: "HiddenStuff", value: "hide",
child: IconButton( child: Row(
color: Theme.of(context).colorScheme.iconColor, children: const [
icon: const Icon( Icon(Icons.visibility_off),
Icons.hide_image, Padding(
), padding: EdgeInsets.all(8),
onPressed: () async { ),
await _handleHideRequest(context); Text("Hide"),
}, ],
), ),
), ),
); );
} }
if (items.isNotEmpty) {
actions.add(
PopupMenuButton<String>(
// color: Theme.of(context).colorScheme.frostyBlurBackdropFilterColor,
onSelected: onActionSelected,
itemBuilder: (context) {
return items;
},
),
);
}
return actions; return actions;
} }
Future<void> onActionSelected(String value) async {
debugPrint("Action Selected $value");
switch (value) {
case 'hide':
await _handleHideRequest(context);
break;
case 'archive':
await _handleVisibilityChangeRequest(context, visibilityArchive);
break;
case 'unarchive':
await _handleVisibilityChangeRequest(context, visibilityVisible);
break;
default:
break;
}
}
void _addTrashAction(List<Widget> actions) { void _addTrashAction(List<Widget> actions) {
actions.add( actions.add(
Tooltip( Tooltip(