Flutter Android system sets the status bar to transparent color

When the Flutter Android app is running, the default status bar is light gray and the font is black. You need to manually set the status bar to be transparent

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

Guess you like

Origin blog.csdn.net/lqw200931116/article/details/125420303