getSystemUiOverlayStyle method

SystemUiOverlayStyle getSystemUiOverlayStyle({
  1. required ThemeMode themeMode,
  2. required Brightness onChangeBrightness(),
})

Implementation

SystemUiOverlayStyle getSystemUiOverlayStyle({
  required ThemeMode themeMode,
  required Brightness Function() onChangeBrightness,
}) {
  if (themeMode == ThemeMode.dark) {
    return const SystemUiOverlayStyle(
      statusBarColor: Colors.transparent,
      statusBarIconBrightness: Brightness.light,
      statusBarBrightness: Brightness.dark,
    );
  } else if (themeMode == ThemeMode.light) {
    return const SystemUiOverlayStyle(
      statusBarColor: Colors.transparent,
      statusBarIconBrightness: Brightness.dark,
      statusBarBrightness: Brightness.light,
    );
  } else {
    final Brightness brightness = onChangeBrightness();
    return SystemUiOverlayStyle(
      statusBarColor: Colors.transparent,
      statusBarIconBrightness: (brightness == Brightness.light)
          ? Brightness.dark
          : Brightness.light,
      statusBarBrightness: (brightness == Brightness.light)
          ? Brightness.light
          : Brightness.dark,
    );
  }
}