From f422f848f40d3852b2fa41a0945ba91f89cb612b Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Tue, 14 Sep 2021 10:23:24 +0900 Subject: [PATCH] info: hide metadata edit actions when path is unknown --- lib/widgets/viewer/info/info_app_bar.dart | 43 ++++++++++++----------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/lib/widgets/viewer/info/info_app_bar.dart b/lib/widgets/viewer/info/info_app_bar.dart index 7692d35cb..c2c472060 100644 --- a/lib/widgets/viewer/info/info_app_bar.dart +++ b/lib/widgets/viewer/info/info_app_bar.dart @@ -43,28 +43,29 @@ class InfoAppBar extends StatelessWidget { onPressed: () => _goToSearch(context), tooltip: MaterialLocalizations.of(context).searchFieldLabel, ), - MenuIconTheme( - child: PopupMenuButton( - itemBuilder: (context) { - return [ - PopupMenuItem( - value: EntryInfoAction.editDate, - enabled: entry.canEditExif, - child: MenuRow(text: context.l10n.entryInfoActionEditDate, icon: const Icon(AIcons.date)), - ), - PopupMenuItem( - value: EntryInfoAction.removeMetadata, - enabled: entry.canRemoveMetadata, - child: MenuRow(text: context.l10n.entryInfoActionRemoveMetadata, icon: const Icon(AIcons.clear)), - ), - ]; - }, - onSelected: (action) { - // wait for the popup menu to hide before proceeding with the action - Future.delayed(Durations.popupMenuAnimation * timeDilation, () => EntryInfoActionDelegate(entry).onActionSelected(context, action)); - }, + if (entry.canEdit) + MenuIconTheme( + child: PopupMenuButton( + itemBuilder: (context) { + return [ + PopupMenuItem( + value: EntryInfoAction.editDate, + enabled: entry.canEditExif, + child: MenuRow(text: context.l10n.entryInfoActionEditDate, icon: const Icon(AIcons.date)), + ), + PopupMenuItem( + value: EntryInfoAction.removeMetadata, + enabled: entry.canRemoveMetadata, + child: MenuRow(text: context.l10n.entryInfoActionRemoveMetadata, icon: const Icon(AIcons.clear)), + ), + ]; + }, + onSelected: (action) { + // wait for the popup menu to hide before proceeding with the action + Future.delayed(Durations.popupMenuAnimation * timeDilation, () => EntryInfoActionDelegate(entry).onActionSelected(context, action)); + }, + ), ), - ), ], titleSpacing: 0, floating: true,