Shadow from notification in flutter - android

I have made
appbar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0
),
Still I'm getting this
How to get that seamless transition between the Scaffold and the notification center?

Use this if you want your application to use transparent statusbar. Transparent status bar in flutter
#override
Widget build(BuildContext context) {
return AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
),
child: MaterialApp(
title: 'Test',
);
}

Related

Android status bar color in flutter [duplicate]

I am trying to change the status bar color to white. I found this pub on flutter. I tried to use the example code on my dart files.
Update Flutter 2.0 (Recommended):
On latest Flutter version, you should use:
AppBar(
systemOverlayStyle: SystemUiOverlayStyle(
// Status bar color
statusBarColor: Colors.red,
// Status bar brightness (optional)
statusBarIconBrightness: Brightness.dark, // For Android (dark icons)
statusBarBrightness: Brightness.light, // For iOS (dark icons)
),
)
Only Android (more flexibility):
import 'package:flutter/services.dart';
void main() {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
systemNavigationBarColor: Colors.blue, // navigation bar color
statusBarColor: Colors.pink, // status bar color
));
}
Both iOS and Android:
appBar: AppBar(
backgroundColor: Colors.red, // Status bar color
)
A bit hacky but works on both iOS and Android:
Container(
color: Colors.red, // Status bar color
child: SafeArea(
left: false,
right: false,
bottom: false,
child: Scaffold(
appBar: AppBar(
backgroundColor: Colors.blue, // App bar color
),
),
),
)
Works totally fine in my app
import 'package:flutter_statusbarcolor/flutter_statusbarcolor.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
FlutterStatusbarcolor.setStatusBarColor(Colors.white);
return MaterialApp(
title: app_title,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: HomePage(title: home_title),
);
}
}
(this package)
UPD:
Recommended solution (Flutter 2.0 and above)
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.white
));
For those who uses AppBar
If you use AppBar then updating status bar color is as simple as this:
Scaffold(
appBar: AppBar(
// Use [Brightness.light] for black status bar
// or [Brightness.dark] for white status bar
// https://stackoverflow.com/a/58132007/1321917
brightness: Brightness.light
),
body: ...
)
To apply for all app bars:
return MaterialApp(
theme: Theme.of(context).copyWith(
appBarTheme: Theme.of(context)
.appBarTheme
.copyWith(brightness: Brightness.light),
...
),
For those who don't use AppBar
Wrap your content with AnnotatedRegion and set value to SystemUiOverlayStyle.light or SystemUiOverlayStyle.dark:
return AnnotatedRegion<SystemUiOverlayStyle>(
// Use [SystemUiOverlayStyle.light] for white status bar
// or [SystemUiOverlayStyle.dark] for black status bar
// https://stackoverflow.com/a/58132007/1321917
value: SystemUiOverlayStyle.light,
child: Scaffold(...),
);
Edit for Flutter 2.0.0
The answer below does not work anymore when you have an AppBar on the screen. You now need to configure the AppBarTheme.brightness and AppBarTheme.systemOverlayStyle correctly in that case.
Answer
Instead of the often suggested SystemChrome.setSystemUIOverlayStyle() which is a system wide service and does not reset on a different route, you can use an AnnotatedRegion<SystemUiOverlayStyle> which is a widget and only has effect for the widget that you wrap.
AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(
statusBarColor: Colors.white,
),
child: Scaffold(
...
),
)
This worked for me:
Import Service
import 'package:flutter/services.dart';
Then add:
#override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.white,
statusBarBrightness: Brightness.dark,
));
return MaterialApp(home: Scaffold(
Change status bar color when you are not using AppBar
First Import this
import 'package:flutter/services.dart';
Now use below code to change status bar color in your application when you are not using the AppBar
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark.copyWith(
statusBarColor: AppColors.statusBarColor,/* set Status bar color in Android devices. */
statusBarIconBrightness: Brightness.dark,/* set Status bar icons color in Android devices.*/
statusBarBrightness: Brightness.dark)/* set Status bar icon color in iOS. */
);
To change the status bar color in iOS when you are using SafeArea
Scaffold(
body: Container(
color: Colors.red, /* Set your status bar color here */
child: SafeArea(child: Container(
/* Add your Widget here */
)),
),
);
I think this will help you:
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
systemNavigationBarColor: Colors.white, // navigation bar color
statusBarColor: Colors.white, // status bar color
statusBarIconBrightness: Brightness.dark, // status bar icons' color
systemNavigationBarIconBrightness: Brightness.dark, //navigation bar icons' color
));
What worked for me (For those who don't use AppBar)
Add AppbBar with preferred color and then set : toolbarHeight: 0
child: Scaffold(
appBar: AppBar(
toolbarHeight: 0,
backgroundColor: Colors.blue,
brightness: Brightness.light,
)
I can't comment directly in the thread since I don't have the requisite reputation yet, but the author asked the following:
the only issue is that the background is white but the clock, wireless and other text and icons are also in white .. I am not sure why!!
For anyone else who comes to this thread, here's what worked for me. The text color of the status bar is decided by the Brightness constant in flutter/material.dart. To change this, adjust the SystemChrome solution like so to configure the text:
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.red,
statusBarBrightness: Brightness.dark,
));
Your possible values for Brightness are Brightness.dark and Brightness.light.
Documentation:
https://api.flutter.dev/flutter/dart-ui/Brightness-class.html
https://api.flutter.dev/flutter/services/SystemUiOverlayStyle-class.html
This is everything you need to know:
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
systemNavigationBarColor: Colors.amber, // navigation bar color
statusBarColor: Colors.white, // status bar color
statusBarIconBrightness: Brightness.dark, // status bar icon color
systemNavigationBarIconBrightness: Brightness.dark, // color of navigation controls
));
runApp(MyApp());
}
It can be achieved in 2 steps:
Set the status bar color to match to your page background using FlutterStatusbarcolor package
Set the status bar buttons' (battery, wifi etc.) colors using the AppBar.brightness property
If you have an AppBar:
#override
Widget build(BuildContext context) {
FlutterStatusbarcolor.setStatusBarColor(Colors.white);
return Scaffold(
appBar: AppBar(
brightness: Brightness.light,
// Other AppBar properties
),
body: Container()
);
}
If you don't want to show the app bar in the page:
#override
Widget build(BuildContext context) {
FlutterStatusbarcolor.setStatusBarColor(Colors.white);
return Scaffold(
appBar: AppBar(
brightness: Brightness.light,
elevation: 0.0,
toolbarHeight: 0.0, // Hide the AppBar
),
body: Container()
}
[Tested in Android]
This is how I was able to make status bar transparent and it's text color dark,
import 'package:flutter/services.dart';
void main() {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.transparent, // transparent status bar
statusBarIconBrightness: Brightness.dark // dark text for status bar
));
runApp(MyApp());
}
Using AnnotatedRegion is what works best for me, especially if I don't have an AppBar
import 'package:flutter/services.dart';
...
Widget build(BuildContext context) {
return Scaffold(
body: AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.light,
child: ...,
),
);
}
From Flutter 2.5.0
brightness property is deprecated in AppBar
We need to use, systemOverlayStyle property
Example,If you are using an AppBar
AppBar(
title: Text("Title"),
systemOverlayStyle: SystemUiOverlayStyle.dark) //for dark color
on the main.dart file
import service like follow
import 'package:flutter/services.dart';
and inside build method just add this line before return
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.orange
));
Like this:
#override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: CustomColors.appbarcolor
));
return MaterialApp(
home: MySplash(),
theme: ThemeData(
brightness: Brightness.light,
primaryColor: CustomColors.appbarcolor,
),
);
}
This one will also work
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark);
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);
This is by far is the best way, it requires no extra plugins.
Widget emptyAppBar(){
return PreferredSize(
preferredSize: Size.fromHeight(0.0),
child: AppBar(
backgroundColor: Color(0xFFf7f7f7),
brightness: Brightness.light,
)
);
}
and call it in your scaffold like this
return Scaffold(
appBar: emptyAppBar(),
.
.
.
Most of the answers are using SystemChrome which only works for Android. My solution is to combine both AnnotatedRegion and SafeArea into new Widget so it also works in iOS. And I can use it with or without AppBar.
class ColoredStatusBar extends StatelessWidget {
const ColoredStatusBar({
Key key,
this.color,
this.child,
this.brightness = Brightness.dark,
}) : super(key: key);
final Color color;
final Widget child;
final Brightness brightness;
#override
Widget build(BuildContext context) {
final defaultColor = Colors.blue;
final androidIconBrightness =
brightness == Brightness.dark ? Brightness.light : Brightness.dark;
return AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(
statusBarColor: color ?? defaultColor,
statusBarIconBrightness: androidIconBrightness,
statusBarBrightness: brightness,
),
child: Container(
color: color ?? defaultColor,
child: SafeArea(
bottom: false,
child: Container(
child: child,
),
),
),
);
}
}
Usage: Place it to top of page's widget.
#override
Widget build(BuildContext context) {
return ColoredStatusBar(
child: /* your child here */,
);
}
None of the answers seem to mention that you can do it with your ThemeData function in your main MaterialApp widget.
return MaterialApp(
theme: ThemeData(
appBarTheme: const AppBarTheme(
systemOverlayStyle: SystemUiOverlayStyle(
statusBarColor: Colors.white,
),
),
),
),
This can also be done in the darkTheme ThemeData.
Latest solution. Flutter 2.0 and above
For those who use AppBar:
/// WORKS on the screen where appBar is used
Scaffold(
appBar: AppBar(
systemOverlayStyle: SystemUiOverlayStyle(
// statusBarColor: Colors.red, // You can use this as well
statusBarIconBrightness: Brightness.dark, // OR Vice Versa for ThemeMode.dark
statusBarBrightness: Brightness.light, // OR Vice Versa for ThemeMode.dark
),
),
),
For those who DON'T use AppBar:
Put the code below on the root screen's build function to AFFECT all the screens below:
void main() {
runApp(MyApp());
}
// This widget is the root of your application.
class MyApp extends StatelessWidget {
/// WORKS on every screen EXCEPT the screen in which appBar is used
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
// statusBarColor: Colors.red, // You can use this as well
statusBarIconBrightness: Brightness.dark, // OR Vice Versa for ThemeMode.dark
statusBarBrightness: Brightness.light, // OR Vice Versa for ThemeMode.dark
),
);
#override
Widget build(BuildContext context) {}
}
Put the code below on the single screen's build function to AFFECT this screen only:
class SingleScreen extends StatelessWidget {
/// WORKS on a single screen where appBar is NOT used
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
// statusBarColor: Colors.red, // You can use this as well
statusBarIconBrightness: Brightness.dark, // OR Vice Versa for ThemeMode.dark
statusBarBrightness: Brightness.light, // OR Vice Versa for ThemeMode.dark
),
);
#override
Widget build(BuildContext context) {}
}
return Scaffold(
backgroundColor: STATUS_BAR_COLOR_HERE,
body: SafeArea(
child: scaffoldBody(),
),
);
Works for both iOS and Android
import 'package:flutter/services.dart';
#override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark);
return Scaffold();
}
You can do as follows,
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
statusBarColor: Colors.grey.withOpacity(0.5),
statusBarIconBrightness: Brightness.dark,
statusBarBrightness:
Platform.isAndroid ? Brightness.dark : Brightness.light,
systemNavigationBarColor: Colors.white,
systemNavigationBarDividerColor: Colors.grey,
systemNavigationBarIconBrightness: Brightness.dark,
),
);
Add this code to your main.dart build method,
this (inside the scaffold) creates a black statusbar with light content. (no Appbar)
appBar: AppBar(
toolbarHeight: 0,
backgroundColor: Colors.black,
systemOverlayStyle: SystemUiOverlayStyle.light,
),
to Make it Like your App Bar Color
import 'package:flutter/material.dart';
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
systemNavigationBarColor: Colors.transparent,
));
}
None of the existing solutions helped me, because I don't use AppBar and I don't want to make statements whenever the user switches the app theme. I needed a reactive way to switch between the light and dark modes and found that AppBar uses a widget called Semantics for setting the status bar color.
Basically, this is how I do it:
return Semantics(
container: false, // don't make it a new node in the hierarchy
child: AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.light, // or .dark
child: MyApp(), // your widget goes here
),
);
Semantics is imported from package:flutter/material.dart.
SystemUiOverlayStyle is imported from package:flutter/services.dart.
Use this way to make your status bar completely white with the dark status bar icons,
I use it personally! tested on android worked fine!
import 'package:FileSharing/bodypage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
#override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
appBarTheme: AppBarTheme(
color: Colors.white,
elevation: 0,
brightness: Brightness.light,
centerTitle: true,
iconTheme: IconThemeData(
color: Colors.black,
),
textTheme: TextTheme(),
)
// This makes the visual density adapt to the platform that you run
// the app on. For desktop platforms, the controls will be smaller and
// closer together (more dense) than on mobile platforms.
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
#override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
#override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.white,
));
return Scaffold(
appBar: AppBar(
brightness: Brightness.light,
actions: [
Container(
width: 63,
padding: EdgeInsets.only(right: 30),
child: FloatingActionButton(
onPressed: null,
backgroundColor: Colors.pink,
elevation: 8,
child: Icon(Icons.person_pin),
),
)
],
),
);
}
}
The best way with out any packages
Scaffold(
extendBodyBehindAppBar: true,
appBar: AppBar(
toolbarHeight: 0,
backgroundColor: Colors.transparent,
elevation: 0,
systemOverlayStyle: const SystemUiOverlayStyle(
statusBarColor: Colors.transparent, // <-- SEE HERE
statusBarIconBrightness:
Brightness.dark, //<-- For Android SEE HERE (dark icons)
statusBarBrightness: Brightness.light,
),
),.......
you can use for Android:
import 'package:flutter/services.dart';
void main() {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
systemNavigationBarColor: Colors.blue, // navigation bar color
statusBarColor: Colors.pink, // status bar color
));
}
you can also use this in SliverAppBar, don't forget to use backwardsCompatibility: false it would not work if you skip this property. also see doc
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: null,
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
systemOverlayStyle: SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarIconBrightness: Brightness.dark),
backwardsCompatibility: false,
//... remaining code and close braces..

