feat(search): horizontal swipe scroll support for Desktop platform

This commit is contained in:
Kingkor Roy Tirtho 2022-09-13 09:42:31 +06:00
parent 427954150a
commit d5ff927c72

View File

@ -1,3 +1,4 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart' hide Page;
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
@ -147,7 +148,15 @@ class Search extends HookConsumerWidget {
style: Theme.of(context).textTheme.headline5,
),
const SizedBox(height: 10),
Scrollbar(
ScrollConfiguration(
behavior:
ScrollConfiguration.of(context).copyWith(
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
},
),
child: Scrollbar(
controller: albumController,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
@ -163,6 +172,7 @@ class Search extends HookConsumerWidget {
),
),
),
),
const SizedBox(height: 20),
if (artists.isNotEmpty)
Text(
@ -170,7 +180,15 @@ class Search extends HookConsumerWidget {
style: Theme.of(context).textTheme.headline5,
),
const SizedBox(height: 10),
Scrollbar(
ScrollConfiguration(
behavior:
ScrollConfiguration.of(context).copyWith(
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
},
),
child: Scrollbar(
controller: artistController,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
@ -188,6 +206,7 @@ class Search extends HookConsumerWidget {
),
),
),
),
const SizedBox(height: 20),
if (playlists.isNotEmpty)
Text(
@ -195,8 +214,17 @@ class Search extends HookConsumerWidget {
style: Theme.of(context).textTheme.headline5,
),
const SizedBox(height: 10),
Scrollbar(
scrollbarOrientation: breakpoint > Breakpoints.md
ScrollConfiguration(
behavior:
ScrollConfiguration.of(context).copyWith(
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
},
),
child: Scrollbar(
scrollbarOrientation:
breakpoint > Breakpoints.md
? ScrollbarOrientation.bottom
: ScrollbarOrientation.top,
controller: playlistController,
@ -212,6 +240,7 @@ class Search extends HookConsumerWidget {
),
),
),
),
],
),
),