0

我最近将 Flutter 版本从 1.22.6 更新到了 2.0.2。但是现在在我创建一个新的颤振项目(默认计数器应用程序)之后,状态栏图标是黑暗的。在迁移到 2.0.2 之前它们很轻:

在此处输入图像描述

如何修复?我尝试在 AppBarTheme 中设置灯光 statusBarIconBrightness,但它不起作用:

    appBarTheme: AppBarTheme(
      systemOverlayStyle: SystemUiOverlayStyle(
        statusBarIconBrightness: Brightness.light,
      ),
    ),
4

2 回答 2

1

statusBarColor也应该为 dart statusBarColor 设置你应该使用明亮的颜色来获得亮度

AppBarTheme(color: Colors.blue,
            brightness: Brightness.dark,
            systemOverlayStyle: SystemUiOverlayStyle(
                  statusBarColor: Colors.blue
                ))
于 2021-04-22T10:22:39.960 回答
0

试试这个

 return MaterialApp(
     theme: ThemeData(
          appBarTheme: Theme.of(context).appBarTheme.copyWith(brightness: Brightness.dark,),
       ...
     ),
     ...
 );
于 2021-04-06T07:19:52.343 回答