加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

dart – Flutter – 当AppBar不存在时如何设置状态栏颜色

发布时间:2020-12-14 14:55:12 所属栏目:百科 来源:网络整理
导读:如何在AppBar不存在时设置状态栏颜色. I have tried this but not working. Widget build(BuildContext context) { SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark); return new Scaffold( body: new Container( color: UniQueryColors.co
如何在AppBar不存在时设置状态栏颜色.

I have tried this but not working.

Widget build(BuildContext context) {
    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark);
    return new Scaffold(
        body: new Container(
        color: UniQueryColors.colorBackground,child: new ListView.builder(
           itemCount: 7,itemBuilder: (BuildContext context,int index){
             if (index == 0){
               return addTopInfoSection();
             }
           },),);
}

输出看起来像这样:

enter image description here

解决方法

简单地把它放在你的应用程序的构建功能中:

SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark.copyWith(
  statusBarColor: Colors.blue,//or set color with: Color(0xFF0000FF)
));

此外,您可以设置有用的变量,如:statusBarIconBrightness,systemNavigationBarColor或systemNavigationBarDividerColor

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读