Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/106.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何更改状态文本栏的颜色_Ios_Flutter - Fatal编程技术网

Ios 如何更改状态文本栏的颜色

Ios 如何更改状态文本栏的颜色,ios,flutter,Ios,Flutter,我正在尝试使用CupertinaVigationBar将状态栏文本颜色设置为亮度 我已经尝试将SystemUIOverlyStyle与statusBarColor和亮度结合在一起,但不起作用 void main(){ SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( systemNavigationBarColor:Colors.white, statusBarColor:Colors.white, 状态:亮度。亮度, sta

我正在尝试使用CupertinaVigationBar将状态栏文本颜色设置为亮度

我已经尝试将SystemUIOverlyStyle与statusBarColor和亮度结合在一起,但不起作用

void main(){
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
systemNavigationBarColor:Colors.white,
statusBarColor:Colors.white,
状态:亮度。亮度,
statusBarIconBrightness:Brightness.light
));
runApp(MyApp());
}

我正在尝试为ios和android创建appbar,但我想让状态栏文本颜色变亮,我设置了一个条件,如果是ios,我创建CupertinaVigationBar(),如果是android,我设置普通appbar(),如果只是有亮度的appbar,他工作正常,但使用CupertinaVigationBar(),否

尝试将亮度设置为暗。在AppBar中,如果我将亮度设置为light,它将使状态栏文本变为黑色

statusBarBrightness: Brightness.dark,
更新 现在,
cupertinanaviationbar
也有一个
亮度
属性

旧答案 那是不可能的

cupertinanaviationbar
使用该方法定义状态栏是亮还是暗,因此永远不会考虑使用
SystemChrome.setsystemmuioverlaystyle()
进行的设置

典型的解决方案是创建自己的导航栏扩展
cupertinaviationbar
,但在这种情况下这并不容易,因为
cupertinaviationbar
有一个私有的
状态
,并调用其他私有类和方法

事实上,
cupertinanaviationbar
AppBar
相比,其设计很差,后者考虑了三个属性来定义亮度:

  • 亮度
    可通过构造函数传递的参数
  • 主题数据.AppBarTheme.brightness
  • 主题数据。primaryColorBrightness
  • 请注意,有一个属性指定Cupertino小部件的亮度,它是
    CupertinoThemeData.brightness
    ,但(奇怪的是)在
    \u wrapWithBackground()
    中没有考虑它

    关于这件事已经有了一个明确的答案。您应该等待Flatter团队的响应,但在此之前,您可以使用变通方法。

    (iOS暗模式和Android)

    在信息列表中添加行

    <key>UIUserInterfaceStyle</key>
    <string>Light</string>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <true/>
    
    UIUserInterfaceStyle
    轻的
    UIViewControllerBasedStatusBarAppearance
    

    和更改状态栏您面临什么问题?当使用
    CupertinaVigationBar
    时,您的状态栏应自动变亮。我在CupertinaVigationBar中的背景色为0xFF81d8d0,这是蓝色/绿色,状态栏为黑色,但我不想要黑色,我想要白色我在帖子上放了一个图像,看ati放的,但是,在我只使用app bar时,对ios和android都有效,但是如果我把if设置到ios并使用Cupertinavigation,他就不工作了。我只是检查了Cupertinavigation栏,它似乎会根据背景颜色更改状态栏的颜色。我试过这个:cupertinanaviationbar(backgroundColor:Colors.black24,),它将状态文本更改为白色。是的,他更改了,但是,应用程序栏必须是0xFF81d8d0,这种颜色的对比度是黑色的,但是这种颜色的黑色非常难看