玖叶教程网

前端编程开发入门

Flutter 修改statusbar状态栏背景颜色和文字图标颜色




设置状态栏颜色:

runApp(MyApp());
SystemUiOverlayStyle systemUiOverlayStyle = const SystemUiOverlayStyle(
        statusBarColor: Colors.transparent,
 );
    SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);

也可以使用第三库实现更多效果 flutter_statusbarcolor_ns: ^0.5.0 :

  await FlutterStatusbarcolor.setStatusBarColor(Colors.transparent);
    FlutterStatusbarcolor.setStatusBarWhiteForeground(false);

改变状态栏中文字图标颜色:

SystemUiOverlayStyle.light 黑色,SystemUiOverlayStyle.dart 白色

 builder: (context, child) => AnnotatedRegion<SystemUiOverlayStyle>(
        value: SystemUiOverlayStyle.light,
        child: MaterialApp(...),
      ),

发表评论:

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言