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

 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,

    ),

© 版权声明
THE END
如果内容对您有所帮助,就支持一下吧!
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容