Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter statusbar’s color

a package can help you to change your flutter app’s statusbar’s color or navigationbar’s color programmatically.

getting started

installation

add this to your pubspec.yaml (or create it):

dependencies:
  flutter_statusbarcolor: any

then run the flutter tooling:

flutter packages get

example

// change the status bar color to material color [green-400]
await flutterstatusbarcolor.setstatusbarcolor(colors.green[400]);
if (usewhiteforeground(colors.green[400])) {
  flutterstatusbarcolor.setstatusbarwhiteforeground(true);
} else {
  flutterstatusbarcolor.setstatusbarwhiteforeground(false);
}

// change the navigation bar color to material color [orange-200]
await flutterstatusbarcolor.setnavigationbarcolor(colors.orange[200]);
if (usewhiteforeground(colors.orange[200]) {
  flutterstatusbarcolor.setnavigationbarwhiteforeground(true);
} else {
  flutterstatusbarcolor.setnavigationbarwhiteforeground(false);
}

// get statusbar color and navigationbar color
color statusbarcolor = await flutterstatusbarcolor.getstatusbarcolor();
color navigationbarcolor = await flutterstatusbarcolor.getnavigationbarcolor();

statusbar's color

details in example/ folder.

api level minimum requirement

  • android
    • getstatusbarcolor (5.0)
    • setstatusbarcolor (5.0)
    • setstatusbarwhiteforeground (6.0)
    • getnavigationbarcolor (5.0)
    • setnavigationbarcolor (5.0)
    • setnavigationbarwhiteforeground (8.0)
  • ios
    • getstatusbarcolor (7+)
    • setstatusbarcolor (7+)
    • setstatusbarwhiteforeground (7+)

note that

  • if you find the foreground brightness reverted after changing the app lifecycle,
    please use flutter’s widgetsbindingobserver mixin.
  • if ios build does not work, please send issues or pull requests.

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.