mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-20 22:41:38 +02:00
feat(library): add adaptive icons to collection tabs
This commit is contained in:
1 parent
759079517c
commit
02e67cf3d3
2 files changed
+36
-8
No files matched your search
@@ -1609,13 +1609,18 @@ class _QueueTabState extends ConsumerState<QueueTab> {
|
||||
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<QueueTab> {
|
||||
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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user