I have two pages first one have white status bar and the second page has gray status bar but when I move from one to another page the second page takes first status bar color??
NOTE: when I run the second page from main function it takes the right color
I use this for status bar:
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark.copyWith(
statusBarColor: Color(0xffF6F6F6),
statusBarBrightness: Brightness.dark
));
what is the reason for this?
Try out this:-
Wrap your MaterialApp with below code in main.dart class:-
AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(
statusBarColor: Colors.transparent, //set as per your status bar color
systemNavigationBarColor: Colors.black, //set as per your navigation bar color
statusBarIconBrightness: Brightness.dark, //set as per your status bar icons' color
systemNavigationBarIconBrightness: Brightness.dark,
),
child: MaterialApp(
And if you want change appbar color of whole app then try out below
theme: Theme.of(context).copyWith(
appBarTheme: Theme.of(context)
.appBarTheme
.copyWith(brightness: Brightness.light),
),
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.