Skip to content
This repository was archived by the owner on Jul 6, 2020. It is now read-only.

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

License

Notifications You must be signed in to change notification settings

mchome/flutter_statusbarcolor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
mchome
Nov 15, 2019
63abf17 · Nov 15, 2019

History

44 Commits
Jul 7, 2019
Jul 7, 2019
Sep 23, 2019
Oct 23, 2019
Jan 14, 2019
Sep 23, 2019
Nov 15, 2019
Sep 23, 2019
Sep 23, 2019
Feb 18, 2018
Feb 18, 2018
Nov 15, 2019

Repository files navigation

flutter_statusbarcolor

pub package

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

Getting Started

// 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();

preview

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.