Sameerkash / flutter_statusbarcolor

A package can help you to change your flutter app's statusbar's color or navigationbar's color programmatically.
https://pub.dev/packages/flutter_statusbarcolor
MIT License
9 stars 21 forks source link
hacktoberfest hacktoberfest2021

flutter_statusbarcolor_ns

pub package

The package now supports to android v2 embedding, thanks to vixez

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

This is a fork of the original package flutter_statusbarcolor migrated to support null-safety.

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

Note that