[英]How to change status bar color with Flutter?
Good evening guys.各位晚上好。
I have a problem.我有个问题。 I've been on flutter for quite some time.
我已经有一段时间了。 Here I have two AScreen and BScreen screens.
这里我有两个 AScreen 和 BScreen 屏幕。 For AScreen I would like a white color status bar with black icons.
对于 AScreen,我想要一个带有黑色图标的白色状态栏。 And for BScreen a red status bar with the icons in white.
对于 BScreen,红色状态栏带有白色图标。 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)当我在屏幕 A 上时,我使用 flutter_statusbarcolo 状态栏是红色我导航到屏幕 B 状态栏是白色但是当我返回屏幕 A 时状态栏保持白色(屏幕 B 的颜色)
Since you want to change this on per-screen basis, do this on your appBar
off the your screen's Scaffold
.由于您想在每个屏幕的基础上更改此设置,请在屏幕
Scaffold
appBar
上执行此操作。
Use用
appBar: AppBar(
backgroundColor: Colors.red, // status bar color
brightness: Brightness.light, // status bar brightness
)
AnnotatedRegion<SystemUiOverlayStyle>(value: SystemUiOverlayStyle(statusBarColor:Colors.white,),child: Scaffold(),)
仅对您包装的小部件应用其效果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.