chore: fix adaptive select tile scrolling not working

This commit is contained in:
Kingkor Roy Tirtho 2025-02-23 11:33:44 +06:00
parent 47edb8bf96
commit edc9636940
10 changed files with 58 additions and 65 deletions

View File

@ -27,7 +27,7 @@
<!-- Enable Impeller -->
<!-- <meta-data
android:name="io.flutter.embedding.android.EnableImpeller"
android:value="true" /> -->
android:value="false" /> -->
<activity
android:name="com.ryanheise.audioservice.AudioServiceActivity"

View File

@ -44,7 +44,7 @@ class AdaptiveSelectTile<T> 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<T>(
itemBuilder: (context, item) {
@ -83,7 +83,8 @@ class AdaptiveSelectTile<T> extends HookWidget {
context: context,
builder: (context) {
return AlertDialog(
content: ListView.builder(
content: Flexible(
child: ListView.builder(
shrinkWrap: true,
itemCount: options.length,
itemBuilder: (context, index) {
@ -102,6 +103,7 @@ class AdaptiveSelectTile<T> extends HookWidget {
);
},
),
),
);
},
);

View File

@ -71,10 +71,8 @@ class Sidebar extends HookConsumerWidget {
tooltip: TooltipContainer(child: Text(tile.title)),
child: Icon(tile.icon),
),
onChanged: (value) {
if (value) {
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) {
onPressed: () {
context.navigateTo(tile.route);
}
},
child: Tooltip(
tooltip: TooltipContainer(child: Text(tile.title)),

View File

@ -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);
},
)
],
),

View File

@ -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,
),
],
),

View File

@ -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);
},
),
],
),

View File

@ -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)),
],
),
);

View File

@ -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(),

View File

@ -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"

View File

@ -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