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