From 02e67cf3d3f32af4066ada4d5f915d6915449e12 Mon Sep 17 00:00:00 2001 From: zarzet <42882290+zarzet@users.noreply.github.com> Date: Sun, 18 Oct 2026 03:11:54 +0700 Subject: [PATCH] feat(library): add adaptive icons to collection tabs --- lib/screens/queue_tab.dart | 29 +++++++++++++++++++++-------- lib/screens/queue_tab_widgets.dart | 15 +++++++++++++++ 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/lib/screens/queue_tab.dart b/lib/screens/queue_tab.dart index d8fb9bab..b1b936dd 100644 --- a/lib/screens/queue_tab.dart +++ b/lib/screens/queue_tab.dart @@ -1609,13 +1609,18 @@ class _QueueTabState extends ConsumerState { child: LayoutBuilder( builder: (context, constraints) { final activePage = _pageIndexFor(historyFilterMode); - Widget tab(int index, String label, int? count) => - _FilterChip( - label: label, - count: count, - isSelected: activePage == index, - onTap: () => _animateToFilterPage(index), - ); + Widget tab( + int index, + IconData icon, + String label, + int? count, + ) => _FilterChip( + label: label, + icon: icon, + count: count, + isSelected: activePage == index, + onTap: () => _animateToFilterPage(index), + ); return ScrollEdgeFade( axis: Axis.horizontal, size: 48, @@ -1638,22 +1643,30 @@ class _QueueTabState extends ConsumerState { children: [ tab( 0, + Icons.music_note_outlined, context.l10n.searchSongs, queueCounts.allTrackCount, ), const SizedBox(width: 8), tab( 1, + Icons.album_outlined, context.l10n.historyFilterAlbums, queueCounts.albumCount, ), const SizedBox(width: 8), // Artist totals need a full scan; the // tab shows none rather than a guess. - tab(2, context.l10n.searchArtists, null), + tab( + 2, + Icons.person_outline, + context.l10n.searchArtists, + null, + ), const SizedBox(width: 8), tab( 3, + Icons.queue_music_outlined, context.l10n.searchPlaylists, _getVisibleCollectionEntries( collectionState, diff --git a/lib/screens/queue_tab_widgets.dart b/lib/screens/queue_tab_widgets.dart index 09bb785b..4e37a38f 100644 --- a/lib/screens/queue_tab_widgets.dart +++ b/lib/screens/queue_tab_widgets.dart @@ -45,6 +45,9 @@ class _CollectionEntry { class _FilterChip extends ConsumerWidget { final String label; + /// Leading glyph; it fills in while the tab is selected. + final IconData icon; + /// Items in the tab; null hides the count. final int? count; final bool isSelected; @@ -52,6 +55,7 @@ class _FilterChip extends ConsumerWidget { const _FilterChip({ required this.label, + required this.icon, required this.count, required this.isSelected, required this.onTap, @@ -61,10 +65,20 @@ class _FilterChip extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final colorScheme = Theme.of(context).colorScheme; final mornye = context.isMornye; + final glyph = AppIcon.adaptive( + icon, + size: 18, + fill: isSelected ? 1 : 0, + color: mornye + ? (isSelected ? colorScheme.onSurface : colorScheme.onSurfaceVariant) + : null, + ); final content = Row( mainAxisSize: MainAxisSize.min, children: [ + glyph, + const SizedBox(width: 8), Text( label, style: mornye @@ -141,6 +155,7 @@ class _FilterChip extends ConsumerWidget { return AppChoiceChip( label: Text(label), + icon: glyph, count: count, singleChoice: true, selected: isSelected,