Show Android Statusbar

I'm coding an app with flutter. But for some strange manner the android statusbar is hiding when I open my app. I don't want that. Is there a reason why this is happening?
This is what I want to achieve:
Goal
This is what I have:
My App Screenshot
Show Status Bar :-
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
Show tansparent Status Bar :-
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
));
Thank you for the quick answer. The sad thing is that I already do that:
#override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
body: SafeArea(
child: Center(
child: ListView(
shrinkWrap: true,
children: [
Center(
child: Text(
_pageTitle,
style: Theme.of(context).textTheme.headline1,
),
),
Center(child: Text(_pageSubTitle)),
loginForm(context),
],
),
),
),
);
}
But it sadly dosen't work 🙈
And I also set the systemvalues in my main function:
void main() {
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
systemNavigationBarColor: MAIN_LIGHT_GREEN, // navigation bar color
statusBarColor: MAIN_LIGHT_GREEN,
statusBarIconBrightness: Brightness.dark,
systemNavigationBarIconBrightness: Brightness.light,
statusBarBrightness: Brightness.light,
));
runApp(MyApp());
}

flutter statusbar color not same with Appbar Color

I have set the statusbar color to transparent. But still not the same with Appbar.
// on main method
if (Platform.isAndroid) {
SystemUiOverlayStyle systemUiOverlayStyle =
SystemUiOverlayStyle(statusBarColor: Colors.transparent);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
}
// on a widget build method
Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
brightness: Brightness.light,
centerTitle: true,
backgroundColor: Colors.white,
elevation: 0,
title: Text('发现', style: BMTextStyle.black_56),
),
body: SafeArea(
top: false,
child: TabBarView(controller: _controller, children: <Widget>[
_buildPageContentAccordingIndex(0),
_buildPageContentAccordingIndex(1),
]),
),
),
The result is the statusbar color seems gray, and the Scaffold is white. So how to make them the same? Thank you!
You want to use AnnotatedRegion inside each Stateful Widget (basically every screen) you make adjustments to regarding the status bar. I previously did it some other way, but AnnotatedRegion makes sure the status bar updates its style again when you use Navigator.pop(context) to come back to this screen. Just wrap the Scaffold around with AnnotatedRegion and set the value to your systemUiOverlayStyle variable like so:
#override
Widget build(BuildContext context) {
SystemUiOverlayStyle _statusBarStyle = SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarIconBrightness: Brightness.dark,
);
return AnnotatedRegion(
value: _statusBarStyle,
child: Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
brightness: Brightness.light,
centerTitle: true,
backgroundColor: Colors.white,
elevation: 0,
title: Text('发现', style: BMTextStyle.black_56),
),
body: SafeArea(
top: false,
child: TabBarView(controller: _controller, children: <Widget>[
_buildPageContentAccordingIndex(0),
_buildPageContentAccordingIndex(1),
]),
),
),
);
}
Hope this helped.

