美文网首页
flutter 在某一页设置状态栏字体颜色

flutter 在某一页设置状态栏字体颜色

作者: 肉肉要次肉 | 来源:发表于2023-04-26 14:35 被阅读0次

 SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);

 由于我设置了导航栏透明,导致状态栏的文字颜色变成了白色,通过这句就可以将字体改为黑色

@override

Widgetbuild (BuildContext context){

//设置状态栏字体为黑色(由于导航栏设为透明导致,状态栏字体变白色)

  SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);

  return Scaffold(

    extendBodyBehindAppBar:true,//布局从状态栏开始

    appBar:AppBar(

       elevation:0.0,//去掉导航默认阴影

       backgroundColor: Colors.transparent,//设置导航栏透明

       title:Text('关于我们',style:TextStyle(fontSize:17,fontWeight: FontWeight.bold,color: Colors.black)),

      leading:IconButton(

onPressed: (){

Navigator.pop(context);

        },

        icon:Image.asset('images/backIcon.png',width:20,height:20),

      ), systemOverlayStyle: SystemUiOverlayStyle.dark,

    ),

相关文章

网友评论

      本文标题:flutter 在某一页设置状态栏字体颜色

      本文链接:https://www.haomeiwen.com/subject/xgwpjdtx.html