Search code examples
flutterflutter-layouticonsflutter-dependencies

How to set status bar icon color in Flutter?


I'm working on the flutter project, I want to give the white colour to the status-bar icon. so I used the following line of code, and it gave me the result on a splash screen

FLUTTER CODE:

SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
  systemNavigationBarColor:  Color(0xffdedede),
  systemNavigationBarIconBrightness: Brightness.dark,
  systemNavigationBarDividerColor: null,
  statusBarColor: Color(0xffbf0000),
  statusBarIconBrightness: Brightness.light,
  statusBarBrightness: Brightness.dark,
  ));

BUT: when the app navigates to the home screen, the status-bar icon colour change back to black, I don't know what is missing from that line's code. So I'm stuck on that


Solution

  • Colour of status-bar icon is depend on color of appbar. You can try edit systemOverlayStyle of AppBar on Home Screen ?

    https://api.flutter.dev/flutter/material/AppBar/systemOverlayStyle.html