From 61c93926af244eaeda33130c5b674e9a631612c1 Mon Sep 17 00:00:00 2001 From: Micah Morrison Date: Wed, 27 Nov 2024 14:02:21 -0500 Subject: [PATCH 1/2] Fix system navbar color --- lib/main.dart | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 67513e0b0..a7118cfc7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -244,25 +244,30 @@ class _ThunderAppState extends State { Locale? locale = AppLocalizations.supportedLocales.where((Locale locale) => locale.languageCode == thunderBloc.state.appLanguageCode).firstOrNull; return OverlaySupport.global( - child: MaterialApp.router( - title: 'Thunder', - locale: locale, - localizationsDelegates: const [ - ...AppLocalizations.localizationsDelegates, - MaterialLocalizationsEo.delegate, - CupertinoLocalizationsEo.delegate, - ], - supportedLocales: const [ - ...AppLocalizations.supportedLocales, - Locale('eo'), // Additional locale which is not officially supported: Esperanto - ], - routerConfig: router, - themeMode: state.themeType == ThemeType.system ? ThemeMode.system : (state.themeType == ThemeType.light ? ThemeMode.light : ThemeMode.dark), - theme: theme, - darkTheme: darkTheme, - debugShowCheckedModeBanner: false, - scaffoldMessengerKey: GlobalContext.scaffoldMessengerKey, - scrollBehavior: (state.reduceAnimations && Platform.isAndroid) ? const ScrollBehavior().copyWith(overscroll: false) : null, + child: AnnotatedRegion( + value: SystemUiOverlayStyle( + systemNavigationBarColor: Colors.black.withOpacity(0.0001), + ), + child: MaterialApp.router( + title: 'Thunder', + locale: locale, + localizationsDelegates: const [ + ...AppLocalizations.localizationsDelegates, + MaterialLocalizationsEo.delegate, + CupertinoLocalizationsEo.delegate, + ], + supportedLocales: const [ + ...AppLocalizations.supportedLocales, + Locale('eo'), // Additional locale which is not officially supported: Esperanto + ], + routerConfig: router, + themeMode: state.themeType == ThemeType.system ? ThemeMode.system : (state.themeType == ThemeType.light ? ThemeMode.light : ThemeMode.dark), + theme: theme, + darkTheme: darkTheme, + debugShowCheckedModeBanner: false, + scaffoldMessengerKey: GlobalContext.scaffoldMessengerKey, + scrollBehavior: (state.reduceAnimations && Platform.isAndroid) ? const ScrollBehavior().copyWith(overscroll: false) : null, + ), ), ); }, From e91b8e0b136989127ac30a54a2dafc7d8d17191b Mon Sep 17 00:00:00 2001 From: Micah Morrison Date: Wed, 27 Nov 2024 15:12:44 -0500 Subject: [PATCH 2/2] Use FlexColorScheme to set the transparent nav bar --- lib/main.dart | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index a7118cfc7..cf878021a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -234,20 +234,12 @@ class _ThunderAppState extends State { theme = theme.copyWith(pageTransitionsTheme: pageTransitionsTheme); darkTheme = darkTheme.copyWith(pageTransitionsTheme: pageTransitionsTheme); - // Set navigation bar color on Android to be transparent - SystemChrome.setSystemUIOverlayStyle( - SystemUiOverlayStyle( - systemNavigationBarColor: Colors.black.withOpacity(0.0001), - ), - ); - Locale? locale = AppLocalizations.supportedLocales.where((Locale locale) => locale.languageCode == thunderBloc.state.appLanguageCode).firstOrNull; return OverlaySupport.global( child: AnnotatedRegion( - value: SystemUiOverlayStyle( - systemNavigationBarColor: Colors.black.withOpacity(0.0001), - ), + // Set navigation bar color on Android to be transparent + value: FlexColorScheme.themedSystemNavigationBar(context, systemNavBarStyle: FlexSystemNavBarStyle.transparent), child: MaterialApp.router( title: 'Thunder', locale: locale,