mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-04-13 16:31:01 +00:00
Refactor scroll behavior to improve accessibility and support for various input devices
This commit is contained in:
parent
ef47210af8
commit
2b8625bf0e
1 changed files with 13 additions and 2 deletions
|
|
@ -118,7 +118,7 @@ class _MyAppState extends ConsumerState<MyApp> {
|
|||
routerDelegate: router.routerDelegate,
|
||||
routeInformationProvider: router.routeInformationProvider,
|
||||
title: 'MangaYomi',
|
||||
scrollBehavior: AllowDesktopScrollBehavior(),
|
||||
scrollBehavior: AllowScrollBehavior(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -233,10 +233,21 @@ class _MyAppState extends ConsumerState<MyApp> {
|
|||
}
|
||||
}
|
||||
|
||||
class AllowDesktopScrollBehavior extends MaterialScrollBehavior {
|
||||
class AllowScrollBehavior extends MaterialScrollBehavior {
|
||||
// This allows the scrollable widgets to be scrolled with touch, mouse, stylus,
|
||||
// inverted stylus, trackpad, and unknown pointer devices.
|
||||
// This is useful for accessibility purposes, such as when using VoiceAccess,
|
||||
// which sends pointer events with unknown type when scrolling scrollables.
|
||||
// This is also useful for desktop platforms, where touch, stylus, and trackpad
|
||||
// interactions are common, and we want to ensure a consistent scrolling experience
|
||||
// across all devices.
|
||||
@override
|
||||
Set<PointerDeviceKind> get dragDevices => {
|
||||
PointerDeviceKind.touch,
|
||||
PointerDeviceKind.mouse,
|
||||
PointerDeviceKind.stylus,
|
||||
PointerDeviceKind.invertedStylus,
|
||||
PointerDeviceKind.trackpad,
|
||||
PointerDeviceKind.unknown,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue