问题描述
我对所有这些扑朔迷离的事物都是陌生的.我到处搜索以找到解决此小问题的解决方案.有没有一种方法可以更改状态栏的颜色?另外,当我使用像colors.blue这样的颜色时,我可以看到状态栏中的文本质量不好.
I am new to all this flutter thing. I searched everywhere to find a solution for this little problem.Is there a way to change the status bar color?Also when i use the a color like colors.blue i can see that the quality of the text in the status bar isn't good.
谢谢
appBar: AppBar(
elevation : 0.0,
leading: IconButton(
icon: Icon(Icons.menu),
tooltip: 'Navigation menu',
onPressed: null,
),
actions: <Widget>[
IconButton(
icon: Icon(Icons.search),
tooltip: 'Search',
onPressed: null,
),
],
),
推荐答案
@Antoine基本上,您可以设置主题的亮度,也可以使用以下命令手动覆盖应用栏的亮度:
@AntoineBasically you can set your theme Brightness, or you can manually override the appbar brightness using the following :
appBar: new AppBar(
title: new Text(widget.title),
brightness: Brightness.light, // or use Brightness.dark
),
请注意,这只会在白色和黑色状态文本颜色之间切换.
Do note that this will only switch between white and black status text color.
.dark
将使状态栏文本为白色,而 .light
将使状态栏文本为黑色>.
.dark
will make the status bar text WHITE, while .light
will make the status bar text BLACK.
也许要使用更自定义的颜色,如注释中所述,您可以查看SystemChrome类.
Maybe for a more custom color, like the comment said you can view SystemChrome class.
这篇关于如何在Ios上更改状态栏文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!