Skip to content

armgit / ente

Public Imported from GitHub
0

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

Refactor album and collection UI components to integrate EntePopupMenuButton for improved menu functionality and layout adjustments

AmanRajSinghMouryacd7877ae5a08
diff --git a/mobile/apps/photos/lib/ui/collections/album/horizontal_list.dart b/mobile/apps/photos/lib/ui/collections/album/horizontal_list.dart
index eb093d753c..54b1ec57c9 100644
--- a/mobile/apps/photos/lib/ui/collections/album/horizontal_list.dart
+++ b/mobile/apps/photos/lib/ui/collections/album/horizontal_list.dart
@@ -111,12 +111,14 @@ class _AlbumHorizontalListState extends State<AlbumHorizontalList> {
Align(
alignment: Alignment.centerLeft,
child: SizedBox(
- height: sideOfThumbnail + 46,
+ height: sideOfThumbnail + 46 + horizontalPadding,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: allCollections.length,
- padding: const EdgeInsets.symmetric(
- horizontal: horizontalPadding / 2,
+ padding: const EdgeInsets.only(
+ left: horizontalPadding / 2,
+ right: horizontalPadding / 2,
+ top: horizontalPadding,
),
itemBuilder: (context, index) {
final item = allCollections[index];
diff --git a/mobile/apps/photos/lib/ui/collections/collection_list_page.dart b/mobile/apps/photos/lib/ui/collections/collection_list_page.dart
index cc279371f8..d461b09e2f 100644
--- a/mobile/apps/photos/lib/ui/collections/collection_list_page.dart
+++ b/mobile/apps/photos/lib/ui/collections/collection_list_page.dart
@@ -2,7 +2,7 @@ import "dart:async";
import "package:collection/collection.dart";
import 'package:flutter/material.dart';
-import "package:flutter_svg/flutter_svg.dart";
+import "package:hugeicons/hugeicons.dart";
import "package:photos/core/constants.dart";
import "package:photos/core/event_bus.dart";
import "package:photos/events/album_sort_order_change_event.dart";
@@ -15,7 +15,7 @@ import "package:photos/service_locator.dart";
import "package:photos/services/collections_service.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/collections/flex_grid_view.dart";
-import "package:photos/ui/components/buttons/icon_button_widget.dart";
+import "package:photos/ui/components/popup_menu/ente_popup_menu_button.dart";
import "package:photos/ui/components/searchable_appbar.dart";
import "package:photos/ui/viewer/actions/album_selection_overlay_bar.dart";
import "package:photos/utils/local_settings.dart";
@@ -28,6 +28,8 @@ enum UISectionType {
hiddenCollections,
}
+enum _CollectionListMenuAction { toggleView, name, newest, updated }
+
class CollectionListPage extends StatefulWidget {
final List<Collection>? collections;
final Widget? appTitle;
@@ -54,9 +56,9 @@ class _CollectionListPageState extends State<CollectionListPage> {
late StreamSubscription<CollectionUpdatedEvent>
_collectionUpdatesSubscription;
List<Collection>? collections;
- AlbumSortKey? sortKey;
+ late AlbumSortKey sortKey;
AlbumViewType? albumViewType;
- AlbumSortDirection? albumSortDirection;
+ late AlbumSortDirection albumSortDirection;
String _searchQuery = "";
final _selectedAlbum = SelectedAlbums();
late final ScrollController _scrollController;
@@ -106,9 +108,11 @@ class _CollectionListPageState extends State<CollectionListPage> {
controller: _scrollController,
slivers: [
SearchableAppBar(
+ searchIconPadding: const EdgeInsets.only(right: 8),
title: widget.appTitle ?? const SizedBox.shrink(),
heroTag: widget.tag,
autoActivateSearch: widget.startInSearchMode,
+ pinned: true,
onSearch: (value) {
_searchQuery = value;
unawaited(refreshCollections());
@@ -121,6 +125,9 @@ class _CollectionListPageState extends State<CollectionListPage> {
_sortMenu(),
],
),
+ const SliverToBoxAdapter(
+ child: SizedBox(height: 16),
+ ),
CollectionsFlexiGridViewWidget(
collections,
tag: widget.tag,
@@ -145,112 +152,117 @@ class _CollectionListPageState extends State<CollectionListPage> {
}
Widget _sortMenu() {
- final colorTheme = getEnteColorScheme(context);
- final isLightMode = Theme.of(context).brightness == Brightness.light;
- Widget sortOptionText(AlbumSortKey key) {
- String text = key.toString();
- switch (key) {
- case AlbumSortKey.albumName:
- text = AppLocalizations.of(context).name;
- break;
- case AlbumSortKey.newestPhoto:
- text = AppLocalizations.of(context).newest;
- break;
- case AlbumSortKey.lastUpdated:
- text = AppLocalizations.of(context).lastUpdated;
- }
- return Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(
- text,
- ),
- Icon(
- sortKey == key
- ? (albumSortDirection == AlbumSortDirection.ascending
- ? Icons.arrow_upward
- : Icons.arrow_downward)
- : null,
- size: 18,
- ),
- ],
- );
- }
+ return Padding(
+ padding: const EdgeInsets.only(right: 12),
+ child: EntePopupMenuButton<_CollectionListMenuAction>(
+ optionsBuilder: _buildMenuOptions,
+ onSelected: _handleMenuSelection,
+ ),
+ );
+ }
- return Theme(
- data: Theme.of(context).copyWith(
- highlightColor: Colors.transparent,
- splashColor: Colors.transparent,
+ List<EntePopupMenuOption<_CollectionListMenuAction>> _buildMenuOptions() {
+ final colorScheme = getEnteColorScheme(context);
+ final strings = AppLocalizations.of(context);
+ final currentViewType = albumViewType ?? localSettings.albumViewType();
+ final isListView = currentViewType == AlbumViewType.list;
+ final currentSortKey = sortKey;
+ final currentSortDirection = albumSortDirection;
+ final nameSortDirection =
+ currentSortKey == AlbumSortKey.albumName ? currentSortDirection : null;
+ final activeTrailingWidget = HugeIcon(
+ icon: currentSortDirection == AlbumSortDirection.ascending
+ ? HugeIcons.strokeRoundedArrowUp02
+ : HugeIcons.strokeRoundedArrowDown02,
+ size: 12,
+ strokeWidth: 3,
+ color: colorScheme.textMuted,
+ );
+
+ return [
+ EntePopupMenuOption(
+ value: _CollectionListMenuAction.toggleView,
+ label: isListView ? strings.grid : strings.list,
+ trailingWidget: HugeIcon(
+ icon: isListView
+ ? HugeIcons.strokeRoundedGridView
+ : HugeIcons.strokeRoundedMenu01,
+ size: 12,
+ strokeWidth: 3,
+ color: colorScheme.contentLight,
+ ),
),
- child: Row(
- children: [
- GestureDetector(
- onTap: () async {
- setState(() {
- albumViewType = albumViewType == AlbumViewType.grid
- ? AlbumViewType.list
- : AlbumViewType.grid;
- });
- await localSettings.setAlbumViewType(albumViewType!);
- },
- child: Padding(
- padding: const EdgeInsets.all(12.0),
- child: SizedBox(
- height: 24,
- width: 24,
- child: albumViewType == AlbumViewType.grid
- ? SvgPicture.asset(
- isLightMode
- ? "assets/icons/list_view_icon_light.svg"
- : "assets/icons/list_view_icon_dark.svg",
- )
- : Icon(
- Icons.grid_view,
- color: colorTheme.textMuted,
- size: 22,
- ),
- ),
- ),
- ),
- GestureDetector(
- onTapDown: (TapDownDetails details) async {
- final int? selectedValue = await showMenu<int>(
- color: colorTheme.backgroundElevated,
- context: context,
- position: RelativeRect.fromLTRB(
- details.globalPosition.dx,
- details.globalPosition.dy,
- details.globalPosition.dx,
- details.globalPosition.dy + 50,
- ),
- items: List.generate(AlbumSortKey.values.length, (index) {
- return PopupMenuItem(
- value: index,
- child: sortOptionText(AlbumSortKey.values[index]),
- );
- }),
- );
- if (selectedValue != null) {
- sortKey = AlbumSortKey.values[selectedValue];
- await localSettings.setAlbumSortKey(sortKey!);
- albumSortDirection =
- albumSortDirection == AlbumSortDirection.ascending
- ? AlbumSortDirection.descending
- : AlbumSortDirection.ascending;
- await localSettings.setAlbumSortDirection(albumSortDirection!);
- await refreshCollections();
- Bus.instance.fire(AlbumSortOrderChangeEvent());
- }
- },
- child: IconButtonWidget(
- icon: Icons.sort_rounded,
- iconButtonType: IconButtonType.secondary,
- iconColor: colorTheme.textMuted,
- ),
- ),
- ],
+ EntePopupMenuOption(
+ value: _CollectionListMenuAction.name,
+ label: strings.name,
+ secondaryLabel: nameSortDirection != AlbumSortDirection.descending
+ ? strings.sortAToZ
+ : strings.sortZToA,
+ isActive: currentSortKey == AlbumSortKey.albumName,
+ activeTrailingWidget: activeTrailingWidget,
),
- );
+ EntePopupMenuOption(
+ value: _CollectionListMenuAction.newest,
+ label: strings.newest,
+ isActive: currentSortKey == AlbumSortKey.newestPhoto,
+ activeTrailingWidget: activeTrailingWidget,
+ ),
+ EntePopupMenuOption(
+ value: _CollectionListMenuAction.updated,
+ label: strings.updated,
+ isActive: currentSortKey == AlbumSortKey.lastUpdated,
+ activeTrailingWidget: activeTrailingWidget,
+ showDivider: false,
+ ),
+ ];
+ }
+
+ Future<void> _handleMenuSelection(_CollectionListMenuAction selected) async {
+ switch (selected) {
+ case _CollectionListMenuAction.toggleView:
+ await _toggleViewMode();
+ break;
+ case _CollectionListMenuAction.name:
+ await _setSortMode(AlbumSortKey.albumName);
+ break;
+ case _CollectionListMenuAction.newest:
+ await _setSortMode(AlbumSortKey.newestPhoto);
+ break;
+ case _CollectionListMenuAction.updated:
+ await _setSortMode(AlbumSortKey.lastUpdated);
+ break;
+ }
+ }
+
+ Future<void> _toggleViewMode() async {
+ final next =
+ (albumViewType ?? localSettings.albumViewType()) == AlbumViewType.grid
+ ? AlbumViewType.list
+ : AlbumViewType.grid;
+ setState(() {
+ albumViewType = next;
+ });
+ await localSettings.setAlbumViewType(next);
+ }
+
+ Future<void> _setSortMode(AlbumSortKey key) async {
+ final currentSortKey = sortKey;
+ final currentSortDirection = albumSortDirection;
+ final AlbumSortDirection nextDirection;
+ if (currentSortKey == key) {
+ nextDirection = currentSortDirection == AlbumSortDirection.ascending
+ ? AlbumSortDirection.descending
+ : AlbumSortDirection.ascending;
+ } else {
+ nextDirection = AlbumSortDirection.ascending;
+ }
+
+ sortKey = key;
+ albumSortDirection = nextDirection;
+ await localSettings.setAlbumSortKey(key);
+ await localSettings.setAlbumSortDirection(nextDirection);
+ await refreshCollections();
+ Bus.instance.fire(AlbumSortOrderChangeEvent());
}
Future<void> refreshCollections() async {
@@ -281,7 +293,8 @@ class _CollectionListPageState extends State<CollectionListPage> {
)
.toList();
}
- if (widget.sectionType == UISectionType.hiddenCollections) {
+ if (widget.sectionType == UISectionType.archivedCollections ||
+ widget.sectionType == UISectionType.hiddenCollections) {
await _sortCollectionsByCurrentPreferences(collections!);
}
if (mounted) {
@@ -296,8 +309,8 @@ class _CollectionListPageState extends State<CollectionListPage> {
return;
}
- final currentSortKey = localSettings.albumSortKey();
- final currentSortDirection = localSettings.albumSortDirection();
+ final currentSortKey = sortKey;
+ final currentSortDirection = albumSortDirection;
Map<int, int>? collectionIDToNewestPhotoTime;
if (currentSortKey == AlbumSortKey.newestPhoto) {
diff --git a/mobile/apps/photos/lib/ui/components/searchable_appbar.dart b/mobile/apps/photos/lib/ui/components/searchable_appbar.dart
index a5441c4ebb..8fe4644990 100644
--- a/mobile/apps/photos/lib/ui/components/searchable_appbar.dart
+++ b/mobile/apps/photos/lib/ui/components/searchable_appbar.dart
@@ -1,6 +1,8 @@
import "package:flutter/material.dart";
-import "package:flutter_svg/flutter_svg.dart";
+import "package:hugeicons/hugeicons.dart";
import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/components/buttons/soft_icon_button.dart";
+import "package:photos/ui/components/text_input_widget_v2.dart";
class SearchableAppBar extends StatefulWidget {
final Widget title;
@@ -12,6 +14,7 @@ class SearchableAppBar extends StatefulWidget {
final Color? backgroundColor;
final bool? centerTitle;
final EdgeInsetsGeometry searchIconPadding;
+ final bool pinned;
const SearchableAppBar({
super.key,
@@ -24,6 +27,7 @@ class SearchableAppBar extends StatefulWidget {
this.backgroundColor,
this.centerTitle,
this.searchIconPadding = const EdgeInsets.all(12.0),
+ this.pinned = false,
});
@override
@@ -86,9 +90,10 @@ class _SearchableAppBarState extends State<SearchableAppBar> {
@override
Widget build(BuildContext context) {
- final isLightMode = Theme.of(context).brightness == Brightness.light;
+ final colorScheme = getEnteColorScheme(context);
return SliverAppBar(
- floating: true,
+ floating: !widget.pinned,
+ pinned: widget.pinned,
backgroundColor:
widget.backgroundColor ?? Theme.of(context).colorScheme.surface,
surfaceTintColor: Colors.transparent,
@@ -118,19 +123,15 @@ class _SearchableAppBarState extends State<SearchableAppBar> {
actions: _isSearchActive
? null
: [
- GestureDetector(
- onTap: _activateSearch,
- child: Padding(
- padding: widget.searchIconPadding,
- child: SizedBox(
- height: 18,
- width: 18,
- child: SvgPicture.asset(
- isLightMode
- ? "assets/icons/search_icon_light.svg"
- : "assets/icons/search_icon_dark.svg",
- ),
+ Padding(
+ padding: widget.searchIconPadding,
+ child: SoftIconButton(
+ icon: HugeIcon(
+ icon: HugeIcons.strokeRoundedSearch01,
+ size: 18,
+ color: colorScheme.textBase,
),
+ onTap: _activateSearch,
),
),
...?widget.actions,
@@ -143,35 +144,25 @@ class _SearchableAppBarState extends State<SearchableAppBar> {
return Container(
key: const ValueKey('searchBar'),
alignment: Alignment.center,
- child: TextFormField(
- controller: _searchController,
+ child: TextInputWidgetV2(
+ textEditingController: _searchController,
focusNode: _searchFocusNode,
- decoration: InputDecoration(
- filled: true,
- fillColor: colorScheme.fillFaint,
- prefixIcon: Icon(
- Icons.search_rounded,
- color: colorScheme.strokeMuted,
- ),
- suffixIcon: IconButton(
- icon: Icon(
- Icons.cancel_rounded,
- color: colorScheme.strokeMuted,
- ),
- onPressed: _deactivateSearch,
- ),
- border: const UnderlineInputBorder(
- borderSide: BorderSide.none,
- ),
- contentPadding: const EdgeInsets.fromLTRB(12, 12, 0, 12),
- focusedBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: colorScheme.strokeFaint,
- ),
- borderRadius: BorderRadius.circular(8),
+ autoFocus: true,
+ shouldSurfaceExecutionStates: false,
+ leadingWidget: HugeIcon(
+ icon: HugeIcons.strokeRoundedSearch01,
+ size: 18,
+ color: colorScheme.textMuted,
+ ),
+ trailingWidget: GestureDetector(
+ onTap: _deactivateSearch,
+ child: HugeIcon(
+ icon: HugeIcons.strokeRoundedCancel01,
+ size: 18,
+ color: colorScheme.textMuted,
),
),
- onChanged: widget.onSearch,
+ onChange: widget.onSearch,
),
);
}
diff --git a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart b/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
index 2faeff6e74..2c46c55dfe 100644
--- a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
+++ b/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
@@ -1,5 +1,4 @@
import "dart:async";
-import "dart:math" as math;
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:flutter/material.dart";
@@ -26,6 +25,7 @@ import "package:photos/ui/collections/flex_grid_view.dart";
import "package:photos/ui/common/loading_widget.dart";
import "package:photos/ui/components/buttons/filter_pill_widget.dart";
import "package:photos/ui/components/buttons/soft_icon_button.dart";
+import "package:photos/ui/components/popup_menu/ente_popup_menu_button.dart";
import "package:photos/ui/components/text_input_widget_v2.dart";
import "package:photos/ui/tabs/albums/albums_manage_sheet.dart";
import "package:photos/ui/tabs/albums/empty_states/on_ente_empty_state.dart";
@@ -242,10 +242,8 @@ class _AlbumsTabState extends State<AlbumsTab>
nextDirection = _sortDirection.value == AlbumSortDirection.ascending
? AlbumSortDirection.descending
: AlbumSortDirection.ascending;
- } else if (key == AlbumSortKey.albumName) {
- nextDirection = AlbumSortDirection.ascending;
} else {
- nextDirection = AlbumSortDirection.descending;
+ nextDirection = AlbumSortDirection.ascending;
}
_sortKey.value = key;
@@ -257,154 +255,66 @@ class _AlbumsTabState extends State<AlbumsTab>
}
}
- Widget _buildAlbumsMenuRow({
- required String label,
- String? secondaryLabel,
- bool isActive = false,
- bool reserveIndicatorSpace = false,
- Widget? trailingWidget,
- }) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
- final Widget title = secondaryLabel == null
- ? Text(label, style: textTheme.mini)
- : Row(
- children: [
- Text(label, style: textTheme.mini),
- const SizedBox(width: 6),
- Text("β€’", style: textTheme.miniMuted),
- const SizedBox(width: 6),
- Text(secondaryLabel, style: textTheme.miniMuted),
- ],
- );
-
- return Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- title,
- if (trailingWidget != null)
- trailingWidget
- else if (isActive)
- HugeIcon(
- icon: _sortDirection.value == AlbumSortDirection.ascending
- ? HugeIcons.strokeRoundedArrowUp02
- : HugeIcons.strokeRoundedArrowDown02,
- size: 12,
- strokeWidth: 3,
- color: colorScheme.textMuted,
- )
- else if (reserveIndicatorSpace)
- const SizedBox(width: 12),
- ],
- );
- }
-
- Future<void> _showAlbumsMenu(TapDownDetails details) async {
+ List<EntePopupMenuOption<_AlbumsMenuAction>> _buildAlbumsMenuOptions() {
final colorScheme = getEnteColorScheme(context);
final strings = AppLocalizations.of(context);
- final overlay =
- Overlay.of(context).context.findRenderObject() as RenderBox?;
- final overlaySize = overlay?.size ?? MediaQuery.sizeOf(context);
- final left = math.max(16.0, details.globalPosition.dx - 164);
- final top = details.globalPosition.dy + 12;
- final right = math.max(
- 16.0,
- overlaySize.width - details.globalPosition.dx - 24,
- );
final isListView = _viewType.value == AlbumViewType.list;
final showSortActions = _effectiveFilter != _AlbumsFilter.onDevice;
final currentSortKey = _sortKey.value;
+ final currentSortDirection = _sortDirection.value;
final nameSortDirection =
- currentSortKey == AlbumSortKey.albumName ? _sortDirection.value : null;
-
- PopupMenuItem<_AlbumsMenuAction> item({
- required _AlbumsMenuAction value,
- required Widget child,
- bool showDivider = true,
- }) {
- return PopupMenuItem<_AlbumsMenuAction>(
- value: value,
- padding: EdgeInsets.zero,
- height: 52,
- child: Container(
- height: 52,
- padding: const EdgeInsets.symmetric(horizontal: 16),
- decoration: BoxDecoration(
- border: showDivider
- ? Border(
- bottom: BorderSide(color: colorScheme.strokeFaint),
- )
- : null,
- ),
- child: child,
- ),
- );
- }
+ currentSortKey == AlbumSortKey.albumName ? currentSortDirection : null;
+ final activeTrailingWidget = HugeIcon(
+ icon: currentSortDirection == AlbumSortDirection.ascending
+ ? HugeIcons.strokeRoundedArrowUp02
+ : HugeIcons.strokeRoundedArrowDown02,
+ size: 12,
+ strokeWidth: 3,
+ color: colorScheme.textMuted,
+ );
- final selected = await showMenu<_AlbumsMenuAction>(
- context: context,
- color: colorScheme.fill,
- elevation: 8,
- constraints: const BoxConstraints.tightFor(width: 196),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(20),
- side: BorderSide(color: colorScheme.strokeFaint),
- ),
- position: RelativeRect.fromLTRB(
- left,
- top,
- right,
- overlaySize.height - top,
+ return [
+ EntePopupMenuOption(
+ value: _AlbumsMenuAction.toggleView,
+ label: isListView ? strings.grid : strings.list,
+ showDivider: showSortActions,
+ trailingWidget: HugeIcon(
+ icon: isListView
+ ? HugeIcons.strokeRoundedGridView
+ : HugeIcons.strokeRoundedMenu01,
+ size: 12,
+ strokeWidth: 3,
+ color: colorScheme.contentLight,
+ ),
),
- items: [
- item(
- value: _AlbumsMenuAction.toggleView,
- showDivider: showSortActions,
- child: _buildAlbumsMenuRow(
- label: isListView ? strings.grid : strings.list,
- trailingWidget: HugeIcon(
- icon: isListView
- ? HugeIcons.strokeRoundedGridView
- : HugeIcons.strokeRoundedMenu01,
- size: 12,
- strokeWidth: 3,
- color: colorScheme.contentLight,
- ),
- ),
+ if (showSortActions) ...[
+ EntePopupMenuOption(
+ value: _AlbumsMenuAction.name,
+ label: strings.name,
+ secondaryLabel: nameSortDirection != AlbumSortDirection.descending
+ ? strings.sortAToZ
+ : strings.sortZToA,
+ isActive: currentSortKey == AlbumSortKey.albumName,
+ activeTrailingWidget: activeTrailingWidget,
+ ),
+ EntePopupMenuOption(
+ value: _AlbumsMenuAction.newest,
+ label: strings.newest,
+ isActive: currentSortKey == AlbumSortKey.newestPhoto,
+ activeTrailingWidget: activeTrailingWidget,
+ ),
+ EntePopupMenuOption(
+ value: _AlbumsMenuAction.updated,
+ label: strings.updated,
+ isActive: currentSortKey == AlbumSortKey.lastUpdated,
+ activeTrailingWidget: activeTrailingWidget,
+ showDivider: false,
),
- if (showSortActions) ...[
- item(
- value: _AlbumsMenuAction.name,
- child: _buildAlbumsMenuRow(
- label: strings.name,
- secondaryLabel: nameSortDirection != AlbumSortDirection.descending
- ? strings.sortAToZ
- : strings.sortZToA,
- isActive: currentSortKey == AlbumSortKey.albumName,
- reserveIndicatorSpace: true,
- ),
- ),
- item(
- value: _AlbumsMenuAction.newest,
- child: _buildAlbumsMenuRow(
- label: strings.newest,
- isActive: currentSortKey == AlbumSortKey.newestPhoto,
- reserveIndicatorSpace: true,
- ),
- ),
- item(
- value: _AlbumsMenuAction.updated,
- showDivider: false,
- child: _buildAlbumsMenuRow(
- label: strings.updated,
- isActive: currentSortKey == AlbumSortKey.lastUpdated,
- reserveIndicatorSpace: true,
- ),
- ),
- ],
],
- );
+ ];
+ }
+ Future<void> _handleAlbumsMenuSelection(_AlbumsMenuAction selected) async {
switch (selected) {
case _AlbumsMenuAction.toggleView:
await _toggleViewMode();
@@ -418,8 +328,6 @@ class _AlbumsTabState extends State<AlbumsTab>
case _AlbumsMenuAction.updated:
await _setSortMode(AlbumSortKey.lastUpdated);
break;
- case null:
- break;
}
}
@@ -522,7 +430,7 @@ class _AlbumsTabState extends State<AlbumsTab>
child: HugeIcon(
icon:
HugeIcons.strokeRoundedCancel01,
- size: 16,
+ size: 18,
color: colorScheme.textMuted,
),
),
@@ -626,14 +534,9 @@ class _AlbumsTabState extends State<AlbumsTab>
},
),
),
- SoftIconButton(
- icon: HugeIcon(
- icon: HugeIcons.strokeRoundedMoreVertical,
- size: 18,
- color: colorScheme.textBase,
- ),
- onTap: () {},
- onTapDown: _showAlbumsMenu,
+ EntePopupMenuButton<_AlbumsMenuAction>(
+ optionsBuilder: _buildAlbumsMenuOptions,
+ onSelected: _handleAlbumsMenuSelection,
),
],
),