Skip to content

Commit d8bb721

Browse files
authored
Fix system navigation bar color (#1614)
* Fix system navbar color * Use FlexColorScheme to set the transparent nav bar
1 parent 0bcd924 commit d8bb721

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed

lib/main.dart

+23-26
Original file line numberDiff line numberDiff line change
@@ -234,35 +234,32 @@ class _ThunderAppState extends State<ThunderApp> {
234234
theme = theme.copyWith(pageTransitionsTheme: pageTransitionsTheme);
235235
darkTheme = darkTheme.copyWith(pageTransitionsTheme: pageTransitionsTheme);
236236

237-
// Set navigation bar color on Android to be transparent
238-
SystemChrome.setSystemUIOverlayStyle(
239-
SystemUiOverlayStyle(
240-
systemNavigationBarColor: Colors.black.withOpacity(0.0001),
241-
),
242-
);
243-
244237
Locale? locale = AppLocalizations.supportedLocales.where((Locale locale) => locale.languageCode == thunderBloc.state.appLanguageCode).firstOrNull;
245238

246239
return OverlaySupport.global(
247-
child: MaterialApp.router(
248-
title: 'Thunder',
249-
locale: locale,
250-
localizationsDelegates: const [
251-
...AppLocalizations.localizationsDelegates,
252-
MaterialLocalizationsEo.delegate,
253-
CupertinoLocalizationsEo.delegate,
254-
],
255-
supportedLocales: const [
256-
...AppLocalizations.supportedLocales,
257-
Locale('eo'), // Additional locale which is not officially supported: Esperanto
258-
],
259-
routerConfig: router,
260-
themeMode: state.themeType == ThemeType.system ? ThemeMode.system : (state.themeType == ThemeType.light ? ThemeMode.light : ThemeMode.dark),
261-
theme: theme,
262-
darkTheme: darkTheme,
263-
debugShowCheckedModeBanner: false,
264-
scaffoldMessengerKey: GlobalContext.scaffoldMessengerKey,
265-
scrollBehavior: (state.reduceAnimations && Platform.isAndroid) ? const ScrollBehavior().copyWith(overscroll: false) : null,
240+
child: AnnotatedRegion<SystemUiOverlayStyle>(
241+
// Set navigation bar color on Android to be transparent
242+
value: FlexColorScheme.themedSystemNavigationBar(context, systemNavBarStyle: FlexSystemNavBarStyle.transparent),
243+
child: MaterialApp.router(
244+
title: 'Thunder',
245+
locale: locale,
246+
localizationsDelegates: const [
247+
...AppLocalizations.localizationsDelegates,
248+
MaterialLocalizationsEo.delegate,
249+
CupertinoLocalizationsEo.delegate,
250+
],
251+
supportedLocales: const [
252+
...AppLocalizations.supportedLocales,
253+
Locale('eo'), // Additional locale which is not officially supported: Esperanto
254+
],
255+
routerConfig: router,
256+
themeMode: state.themeType == ThemeType.system ? ThemeMode.system : (state.themeType == ThemeType.light ? ThemeMode.light : ThemeMode.dark),
257+
theme: theme,
258+
darkTheme: darkTheme,
259+
debugShowCheckedModeBanner: false,
260+
scaffoldMessengerKey: GlobalContext.scaffoldMessengerKey,
261+
scrollBehavior: (state.reduceAnimations && Platform.isAndroid) ? const ScrollBehavior().copyWith(overscroll: false) : null,
262+
),
266263
),
267264
);
268265
},

0 commit comments

Comments
 (0)