accessibility: disable accessibility nav in app media query

This commit is contained in:
Thibault Deckers 2023-03-03 18:17:51 +01:00
parent cd343a743a
commit bed111a165
3 changed files with 34 additions and 18 deletions

View file

@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
### Fixed ### Fixed
- Accessibility: using accessibility services keeping snack bar beyond countdown
- Accessibility: navigation with TalkBack - Accessibility: navigation with TalkBack
## <a id="v1.8.2"></a>[v1.8.2] - 2023-02-28 ## <a id="v1.8.2"></a>[v1.8.2] - 2023-02-28

View file

@ -161,7 +161,7 @@ class _BugReportState extends State<BugReport> with FeedbackMixin {
'System locales: ${WidgetsBinding.instance.window.locales.join(', ')}', 'System locales: ${WidgetsBinding.instance.window.locales.join(', ')}',
'Aves locale: ${settings.locale ?? 'system'} -> ${settings.appliedLocale}', 'Aves locale: ${settings.locale ?? 'system'} -> ${settings.appliedLocale}',
'Installer: ${packageInfo.installerStore}', 'Installer: ${packageInfo.installerStore}',
'Accessibility: accessibleNavigation=${accessibility.accessibleNavigation}, disableAnimations=${accessibility.disableAnimations}', 'Error reporting: ${settings.isErrorReportingAllowed}',
].join('\n'); ].join('\n');
} }

View file

@ -247,24 +247,39 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
// handle Android TV remote `select` button // handle Android TV remote `select` button
LogicalKeySet(LogicalKeyboardKey.select): const ActivateIntent(), LogicalKeySet(LogicalKeyboardKey.select): const ActivateIntent(),
}, },
child: MaterialApp( child: MediaQuery.fromWindow(
navigatorKey: AvesApp.navigatorKey, child: Builder(
home: home, builder: (context) {
navigatorObservers: _navigatorObservers, return MediaQuery(
builder: (context, child) => _decorateAppChild( data: MediaQuery.of(context).copyWith(
context: context, // disable accessible navigation, as it impacts snack bar action timer
initialized: initialized, // for all users of apps registered as accessibility services,
child: child, // even though they are not for accessibility purposes (like TalkBack is)
accessibleNavigation: false,
),
child: MaterialApp(
navigatorKey: AvesApp.navigatorKey,
home: home,
navigatorObservers: _navigatorObservers,
builder: (context, child) => _decorateAppChild(
context: context,
initialized: initialized,
child: child,
),
onGenerateTitle: (context) => context.l10n.appName,
theme: lightTheme,
darkTheme: darkTheme,
themeMode: themeBrightness.appThemeMode,
locale: settingsLocale,
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AvesApp.supportedLocales,
// TODO TLAD remove custom scroll behavior when this is fixed: https://github.com/flutter/flutter/issues/82906
scrollBehavior: StretchMaterialScrollBehavior(),
useInheritedMediaQuery: true,
),
);
},
), ),
onGenerateTitle: (context) => context.l10n.appName,
theme: lightTheme,
darkTheme: darkTheme,
themeMode: themeBrightness.appThemeMode,
locale: settingsLocale,
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AvesApp.supportedLocales,
// TODO TLAD remove custom scroll behavior when this is fixed: https://github.com/flutter/flutter/issues/82906
scrollBehavior: StretchMaterialScrollBehavior(),
), ),
); );
}, },