From 2b8625bf0e95c2cb368317f7843d3e07b3fdb1a5 Mon Sep 17 00:00:00 2001 From: Moustapha Kodjo Amadou <107993382+kodjodevf@users.noreply.github.com> Date: Fri, 20 Jun 2025 16:51:14 +0100 Subject: [PATCH 1/2] Refactor scroll behavior to improve accessibility and support for various input devices --- lib/main.dart | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index fb084e3c..6bfb8d67 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -118,7 +118,7 @@ class _MyAppState extends ConsumerState { routerDelegate: router.routerDelegate, routeInformationProvider: router.routeInformationProvider, title: 'MangaYomi', - scrollBehavior: AllowDesktopScrollBehavior(), + scrollBehavior: AllowScrollBehavior(), ); } @@ -233,10 +233,21 @@ class _MyAppState extends ConsumerState { } } -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 get dragDevices => { PointerDeviceKind.touch, PointerDeviceKind.mouse, + PointerDeviceKind.stylus, + PointerDeviceKind.invertedStylus, + PointerDeviceKind.trackpad, + PointerDeviceKind.unknown, }; } From a5168a6a2bd87adeeab56d49c626c94657e11859 Mon Sep 17 00:00:00 2001 From: NBA2K1 <78034913+NBA2K1@users.noreply.github.com> Date: Fri, 20 Jun 2025 21:50:47 +0200 Subject: [PATCH 2/2] Release file lock by closing InputStream Fix issue where backup file remained locked by closing InputStream after use --- lib/modules/more/data_and_storage/providers/restore.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/modules/more/data_and_storage/providers/restore.dart b/lib/modules/more/data_and_storage/providers/restore.dart index 1021bde7..932b259f 100644 --- a/lib/modules/more/data_and_storage/providers/restore.dart +++ b/lib/modules/more/data_and_storage/providers/restore.dart @@ -62,6 +62,8 @@ void doRestore(Ref ref, {required String path, required BuildContext context}) { } } catch (e, s) { botToast('$e\n$s'); + } finally { + inputStream.close(); } } @@ -379,9 +381,9 @@ void restoreKotatsuBackup(Ref ref, Archive archive) { @riverpod void restoreTachiBkBackup(Ref ref, String path, BackupType bkType) { - final content = GZipDecoder().decodeBytes( - InputFileStream(path).toUint8List(), - ); + final inputStream = InputFileStream(path); + final content = GZipDecoder().decodeBytes(inputStream.toUint8List()); + inputStream.close(); final backup = BackupMihon.fromBuffer(content); List cats = []; isar.writeTxnSync(() {