Skip to content

Commit

Permalink
feat: thicken the scrollbars & make 'em interactive for mobile (#764)
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho authored Sep 30, 2023
1 parent b1d7942 commit 84a4bcd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
29 changes: 19 additions & 10 deletions lib/components/shared/track_table/tracks_table_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -210,14 +212,16 @@ class TracksTableView extends HookConsumerWidget {
}
case "add-to-playlist":
{
await showDialog(
context: context,
builder: (context) {
return PlaylistAddTrackDialog(
tracks: selectedTracks.toList(),
);
},
);
if (context.mounted) {
await showDialog(
context: context,
builder: (context) {
return PlaylistAddTrackDialog(
tracks: selectedTracks.toList(),
);
},
);
}
break;
}
case "play-next":
Expand Down Expand Up @@ -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,
),
);
}
}
10 changes: 10 additions & 0 deletions lib/themes/theme.dart
Original file line number Diff line number Diff line change
@@ -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(
Expand Down Expand Up @@ -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),
),
);
}

0 comments on commit 84a4bcd

Please sign in to comment.