feat: thicken the scrollbars & make 'em interactive for mobile (#764)

This commit is contained in:
Kingkor Roy Tirtho 2023-09-30 22:03:16 +06:00 committed by GitHub
parent b1d79428a3
commit 84a4bcd948
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 10 deletions

View File

@ -71,6 +71,8 @@ class TracksTableView extends HookConsumerWidget {
final searchController = useTextEditingController();
final searchFocus = useFocusNode();
final controller = useScrollController();
// this will trigger update on each change in searchController
useValueListenable(searchController);
@ -210,6 +212,7 @@ class TracksTableView extends HookConsumerWidget {
}
case "add-to-playlist":
{
if (context.mounted) {
await showDialog(
context: context,
builder: (context) {
@ -218,6 +221,7 @@ class TracksTableView extends HookConsumerWidget {
);
},
);
}
break;
}
case "play-next":
@ -348,11 +352,16 @@ class TracksTableView extends HookConsumerWidget {
if (isSliver) {
return SliverSafeArea(
top: false,
sliver: SliverList(delegate: SliverChildListDelegate(children)),
sliver: SliverList(
delegate: SliverChildListDelegate(children),
),
);
}
return SafeArea(
child: ListView(children: children),
child: ListView(
controller: controller,
children: children,
),
);
}
}

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_desktop_tools/flutter_desktop_tools.dart';
ThemeData theme(Color seed, Brightness brightness, bool isAmoled) {
final scheme = ColorScheme.fromSeed(
@ -68,5 +69,14 @@ ThemeData theme(Color seed, Brightness brightness, bool isAmoled) {
),
),
),
scrollbarTheme: DesktopTools.platform.isMobile
? const ScrollbarThemeData(
interactive: true,
thickness: MaterialStatePropertyAll(18),
minThumbLength: 20,
)
: const ScrollbarThemeData(
thickness: MaterialStatePropertyAll(14),
),
);
}