Skip to content

Commit

Permalink
fix: search page vertical scrollbar moves on horizontal scroll #1017
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Jan 5, 2024
1 parent 988a975 commit c203ac6
Showing 1 changed file with 45 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,48 +55,52 @@ class HorizontalPlaybuttonCardView<T> extends HookWidget {
),
SizedBox(
height: height,
child: ScrollConfiguration(
behavior: ScrollConfiguration.of(context).copyWith(
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
},
),
child: items.isEmpty
? ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: 5,
itemBuilder: (context, index) {
return AlbumCard(FakeData.albumSimple);
},
)
: InfiniteList(
scrollController: scrollController,
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.symmetric(vertical: 8.0),
itemCount: items.length,
onFetchData: onFetchMore,
loadingBuilder: (context) => Skeletonizer(
enabled: true,
child: AlbumCard(FakeData.albumSimple),
),
isLoading: isLoadingNextPage,
hasReachedMax: !hasNextPage,
itemBuilder: (context, index) {
final item = items[index];

return switch (item.runtimeType) {
PlaylistSimple =>
PlaylistCard(item as PlaylistSimple),
Album => AlbumCard(item as Album),
Artist => Padding(
padding:
const EdgeInsets.symmetric(horizontal: 12.0),
child: ArtistCard(item as Artist),
child: NotificationListener(
// disable multiple scrollbar to use this
onNotification: (notification) => true,
child: ScrollConfiguration(
behavior: ScrollConfiguration.of(context).copyWith(
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
},
),
child: items.isEmpty
? ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: 5,
itemBuilder: (context, index) {
return AlbumCard(FakeData.albumSimple);
},
)
: InfiniteList(
scrollController: scrollController,
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.symmetric(vertical: 8.0),
itemCount: items.length,
onFetchData: onFetchMore,
loadingBuilder: (context) => Skeletonizer(
enabled: true,
child: AlbumCard(FakeData.albumSimple),
),
_ => const SizedBox.shrink(),
};
}),
isLoading: isLoadingNextPage,
hasReachedMax: !hasNextPage,
itemBuilder: (context, index) {
final item = items[index];

return switch (item.runtimeType) {
PlaylistSimple =>
PlaylistCard(item as PlaylistSimple),
Album => AlbumCard(item as Album),
Artist => Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12.0),
child: ArtistCard(item as Artist),
),
_ => const SizedBox.shrink(),
};
}),
),
),
),
],
Expand Down

0 comments on commit c203ac6

Please sign in to comment.