changeOsBarColor method
dynamic
changeOsBarColor(
- List<Color?> colors
)
Implementation
changeOsBarColor(List<Color?> colors) async {
bool _useWhiteStatusBarForeground;
bool _useWhiteNavigationBarForeground;
try {
await FlutterStatusbarcolor.setStatusBarColor(colors[0]!, animate: true);
await FlutterStatusbarcolor.setNavigationBarColor(colors[1]!,
animate: true);
if (useWhiteForeground(colors[0]!)) {
await FlutterStatusbarcolor.setStatusBarWhiteForeground(true);
await FlutterStatusbarcolor.setNavigationBarWhiteForeground(true);
_useWhiteStatusBarForeground = true;
_useWhiteNavigationBarForeground = true;
} else {
if (colors[0] == Colors.white) {
Future.delayed(Duration(seconds: 1)).then((_) {
FlutterStatusbarcolor.setStatusBarWhiteForeground(false);
FlutterStatusbarcolor.setNavigationBarWhiteForeground(false);
});
} else {
FlutterStatusbarcolor.setStatusBarWhiteForeground(false);
FlutterStatusbarcolor.setNavigationBarWhiteForeground(false);
}
_useWhiteStatusBarForeground = false;
_useWhiteNavigationBarForeground = false;
}
} on PlatformException catch (e) {
debugPrint(e.toString());
}
}