How to change status bar color with Flutter?

Viewed 524

Good evening guys.

I have a problem. I've been on flutter for quite some time. Here I have two AScreen and BScreen screens. For AScreen I would like a white color status bar with black icons. And for BScreen a red status bar with the icons in white. How to achieve this ??

I use flutter_statusbarcolo when I am on screen A the status bar is red I navigate to screen B the status bar is white but when I return to screen A the status bar keeps the color white (color of the screen B)

2 Answers

Since you want to change this on per-screen basis, do this on your appBar off the your screen's Scaffold.

Use

appBar: AppBar(
  backgroundColor: Colors.red, // status bar color
  brightness: Brightness.light, // status bar brightness
)
AnnotatedRegion<SystemUiOverlayStyle>(value: SystemUiOverlayStyle(statusBarColor:Colors.white,),child: Scaffold(),)

Applies its effect only for the widget that you wrap.

Related