Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Use gallery overflow menu design in person and cluster app bars

ashilknd6b23564e490
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_actions.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_actions.dart
new file mode 100644
index 0000000000..b8f91a46fa
--- /dev/null
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_actions.dart
@@ -0,0 +1,56 @@
+import "dart:async";
+
+import "package:ente_components/ente_components.dart";
+import "package:flutter/material.dart";
+import "package:hugeicons/hugeicons.dart";
+import "package:photos/ui/components/popup_menu/ente_popup_menu_button.dart";
+
+/// Shared trailing-action surface for the gallery / people / cluster app bars.
+class GalleryAppBarIconButtonSurface extends StatelessWidget {
+ const GalleryAppBarIconButtonSurface({required this.icon, super.key});
+
+ final Widget icon;
+
+ @override
+ Widget build(BuildContext context) {
+ final colors = context.componentColors;
+
+ return SizedBox.square(
+ dimension: 36,
+ child: DecoratedBox(
+ decoration: BoxDecoration(
+ color: colors.fillLight,
+ borderRadius: BorderRadius.circular(Radii.md),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(Spacing.sm),
+ child: IconTheme.merge(
+ data: IconThemeData(color: colors.textBase, size: IconSizes.small),
+ child: icon,
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+Widget galleryAppBarPopupMenuAction<T>({
+ required Widget icon,
+ required String tooltip,
+ required FutureOr<List<EntePopupMenuOption<T>>> Function() optionsBuilder,
+ required FutureOr<void> Function(T) onSelected,
+}) {
+ return EntePopupMenuButton<T>(
+ optionsBuilder: optionsBuilder,
+ onSelected: onSelected,
+ elevation: 0,
+ child: Tooltip(
+ message: tooltip,
+ child: GalleryAppBarIconButtonSurface(icon: icon),
+ ),
+ );
+}
+
+Widget galleryAppBarMenuIcon(List<List<dynamic>> icon, Color color) {
+ return HugeIcon(icon: icon, size: IconSizes.small, color: color);
+}
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
index 33ed0989ce..92ae32df2d 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
@@ -50,6 +50,7 @@ import "package:photos/ui/sharing/manage_links_widget.dart";
import 'package:photos/ui/sharing/share_collection_page.dart';
import 'package:photos/ui/tools/free_space_page.dart';
import "package:photos/ui/viewer/file/detail_page.dart";
+import "package:photos/ui/viewer/gallery/gallery_app_bar_actions.dart";
import "package:photos/ui/viewer/gallery/gallery_app_bar_config.dart";
import "package:photos/ui/viewer/gallery/hooks/add_photos_sheet.dart";
import 'package:photos/ui/viewer/gallery/hooks/pick_cover_photo.dart';
@@ -273,23 +274,6 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
);
}
- Widget _buildPopupMenuAction<T>({
- required Widget icon,
- required String tooltip,
- required FutureOr<List<EntePopupMenuOption<T>>> Function() optionsBuilder,
- required FutureOr<void> Function(T) onSelected,
- }) {
- return EntePopupMenuButton<T>(
- optionsBuilder: optionsBuilder,
- onSelected: onSelected,
- elevation: 0,
- child: Tooltip(
- message: tooltip,
- child: _GalleryAppBarIconButtonSurface(icon: icon),
- ),
- );
- }
-
Future<dynamic> _renameAlbum(BuildContext context) async {
if (galleryType != GalleryType.ownedCollection &&
galleryType != GalleryType.hiddenOwnedCollection &&
@@ -461,7 +445,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
if (galleryType == GalleryType.magic) {
actions.add(
- _buildPopupMenuAction<AlbumPopupAction>(
+ galleryAppBarPopupMenuAction<AlbumPopupAction>(
tooltip: strings.sort,
icon: const HugeIcon(icon: HugeIcons.strokeRoundedFilterHorizontal),
optionsBuilder: () {
@@ -531,7 +515,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
}
actions.add(
- _buildPopupMenuAction<AlbumPopupAction>(
+ galleryAppBarPopupMenuAction<AlbumPopupAction>(
tooltip: strings.more,
icon: const HugeIcon(icon: HugeIcons.strokeRoundedMoreVertical),
optionsBuilder: () => _buildOverflowMenuOptions(
@@ -683,7 +667,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
_menuOption(
AlbumPopupAction.rename,
isQuickLink ? strings.convertToAlbum : strings.renameAlbum,
- _menuHugeIcon(
+ galleryAppBarMenuIcon(
isQuickLink
? HugeIcons.strokeRoundedAlbum02
: HugeIcons.strokeRoundedPencilEdit01,
@@ -694,31 +678,31 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
_menuOption(
AlbumPopupAction.setCover,
strings.setCover,
- _menuHugeIcon(HugeIcons.strokeRoundedImage01, iconColor),
+ galleryAppBarMenuIcon(HugeIcons.strokeRoundedImage01, iconColor),
),
if (galleryType.showMap())
_menuOption(
AlbumPopupAction.map,
strings.map,
- _menuHugeIcon(HugeIcons.strokeRoundedLocation01, iconColor),
+ galleryAppBarMenuIcon(HugeIcons.strokeRoundedLocation01, iconColor),
),
if (galleryType.canSort())
_menuOption(
AlbumPopupAction.sort,
strings.sortAlbumsBy,
- _menuHugeIcon(HugeIcons.strokeRoundedSorting01, iconColor),
+ galleryAppBarMenuIcon(HugeIcons.strokeRoundedSorting01, iconColor),
),
if (galleryType == GalleryType.uncategorized)
_menuOption(
AlbumPopupAction.cleanUncategorized,
strings.cleanUncategorized,
- _menuHugeIcon(HugeIcons.strokeRoundedClean, iconColor),
+ galleryAppBarMenuIcon(HugeIcons.strokeRoundedClean, iconColor),
),
if (galleryType.canPin())
_menuOption(
AlbumPopupAction.pinAlbum,
widget.collection!.isPinned ? strings.unpin : strings.pin,
- _menuHugeIcon(
+ galleryAppBarMenuIcon(
widget.collection!.isPinned
? HugeIcons.strokeRoundedPinOff
: HugeIcons.strokeRoundedPin,
@@ -729,20 +713,20 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
_menuOption(
AlbumPopupAction.editLocation,
strings.editLocation,
- _menuHugeIcon(HugeIcons.strokeRoundedLocation01, iconColor),
+ galleryAppBarMenuIcon(HugeIcons.strokeRoundedLocation01, iconColor),
),
if (galleryType == GalleryType.locationTag)
_menuOption(
AlbumPopupAction.deleteLocation,
strings.deleteLocation,
- _menuHugeIcon(HugeIcons.strokeRoundedDelete01, warning500),
+ galleryAppBarMenuIcon(HugeIcons.strokeRoundedDelete01, warning500),
labelColor: warning500,
),
if (isArchived || (galleryType.canArchive() && !isHidden))
_menuOption(
AlbumPopupAction.ownedArchive,
isArchived ? strings.unarchiveAlbum : strings.archiveAlbum,
- _menuHugeIcon(
+ galleryAppBarMenuIcon(
isArchived
? HugeIcons.strokeRoundedUnarchive03
: HugeIcons.strokeRoundedArchive03,
@@ -753,7 +737,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
_menuOption(
AlbumPopupAction.ownedHide,
isHidden ? strings.unhide : strings.hide,
- _menuHugeIcon(
+ galleryAppBarMenuIcon(
isHidden
? HugeIcons.strokeRoundedView
: HugeIcons.strokeRoundedViewOffSlash,
@@ -764,13 +748,13 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
_menuOption(
AlbumPopupAction.galleryGuestView,
strings.guestView,
- _menuHugeIcon(HugeIcons.strokeRoundedIncognito, iconColor),
+ galleryAppBarMenuIcon(HugeIcons.strokeRoundedIncognito, iconColor),
),
if (widget.collection != null && castService.isSupported)
_menuOption(
AlbumPopupAction.castAlbum,
strings.castAlbum,
- _menuHugeIcon(
+ galleryAppBarMenuIcon(
castService.getActiveSessions().isNotEmpty
? HugeIcons.strokeRoundedTvSmart
: HugeIcons.strokeRoundedTv02,
@@ -781,13 +765,13 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
_menuOption(
AlbumPopupAction.autoAddPhotos,
hasAutoAddPeople ? strings.editAutoAddPeople : strings.autoAddPeople,
- _menuHugeIcon(HugeIcons.strokeRoundedUserAdd01, iconColor),
+ galleryAppBarMenuIcon(HugeIcons.strokeRoundedUserAdd01, iconColor),
),
if (galleryType.canDelete())
_menuOption(
isQuickLink ? AlbumPopupAction.removeLink : AlbumPopupAction.delete,
isQuickLink ? strings.removeLink : strings.deleteAlbum,
- _menuHugeIcon(
+ galleryAppBarMenuIcon(
isQuickLink
? HugeIcons.strokeRoundedLinkBackward
: HugeIcons.strokeRoundedDelete01,
@@ -798,7 +782,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
_menuOption(
AlbumPopupAction.shareePinAlbum,
widget.collection!.hasShareePinned() ? strings.unpin : strings.pin,
- _menuHugeIcon(
+ galleryAppBarMenuIcon(
widget.collection!.hasShareePinned()
? HugeIcons.strokeRoundedPinOff
: HugeIcons.strokeRoundedPin,
@@ -811,7 +795,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
widget.collection!.hasShareeArchived()
? strings.unarchiveAlbum
: strings.archiveAlbum,
- _menuHugeIcon(
+ galleryAppBarMenuIcon(
widget.collection!.hasShareeArchived()
? HugeIcons.strokeRoundedUnarchive03
: HugeIcons.strokeRoundedArchive03,
@@ -822,7 +806,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
_menuOption(
AlbumPopupAction.sharedHide,
widget.collection!.hasShareeHidden() ? strings.unhide : strings.hide,
- _menuHugeIcon(
+ galleryAppBarMenuIcon(
widget.collection!.hasShareeHidden()
? HugeIcons.strokeRoundedView
: HugeIcons.strokeRoundedViewOffSlash,
@@ -833,20 +817,20 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
_menuOption(
AlbumPopupAction.leave,
strings.leaveAlbum,
- _menuHugeIcon(HugeIcons.strokeRoundedLogout05, iconColor),
+ galleryAppBarMenuIcon(HugeIcons.strokeRoundedLogout05, iconColor),
),
if (galleryType == GalleryType.localFolder && !_isICloudSharedAlbum)
_menuOption(
AlbumPopupAction.freeUpSpace,
strings.freeUpDeviceSpace,
- _menuHugeIcon(HugeIcons.strokeRoundedClean, iconColor),
+ galleryAppBarMenuIcon(HugeIcons.strokeRoundedClean, iconColor),
),
if (galleryType == GalleryType.sharedPublicCollection &&
(widget.collection?.isDownloadEnabledForPublicLink() ?? false))
_menuOption(
AlbumPopupAction.downloadAlbum,
strings.download,
- _menuHugeIcon(HugeIcons.strokeRoundedDownload01, iconColor),
+ galleryAppBarMenuIcon(HugeIcons.strokeRoundedDownload01, iconColor),
),
];
}
@@ -865,10 +849,6 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
);
}
- Widget _menuHugeIcon(List<List<dynamic>> icon, Color color) {
- return HugeIcon(icon: icon, size: IconSizes.small, color: color);
- }
-
Future<void> _downloadPublicAlbumToGallery(List<EnteFile>? files) async {
if (files == null || files.isEmpty) {
return;
@@ -1359,31 +1339,3 @@ class _GallerySliverAppBar extends StatelessWidget {
);
}
}
-
-class _GalleryAppBarIconButtonSurface extends StatelessWidget {
- const _GalleryAppBarIconButtonSurface({required this.icon});
-
- final Widget icon;
-
- @override
- Widget build(BuildContext context) {
- final colors = context.componentColors;
-
- return SizedBox.square(
- dimension: 36,
- child: DecoratedBox(
- decoration: BoxDecoration(
- color: colors.fillLight,
- borderRadius: BorderRadius.circular(Radii.md),
- ),
- child: Padding(
- padding: const EdgeInsets.all(Spacing.sm),
- child: IconTheme.merge(
- data: IconThemeData(color: colors.textBase, size: IconSizes.small),
- child: icon,
- ),
- ),
- ),
- );
- }
-}
diff --git a/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dart
index 1ff3721a78..df35ece19c 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/cluster_app_bar.dart
@@ -3,6 +3,7 @@ import 'dart:async';
import "package:ente_components/ente_components.dart";
import "package:flutter/foundation.dart";
import 'package:flutter/material.dart';
+import "package:hugeicons/hugeicons.dart";
import 'package:logging/logging.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/core/event_bus.dart';
@@ -21,8 +22,9 @@ import "package:photos/services/machine_learning/face_ml/feedback/cluster_feedba
import "package:photos/services/machine_learning/ml_result.dart";
import "package:photos/theme/ente_theme.dart";
import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';
-import "package:photos/ui/common/popup_item.dart";
import 'package:photos/ui/components/buttons/button_widget.dart';
+import "package:photos/ui/components/popup_menu/ente_popup_menu_button.dart";
+import "package:photos/ui/viewer/gallery/gallery_app_bar_actions.dart";
import "package:photos/ui/viewer/gallery/gallery_app_bar_config.dart";
import "package:photos/ui/viewer/people/cluster_breakup_page.dart";
import "package:photos/ui/viewer/people/cluster_page.dart";
@@ -126,6 +128,7 @@ class _AppBarWidgetState extends State<ClusterAppBar> {
}
List<Widget> _getDefaultActions(BuildContext context) {
+ final iconColor = getEnteColorScheme(context).contentLight;
final List<Widget> actions = <Widget>[];
// If the user has selected files, don't show any actions
if (widget.selectedFiles.files.isNotEmpty ||
@@ -134,51 +137,50 @@ class _AppBarWidgetState extends State<ClusterAppBar> {
return actions;
}
- final List<EntePopupMenuItem<ClusterPopupAction>> items = [];
-
- items.addAll([
- EntePopupMenuItem(
- AppLocalizations.of(context).ignorePerson,
+ final List<EntePopupMenuOption<ClusterPopupAction>> items = [
+ EntePopupMenuOption(
value: ClusterPopupAction.ignore,
- icon: Icons.person_off_outlined,
+ label: AppLocalizations.of(context).ignorePerson,
+ leadingWidget: galleryAppBarMenuIcon(
+ HugeIcons.strokeRoundedUserBlock01,
+ iconColor,
+ ),
),
- EntePopupMenuItem(
- AppLocalizations.of(context).mixedGrouping,
+ EntePopupMenuOption(
value: ClusterPopupAction.breakupCluster,
- icon: Icons.analytics_outlined,
+ label: AppLocalizations.of(context).mixedGrouping,
+ leadingWidget: galleryAppBarMenuIcon(
+ HugeIcons.strokeRoundedUserMultiple,
+ iconColor,
+ ),
),
- ]);
- if (kDebugMode) {
- items.add(
- EntePopupMenuItem(
- "Debug mixed grouping",
+ if (kDebugMode)
+ EntePopupMenuOption(
value: ClusterPopupAction.breakupClusterDebug,
- icon: Icons.analytics_outlined,
+ label: "Debug mixed grouping",
+ leadingWidget: galleryAppBarMenuIcon(
+ HugeIcons.strokeRoundedAiBrain01,
+ iconColor,
+ ),
),
- );
- }
+ ];
- if (items.isNotEmpty) {
- actions.add(
- PopupMenuButton(
- itemBuilder: (context) {
- return items;
- },
- onSelected: (ClusterPopupAction value) async {
- if (value == ClusterPopupAction.breakupCluster) {
- // ignore: unawaited_futures
- await _breakUpCluster(context);
- } else if (value == ClusterPopupAction.ignore) {
- await _onIgnoredClusterClicked(context);
- } else if (value == ClusterPopupAction.breakupClusterDebug) {
- await _breakUpClusterDebug(context);
- }
- // else if (value == ClusterPopupAction.setCover) {
- // await setCoverPhoto(context);
- },
- ),
- );
- }
+ actions.add(
+ galleryAppBarPopupMenuAction<ClusterPopupAction>(
+ tooltip: AppLocalizations.of(context).more,
+ icon: const HugeIcon(icon: HugeIcons.strokeRoundedMoreVertical),
+ optionsBuilder: () => items,
+ onSelected: (ClusterPopupAction value) async {
+ if (value == ClusterPopupAction.breakupCluster) {
+ await _breakUpCluster(context);
+ } else if (value == ClusterPopupAction.ignore) {
+ await _onIgnoredClusterClicked(context);
+ } else if (value == ClusterPopupAction.breakupClusterDebug) {
+ await _breakUpClusterDebug(context);
+ }
+ },
+ ),
+ );
return actions;
}
diff --git a/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
index bcfa6a146d..b3a7ffc356 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
@@ -3,6 +3,7 @@ import 'dart:async';
import "package:ente_components/ente_components.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
import 'package:flutter/material.dart';
+import "package:hugeicons/hugeicons.dart";
import 'package:logging/logging.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/core/event_bus.dart';
@@ -18,7 +19,9 @@ import "package:photos/services/machine_learning/face_ml/person/person_service.d
import "package:photos/theme/ente_theme.dart";
import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';
import "package:photos/ui/components/buttons/button_widget.dart";
+import "package:photos/ui/components/popup_menu/ente_popup_menu_button.dart";
import "package:photos/ui/notification/toast.dart";
+import "package:photos/ui/viewer/gallery/gallery_app_bar_actions.dart";
import "package:photos/ui/viewer/gallery/gallery_app_bar_config.dart";
import "package:photos/ui/viewer/gallery/hooks/pick_person_avatar.dart";
import "package:photos/ui/viewer/gallery/state/inherited_search_filter_data.dart";
@@ -264,11 +267,10 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
}
List<Widget> _getDefaultActions(BuildContext context) {
- final textTheme = getEnteTextTheme(context);
- final currentPerson = person;
- final bool isIgnored = currentPerson.data.isIgnored;
- final bool isPinned = currentPerson.data.isPinned;
- final bool hideFromMemories = currentPerson.data.hideFromMemories;
+ final iconColor = getEnteColorScheme(context).contentLight;
+ final bool isIgnored = person.data.isIgnored;
+ final bool isPinned = person.data.isPinned;
+ final bool hideFromMemories = person.data.hideFromMemories;
final List<Widget> actions = <Widget>[];
// If the user has selected files, don't show any actions
if (widget.selectedFiles.files.isNotEmpty ||
@@ -276,22 +278,17 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
return actions;
}
- final List<PopupMenuItem<PeoplePopupAction>> items = [];
+ final List<EntePopupMenuOption<PeoplePopupAction>> items = [];
final bool showTimelineAction =
widget.memoryLaneReady && widget.onMemoryLaneTap != null;
if (showTimelineAction) {
items.add(
- PopupMenuItem(
+ EntePopupMenuOption(
value: PeoplePopupAction.memoryLane,
- child: Row(
- children: [
- const Icon(Icons.auto_awesome_outlined),
- const Padding(padding: EdgeInsets.all(8)),
- Text(
- context.l10n.facesTimelineAppBarTitle,
- style: textTheme.bodyBold,
- ),
- ],
+ label: context.l10n.facesTimelineAppBarTitle,
+ leadingWidget: galleryAppBarMenuIcon(
+ HugeIcons.strokeRoundedSparkles,
+ iconColor,
),
),
);
@@ -299,202 +296,147 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
if (!isIgnored) {
items.addAll([
- PopupMenuItem(
+ EntePopupMenuOption(
value: PeoplePopupAction.rename,
- child: Row(
- children: [
- const Icon(Icons.edit),
- const Padding(padding: EdgeInsets.all(8)),
- Text(
- AppLocalizations.of(context).edit,
- style: textTheme.bodyBold,
- ),
- ],
+ label: AppLocalizations.of(context).edit,
+ leadingWidget: galleryAppBarMenuIcon(
+ HugeIcons.strokeRoundedPencilEdit01,
+ iconColor,
),
),
- PopupMenuItem(
+ EntePopupMenuOption(
value: PeoplePopupAction.reviewSuggestions,
- child: Row(
- children: [
- const Icon(Icons.search_outlined),
- const Padding(padding: EdgeInsets.all(8)),
- Text(
- AppLocalizations.of(context).review,
- style: textTheme.bodyBold,
- ),
- ],
+ label: AppLocalizations.of(context).review,
+ leadingWidget: galleryAppBarMenuIcon(
+ HugeIcons.strokeRoundedSearch01,
+ iconColor,
),
),
- PopupMenuItem(
+ EntePopupMenuOption(
value: PeoplePopupAction.setCover,
- child: Row(
- children: [
- const Icon(Icons.image_outlined),
- const Padding(padding: EdgeInsets.all(8)),
- Text(
- AppLocalizations.of(context).setCover,
- style: textTheme.bodyBold,
- ),
- ],
+ label: AppLocalizations.of(context).setCover,
+ leadingWidget: galleryAppBarMenuIcon(
+ HugeIcons.strokeRoundedImage01,
+ iconColor,
),
),
- PopupMenuItem(
+ EntePopupMenuOption(
value: PeoplePopupAction.pinPerson,
- child: Row(
- children: [
- Icon(isPinned ? Icons.push_pin : Icons.push_pin_outlined),
- const Padding(padding: EdgeInsets.all(8)),
- Text(
- isPinned ? context.l10n.unpinPerson : context.l10n.pinPerson,
- style: textTheme.bodyBold,
- ),
- ],
+ label: isPinned ? context.l10n.unpinPerson : context.l10n.pinPerson,
+ leadingWidget: galleryAppBarMenuIcon(
+ isPinned
+ ? HugeIcons.strokeRoundedPinOff
+ : HugeIcons.strokeRoundedPin,
+ iconColor,
),
),
- PopupMenuItem(
+ EntePopupMenuOption(
value: PeoplePopupAction.hideFromMemories,
- child: Row(
- children: [
- Icon(
- hideFromMemories
- ? Icons.visibility_outlined
- : Icons.visibility_off_outlined,
- ),
- const Padding(padding: EdgeInsets.all(8)),
- Text(
- hideFromMemories
- ? context.l10n.showInMemories
- : context.l10n.hideFromMemories,
- style: textTheme.bodyBold,
- ),
- ],
+ label: hideFromMemories
+ ? context.l10n.showInMemories
+ : context.l10n.hideFromMemories,
+ leadingWidget: galleryAppBarMenuIcon(
+ hideFromMemories
+ ? HugeIcons.strokeRoundedView
+ : HugeIcons.strokeRoundedViewOffSlash,
+ iconColor,
),
),
- if (currentPerson.data.email != null &&
- (currentPerson.data.email == Configuration.instance.getEmail()))
- PopupMenuItem(
+ if (person.data.email != null &&
+ (person.data.email == Configuration.instance.getEmail()))
+ EntePopupMenuOption(
value: PeoplePopupAction.reassignMe,
- child: Row(
- children: [
- const Icon(Icons.person_2_outlined),
- const Padding(padding: EdgeInsets.all(8)),
- Text(context.l10n.reassignMe, style: textTheme.bodyBold),
- ],
+ label: context.l10n.reassignMe,
+ leadingWidget: galleryAppBarMenuIcon(
+ HugeIcons.strokeRoundedUser,
+ iconColor,
),
),
- PopupMenuItem(
+ EntePopupMenuOption(
value: PeoplePopupAction.ignore,
- child: Row(
- children: [
- const Icon(Icons.person_off_outlined),
- const Padding(padding: EdgeInsets.all(8)),
- Text(
- AppLocalizations.of(context).ignore,
- style: textTheme.bodyBold,
- ),
- ],
+ label: AppLocalizations.of(context).ignore,
+ leadingWidget: galleryAppBarMenuIcon(
+ HugeIcons.strokeRoundedUserBlock01,
+ iconColor,
),
),
- PopupMenuItem(
+ EntePopupMenuOption(
value: PeoplePopupAction.removeLabel,
- child: Row(
- children: [
- const Icon(Icons.delete_outline),
- const Padding(padding: EdgeInsets.all(8)),
- Text(
- AppLocalizations.of(context).remove,
- style: textTheme.bodyBold,
- ),
- ],
+ label: AppLocalizations.of(context).remove,
+ leadingWidget: galleryAppBarMenuIcon(
+ HugeIcons.strokeRoundedDelete01,
+ iconColor,
),
),
]);
} else {
items.addAll([
- PopupMenuItem(
+ EntePopupMenuOption(
value: PeoplePopupAction.rename,
- child: Row(
- children: [
- const Icon(Icons.edit),
- const Padding(padding: EdgeInsets.all(8)),
- Text(
- AppLocalizations.of(context).edit,
- style: textTheme.bodyBold,
- ),
- ],
+ label: AppLocalizations.of(context).edit,
+ leadingWidget: galleryAppBarMenuIcon(
+ HugeIcons.strokeRoundedPencilEdit01,
+ iconColor,
),
),
- PopupMenuItem(
+ EntePopupMenuOption(
value: PeoplePopupAction.reviewSuggestions,
- child: Row(
- children: [
- const Icon(Icons.search_outlined),
- const Padding(padding: EdgeInsets.all(8)),
- Text(
- AppLocalizations.of(context).review,
- style: textTheme.bodyBold,
- ),
- ],
+ label: AppLocalizations.of(context).review,
+ leadingWidget: galleryAppBarMenuIcon(
+ HugeIcons.strokeRoundedSearch01,
+ iconColor,
),
),
- PopupMenuItem(
+ EntePopupMenuOption(
value: PeoplePopupAction.unignore,
- child: Row(
- children: [
- const Icon(Icons.visibility_outlined),
- const Padding(padding: EdgeInsets.all(8)),
- Text(
- AppLocalizations.of(context).showPerson,
- style: textTheme.bodyBold,
- ),
- ],
+ label: AppLocalizations.of(context).showPerson,
+ leadingWidget: galleryAppBarMenuIcon(
+ HugeIcons.strokeRoundedView,
+ iconColor,
),
),
]);
}
- if (items.isNotEmpty) {
- actions.add(
- PopupMenuButton(
- itemBuilder: (context) {
- return items;
- },
- onSelected: (PeoplePopupAction value) async {
- if (value == PeoplePopupAction.reviewSuggestions) {
- // ignore: unawaited_futures
- unawaited(
- Navigator.of(context).push(
- MaterialPageRoute(
- builder: (context) => PersonReviewClusterSuggestion(person),
- ),
+ actions.add(
+ galleryAppBarPopupMenuAction<PeoplePopupAction>(
+ tooltip: AppLocalizations.of(context).more,
+ icon: const HugeIcon(icon: HugeIcons.strokeRoundedMoreVertical),
+ optionsBuilder: () => items,
+ onSelected: (PeoplePopupAction value) async {
+ if (value == PeoplePopupAction.reviewSuggestions) {
+ unawaited(
+ Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (context) => PersonReviewClusterSuggestion(person),
),
- );
- } else if (value == PeoplePopupAction.memoryLane) {
- final callback = widget.onMemoryLaneTap;
- if (callback != null) {
- unawaited(callback());
- }
- } else if (value == PeoplePopupAction.rename) {
- await _editPerson(context);
- } else if (value == PeoplePopupAction.setCover) {
- await setCoverPhoto(context);
- } else if (value == PeoplePopupAction.pinPerson) {
- await _togglePinState();
- } else if (value == PeoplePopupAction.hideFromMemories) {
- await _toggleHideFromMemories();
- } else if (value == PeoplePopupAction.ignore) {
- await _ignorePerson(context);
- } else if (value == PeoplePopupAction.unignore) {
- await _showPerson(context);
- } else if (value == PeoplePopupAction.removeLabel) {
- await _resetPerson(context);
- } else if (value == PeoplePopupAction.reassignMe) {
- await _reassignMe(context);
+ ),
+ );
+ } else if (value == PeoplePopupAction.memoryLane) {
+ final callback = widget.onMemoryLaneTap;
+ if (callback != null) {
+ unawaited(callback());
}
- },
- ),
- );
- }
+ } else if (value == PeoplePopupAction.rename) {
+ await _editPerson(context);
+ } else if (value == PeoplePopupAction.setCover) {
+ await setCoverPhoto(context);
+ } else if (value == PeoplePopupAction.pinPerson) {
+ await _togglePinState();
+ } else if (value == PeoplePopupAction.hideFromMemories) {
+ await _toggleHideFromMemories();
+ } else if (value == PeoplePopupAction.ignore) {
+ await _ignorePerson(context);
+ } else if (value == PeoplePopupAction.unignore) {
+ await _showPerson(context);
+ } else if (value == PeoplePopupAction.removeLabel) {
+ await _resetPerson(context);
+ } else if (value == PeoplePopupAction.reassignMe) {
+ await _reassignMe(context);
+ }
+ },
+ ),
+ );
return actions;
}