How can I Set Full Screen Background Image to Scaffold Container

I would like to Set Full-Screen Background Image to Scaffold Container, but don't know how? Here is my code:
#override
Widget build(BuildContext context) {
_deviceHeight = MediaQuery.of(context).size.height;
_deviceWidth = MediaQuery.of(context).size.width;
return Scaffold(
backgroundColor: Theme.of(context).hintColor,
appBar: AppBar(
backgroundColor: Theme.of(context).accentColor,
title: Text(this.widget._receiverName),
),
body: ChangeNotifierProvider<AuthProvider>.value(
value: AuthProvider.instance,
child: _conversationPageUI(),
)
);
}
wrap your scaffold with container and set its decoration
Container(
decoration: BoxDecoration(image: DecorationImage(image: AssetImage("... your image"))),
child: Scaffold(),
);
dont forgot to set scaffold background to Colors.transparent

How can I change the navigation bar icon color when my app comes back into focus?

In my app, I can set the status bar and navigation colors fine. However, I have multiple screens and when a user, for example, presses their home button on their device and then resumes the app later, how can I change the color of the navigation bar when they resume?
My specific issue is my navigation bar background color is white and when I exit the app and resume it later, the icons turn white which makes them impossible to see. Here's my build method (stripped of unnecessary code). I don't change the colors anywhere except here.
#override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.white,
systemNavigationBarColor: Colors.white,
systemNavigationBarIconBrightness: Brightness.dark,
));
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0,
title: Text("App"),
centerTitle: true,
backgroundColor: Colors.white,
brightness: Brightness.light,
),
body: Container(),
);
}
Below is a picture of my app with the white navigation bar icon color.
Here's an image of what it should look like
Benjamin, i was able to recreate your issue on Pixel 2. It's odd and this must be some kind of system bug but you can fix it by setting your bottom system navigation menu color again when your app resumes from background. For that, you need to check your AppLifeCycleState as shown below,
class MyApp extends StatefulWidget {
#override
MyAppState createState() => MyAppState();
}
class MyAppState extends State<MyApp> with WidgetsBindingObserver {
#override
void didChangeAppLifecycleState(AppLifecycleState state) {
if (state == AppLifecycleState.resumed) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.white,
systemNavigationBarColor: Colors.white,
systemNavigationBarIconBrightness: Brightness.dark,
));
}
}
#override
initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
}
#override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.white,
systemNavigationBarColor: Colors.white,
systemNavigationBarIconBrightness: Brightness.dark,
));
return MaterialApp(
home: Scaffold(
appBar: AppBar(
elevation: 0,
title: Text("App", style: TextStyle(color: Colors.black)),
centerTitle: true,
backgroundColor: Colors.white,
brightness: Brightness.light,
actions: <Widget>[
Icon(
Icons.info_outline,
color: Colors.grey,
)
],
),
body: Center(
child: Column(
children: <Widget>[],
),
),
));
}
}
I came accross the same issue. My workaround is the last if statement in the code below
FlutterStatusbarcolor.setStatusBarColor(
Theme.of(context).colorScheme.surface,
);
FlutterStatusbarcolor.setNavigationBarColor(
Theme.of(context).colorScheme.background,
);
if (MediaQuery.platformBrightnessOf(context) == Brightness.dark) {
FlutterStatusbarcolor.setNavigationBarWhiteForeground(true);
} else
FlutterStatusbarcolor.setNavigationBarWhiteForeground(false);

Categories

Resources