diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 8c676896..0effefe2 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -26,8 +26,8 @@ android:usesCleartextTraffic="true"> + android:name="io.flutter.embedding.android.EnableImpeller" + android:value="false" /> --> extends HookWidget { @override Widget build(BuildContext context) { final theme = Theme.of(context); - final mediaQuery = MediaQuery.of(context); + final mediaQuery = MediaQuery.sizeOf(context); Widget? control = Select( itemBuilder: (context, item) { @@ -83,24 +83,26 @@ class AdaptiveSelectTile extends HookWidget { context: context, builder: (context) { return AlertDialog( - content: ListView.builder( - shrinkWrap: true, - itemCount: options.length, - itemBuilder: (context, index) { - final item = options[index]; + content: Flexible( + child: ListView.builder( + shrinkWrap: true, + itemCount: options.length, + itemBuilder: (context, index) { + final item = options[index]; - return ListTile( - iconColor: theme.colorScheme.primary, - leading: item.value == value - ? const Icon(SpotubeIcons.radioChecked) - : const Icon(SpotubeIcons.radioUnchecked), - title: item.child, - onTap: () { - onChanged?.call(item.value); - Navigator.of(context).pop(); - }, - ); - }, + return ListTile( + iconColor: theme.colorScheme.primary, + leading: item.value == value + ? const Icon(SpotubeIcons.radioChecked) + : const Icon(SpotubeIcons.radioUnchecked), + title: item.child, + onTap: () { + onChanged?.call(item.value); + Navigator.of(context).pop(); + }, + ); + }, + ), ), ); }, diff --git a/lib/modules/root/sidebar/sidebar.dart b/lib/modules/root/sidebar/sidebar.dart index 1149bd00..743b339b 100644 --- a/lib/modules/root/sidebar/sidebar.dart +++ b/lib/modules/root/sidebar/sidebar.dart @@ -71,10 +71,8 @@ class Sidebar extends HookConsumerWidget { tooltip: TooltipContainer(child: Text(tile.title)), child: Icon(tile.icon), ), - onChanged: (value) { - if (value) { - context.navigateTo(tile.route); - } + onPressed: () { + context.navigateTo(tile.route); }, ), const NavigationDivider(), @@ -83,10 +81,8 @@ class Sidebar extends HookConsumerWidget { for (final tile in sidebarLibraryTileList) NavigationButton( label: mediaQuery.lgAndUp ? Text(tile.title) : null, - onChanged: (value) { - if (value) { - context.navigateTo(tile.route); - } + onPressed: () { + context.navigateTo(tile.route); }, child: Tooltip( tooltip: TooltipContainer(child: Text(tile.title)), diff --git a/lib/modules/root/spotube_navigation_bar.dart b/lib/modules/root/spotube_navigation_bar.dart index 9dc02378..15417fa6 100644 --- a/lib/modules/root/spotube_navigation_bar.dart +++ b/lib/modules/root/spotube_navigation_bar.dart @@ -61,20 +61,20 @@ class SpotubeNavigationBar extends HookConsumerWidget { index: selectedIndex, surfaceBlur: context.theme.surfaceBlur, surfaceOpacity: context.theme.surfaceOpacity, - onSelected: (i) { - context.navigateTo(navbarTileList[i].route); - }, children: [ for (final tile in navbarTileList) NavigationButton( - style: const ButtonStyle.muted(density: ButtonDensity.icon), - selectedStyle: - const ButtonStyle.fixed(density: ButtonDensity.icon), + style: navbarTileList[selectedIndex] == tile + ? const ButtonStyle.fixed(density: ButtonDensity.icon) + : const ButtonStyle.muted(density: ButtonDensity.icon), child: Badge( isLabelVisible: tile.id == "library" && downloadCount > 0, label: Text(downloadCount.toString()), child: Icon(tile.icon), ), + onPressed: () { + context.navigateTo(tile.route); + }, ) ], ), diff --git a/lib/modules/stats/top/top.dart b/lib/modules/stats/top/top.dart index 1df2b7e9..2834ce1e 100644 --- a/lib/modules/stats/top/top.dart +++ b/lib/modules/stats/top/top.dart @@ -63,18 +63,18 @@ class StatsPageTopSection extends HookConsumerWidget { children: [ TabList( index: selectedIndex.value, + onChanged: (value) { + selectedIndex.value = value; + }, children: [ - TabButton( + TabItem( child: Text(context.l10n.top_tracks), - onPressed: () => selectedIndex.value = 0, ), - TabButton( + TabItem( child: Text(context.l10n.top_artists), - onPressed: () => selectedIndex.value = 1, ), - TabButton( + TabItem( child: Text(context.l10n.top_albums), - onPressed: () => selectedIndex.value = 2, ), ], ), diff --git a/lib/pages/library/library.dart b/lib/pages/library/library.dart index 359cc609..a115112c 100644 --- a/lib/pages/library/library.dart +++ b/lib/pages/library/library.dart @@ -53,18 +53,18 @@ class LibraryPage extends HookConsumerWidget { scrollDirection: Axis.horizontal, child: TabList( index: index, + onChanged: (index) { + context.navigateTo(sidebarLibraryTileList[index].route); + }, children: [ for (final tile in sidebarLibraryTileList) - TabButton( + TabItem( child: Badge( isLabelVisible: tile.id == 'downloads' && downloadingCount > 0, label: Text(downloadingCount.toString()), child: Text(tile.title), ), - onPressed: () { - context.navigateTo(tile.route); - }, ), ], ), diff --git a/lib/pages/lyrics/lyrics.dart b/lib/pages/lyrics/lyrics.dart index ab8782a8..a42ac43a 100644 --- a/lib/pages/lyrics/lyrics.dart +++ b/lib/pages/lyrics/lyrics.dart @@ -41,13 +41,12 @@ class LyricsPage extends HookConsumerWidget { child: isModal ? TabList( index: selectedIndex.value, + onChanged: (index) => selectedIndex.value = index, children: [ - TabButton( - onPressed: () => selectedIndex.value = 0, + TabItem( child: Text(context.l10n.synced), ), - TabButton( - onPressed: () => selectedIndex.value = 1, + TabItem( child: Text(context.l10n.plain), ), ], @@ -55,9 +54,9 @@ class LyricsPage extends HookConsumerWidget { : Tabs( index: selectedIndex.value, onChanged: (index) => selectedIndex.value = index, - tabs: [ - Text(context.l10n.synced), - Text(context.l10n.plain), + children: [ + TabItem(child: Text(context.l10n.synced)), + TabItem(child: Text(context.l10n.plain)), ], ), ); diff --git a/lib/pages/lyrics/mini_lyrics.dart b/lib/pages/lyrics/mini_lyrics.dart index bb879888..3e50987d 100644 --- a/lib/pages/lyrics/mini_lyrics.dart +++ b/lib/pages/lyrics/mini_lyrics.dart @@ -81,9 +81,9 @@ class MiniLyricsPage extends HookConsumerWidget { onChanged: (i) { index.value = i; }, - tabs: [ - Text(context.l10n.synced), - Text(context.l10n.plain), + children: [ + TabItem(child: Text(context.l10n.synced)), + TabItem(child: Text(context.l10n.plain)), ], ), const Spacer(), diff --git a/pubspec.lock b/pubspec.lock index c7ec008b..5b92f19e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -2011,12 +2011,11 @@ packages: shadcn_flutter: dependency: "direct main" description: - path: "." - ref: d928e73cd734582046c63a3bed99cc42aeab6085 - resolved-ref: d928e73cd734582046c63a3bed99cc42aeab6085 - url: "https://github.com/KRTirtho/shadcn_flutter.git" - source: git - version: "0.0.24" + name: shadcn_flutter + sha256: a04b6ce51ff8486fe9c0c3b373605ab30b823507a79a4458fc74b056edc883d8 + url: "https://pub.dev" + source: hosted + version: "0.0.25" shared_preferences: dependency: "direct main" description: @@ -2754,4 +2753,4 @@ packages: version: "1.0.0" sdks: dart: ">=3.7.0-0 <4.0.0" - flutter: ">=3.27.0" + flutter: ">=3.29.0" diff --git a/pubspec.yaml b/pubspec.yaml index 312d39d5..89d09e22 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -104,10 +104,7 @@ dependencies: ref: dart-3-support url: https://github.com/KRTirtho/scrobblenaut.git scroll_to_index: ^3.0.1 - shadcn_flutter: - git: - url: https://github.com/KRTirtho/shadcn_flutter.git - ref: d928e73cd734582046c63a3bed99cc42aeab6085 + shadcn_flutter: ^0.0.25 shared_preferences: ^2.2.3 shelf: ^1.4.1 shelf_router: ^1.1.4