How to change the status bar text color with Cupertinonavigationbar

Asked

Viewed 595 times

1

I’m trying to put the text of the iPhone color status bar in white color I already tried to put in main the Systemuioverlaystyle, with the statusBarColor and the light brightness but it didn’t work...

I tried this code

void main() {
  SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
    systemNavigationBarColor: Colors.white,
    statusBarColor: Colors.white,
    statusBarBrightness: Brightness.light,
    statusBarIconBrightness: Brightness.light
  ));
  runApp(MyApp());
}

I tried to create the appbar for Ios and android, but I want to put the status text color bar in Light, I put a condition, that if Ios, it creates Cupertinonavigationbar, and if android, it puts the Appbar normally, if I put only the Appbar without having the Navigation, and put the Brightness light, it works...

1 answer

1

Works perfectly:

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    // Apply color in status bar
    SystemChrome.setSystemUIOverlayStyle(
        SystemUiOverlayStyle(statusBarColor: Colors.red));
    }
}
  • That way didn’t work! But I found another way to solve this problem that can help other people who are looking for it too! https://github.com/flutter/flutter/issues/30114, works this way because Cupertinonavigationbar he works with _wrapWithBackground() and when he is generating, he has already decided whether to be Brightness light or dark, making Systemchrome not change the status bar and for this, this link I put above, this person recreated the Cupertinonavigationbar so that along with the Brightness of when it is being generated!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.