From 3f0342b6cb2264e1f9920498bf5dd06e8b52227a Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Wed, 30 Aug 2023 22:50:23 -0400 Subject: [PATCH] feat: match android navigation bar color to app bottom nav --- lib/src/layouts/app_page.dart | 11 +---------- lib/src/screens/home/index.dart | 3 ++- lib/src/utils/theme.dart | 14 ++++++++++++-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/src/layouts/app_page.dart b/lib/src/layouts/app_page.dart index 1ecbb29..0d32db1 100644 --- a/lib/src/layouts/app_page.dart +++ b/lib/src/layouts/app_page.dart @@ -57,16 +57,7 @@ class _AppPageLayoutState extends State { Widget build(BuildContext context) { return Scaffold( body: AnnotatedRegion( - value: SystemUiOverlayStyle( - statusBarColor: Colors.transparent, - systemNavigationBarContrastEnforced: true, - statusBarIconBrightness: widget.darkStatusBar - ? Brightness.dark - : Brightness.light, - statusBarBrightness: widget.darkStatusBar - ? Brightness.light - : Brightness.dark, - ), + value: constructOverlayStyle(dark: widget.darkStatusBar), child: Container( color: widget.backgroundColor ?? Colors.grey[100], child: SafeArea( diff --git a/lib/src/screens/home/index.dart b/lib/src/screens/home/index.dart index 86a7c46..189d452 100644 --- a/lib/src/screens/home/index.dart +++ b/lib/src/screens/home/index.dart @@ -4,6 +4,7 @@ import 'package:flutter/services.dart'; import 'package:furman_now/src/routes/index.gr.dart'; import 'package:furman_now/src/screens/home/content.dart'; import 'package:furman_now/src/screens/home/state.dart'; +import 'package:furman_now/src/utils/theme.dart'; import 'package:provider/provider.dart'; class HomeScreenProvider extends StatelessWidget { @@ -101,7 +102,7 @@ class _HomeScreenState extends State { Widget build(BuildContext context) { return Scaffold( body: AnnotatedRegion( - value: SystemUiOverlayStyle.light, + value: constructOverlayStyle(), child: Container( color: const Color(0xffb7acc9), child: SafeArea( diff --git a/lib/src/utils/theme.dart b/lib/src/utils/theme.dart index 3c062ec..e7bb982 100644 --- a/lib/src/utils/theme.dart +++ b/lib/src/utils/theme.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:google_fonts/google_fonts.dart'; ThemeData _baseTheme = ThemeData( @@ -47,5 +48,14 @@ ThemeData myFurmanTheme = _baseTheme.copyWith( textTheme: GoogleFonts.interTextTheme(_baseTheme.textTheme), ); -var furmanTextStyle = (TextStyle baseStyle) => - GoogleFonts.inter(textStyle: baseStyle); +var furmanTextStyle = + (TextStyle baseStyle) => GoogleFonts.inter(textStyle: baseStyle); + +SystemUiOverlayStyle constructOverlayStyle({bool dark = false}) { + return SystemUiOverlayStyle( + statusBarColor: Colors.transparent, + systemNavigationBarContrastEnforced: true, + statusBarIconBrightness: dark ? Brightness.dark : Brightness.light, + statusBarBrightness: dark ? Brightness.light : Brightness.dark, + systemNavigationBarColor: Colors.grey.shade50); +}