removing animations also removes the overscroll stretch effect

This commit is contained in:
Thibault Deckers 2023-07-05 23:40:57 +02:00
parent 808d85eca0
commit 67e76d5281
2 changed files with 14 additions and 7 deletions

View file

@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
### Changed ### Changed
- Accessibility: removing animations also removes the overscroll stretch effect
- target Android 14 (API 34) - target Android 14 (API 34)
- upgraded Flutter to stable v3.10.5 - upgraded Flutter to stable v3.10.5

View file

@ -295,8 +295,7 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
...LocalizationsNn.delegates, ...LocalizationsNn.delegates,
], ],
supportedLocales: AvesApp.supportedLocales, supportedLocales: AvesApp.supportedLocales,
// TODO TLAD remove custom scroll behavior when this is fixed: https://github.com/flutter/flutter/issues/82906 scrollBehavior: AvesScrollBehavior(),
scrollBehavior: StretchMaterialScrollBehavior(),
), ),
), ),
); );
@ -633,13 +632,20 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
void _onError(String? error) => reportService.recordError(error, null); void _onError(String? error) => reportService.recordError(error, null);
} }
class StretchMaterialScrollBehavior extends MaterialScrollBehavior { class AvesScrollBehavior extends MaterialScrollBehavior {
@override @override
Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) { Widget buildOverscrollIndicator(BuildContext context, Widget child, ScrollableDetails details) {
return StretchingOverscrollIndicator( final animate = context.select<Settings, bool>((v) => v.accessibilityAnimations.animate);
axisDirection: details.direction, return animate
child: child, ? StretchingOverscrollIndicator(
); axisDirection: details.direction,
child: child,
)
: GlowingOverscrollIndicator(
axisDirection: details.direction,
color: Colors.white,
child: child,
);
} }
} }