flutter_statusbarcolor 0.1.1
flutter_statusbarcolor: ^0.1.1 copied to clipboard
A package can help you to change your flutter app's statusbar's color or navigationbar's color programmatically.
flutter_statusbarcolor #
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].
try {
await FlutterStatusbarcolor.setStatusBarColor(Colors.green[400]);
if (useWhiteForeground(Colors.green[400])) {
FlutterStatusbarcolor.setStatusBarWhiteForeground(true);
} else {
FlutterStatusbarcolor.setStatusBarWhiteForeground(false);
}
} on PlatformException catch (e) {
print(e);
}
// change the navigation bar color to material color [orange-200].
try {
await FlutterStatusbarcolor.setNavigationBarColor(Colors.orange[200]);
if (useWhiteForeground(Colors.orange[200]) {
FlutterStatusbarcolor.setNavigationBarWhiteForeground(true);
} else {
FlutterStatusbarcolor.setNavigationBarWhiteForeground(false);
}
} on PlatformException catch (e) {
print(e);
}
Details in example/ folder.
Api level minimum requirement #
-
android
- setStatusBarColor (5.0)
- setStatusBarWhiteForeground (6.0)
- setNavigationBarColor (5.0)
- setNavigationBarWhiteForeground (8.0)
-
ios
- setStatusBarColor (7+)
- setStatusBarWhiteForeground (7+)
Note that #
- If ios build does not work, please send issues or pull requests.