Flutter安卓系统把状态栏设置为透明色

Flutter安卓app运行时,状态栏默认淡灰色,字体黑色,需手动设置状态栏为透明色

//设置android状态栏为透明色
  setAndroidSystemBar() {
    if (AppEnv.isAndroid) {
      // 设置android状态栏为透明
      // MaterialApp组件会覆盖掉这个值。
      SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(
          statusBarColor: Colors.transparent,
          statusBarIconBrightness: Brightness.dark);
      SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
    }
  }

猜你喜欢

转载自blog.csdn.net/lqw200931116/article/details/125420303