changeStatusBarColor static method

Future changeStatusBarColor({
  1. required Color color,
  2. bool? adaptiveBrightness,
  3. double? luminaceValue,
  4. bool? animate,
  5. bool? forIos,
  6. bool? forAndroid,
})

Implementation

static Future changeStatusBarColor({
  required Color color,
  bool? adaptiveBrightness,
  double? luminaceValue,
  bool? animate,
  bool? forIos,
  bool? forAndroid,
}) async {
  bool? isDarkColor;
  if (adaptiveBrightness ?? true) {
    final double luminance = color.computeLuminance();
    isDarkColor = luminance < (luminaceValue ?? 0.4);
  }
  print("Color value as string : ${color.toString()}");
  await _channel.invokeMethod(_CHANGE_STATUS_BAR_COLOR_METHOD, {
    'color': color,
    'isDarkColor': isDarkColor,
    'animate': animate ?? true,
    'forIos': forIos ?? true,
    'forAndroid': forAndroid ?? true,
  });
}