首页 > 解决方案 > 如何在 Ios 上更改状态栏文本颜色

问题描述

我对所有这些颤动的东西都很陌生。我到处寻找解决这个小问题的方法。有没有办法改变状态栏的颜色?此外,当我使用 color.blue 之类的颜色时,我可以看到状态栏中的文本质量不好。

谢谢

在此处输入图像描述

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,
      ),
    ],
  ),

标签: flutter

解决方案


@Antoine 基本上你可以设置你的主题亮度,或者你可以使用以下方法手动覆盖应用栏亮度:

appBar: new AppBar(
  title: new Text(widget.title),
  brightness: Brightness.light, // or use Brightness.dark
),

请注意,这只会在白色和黑色状态文本颜色之间切换。

.dark将使状态栏文本变为白色,而.light将状态栏文本变为黑色

也许对于更自定义的颜色,就像评论说你可以查看 SystemChrome 类。


推荐阅读