Why my status bar icons are black and why can't I change it? (After Flutter 2.0 Upgrade)

Viewed 1617

After I upgrade Flutter 2.0, the color of the status bar's icon/text changed from white to black. After I upgraded because I did not make any other changes. Now the status bar icons of all apps I run is black. Why?

enter image description here

I tried the real device. Result is the same. So this is not an emulator problem.

Also not working Brightness.light:

SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
    statusBarIconBrightness: Brightness.light,
  ));

When I run this code, it turns white for a few seconds and then turns black again. Like here:

enter image description here

I wonder if people who have upgraded after Flutter 2.0 have the same problem?

What is the reason for this and how to make white again?


Edit: When I flutter downgrade it turns white. The problem seems to be with flutter upgrade to 2.0. But this time when I run statusBarIconBrightness: Brightness.dark it goes black for a few seconds and turns white again. This code doesn't work at all. So Flutter 2.0 is not the reason why I can't change it to white when it is black. But the reason it's black is flutter 2.0.

5 Answers

Try this

MaterialApp(
      //...
      theme: ThemeData(
        //...
        appBarTheme: AppBarTheme(brightness: Brightness.dark),
      ),
      //...
    )

it's a bug, I saw somebody created an issue on flutter repo

meanwhile this code does fix an issue:

appBar: AppBar(
  brightness: Brightness.dark,
),

Try this out:

SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light)

Found a solution to this. brightness: Brightness.dark;

AppBar(
  title: Text(widget.title),
  backgroundColor: Constants.appBarColor,
  brightness: Brightness.dark;
  centerTitle: false,
  elevation: 4.0,
);

So Brightness.dark makes status bar white.

If you're running the new Flutter SDK 2.5, then use

appBar: AppBar(systemOverlayStyle: SystemUiOverlayStyle.light,)

instead of "brightness: Brightness.dark" as it was deprecated

Related