resolvedSystemUiOverlayStyle method

SystemUiOverlayStyle resolvedSystemUiOverlayStyle()

Returns a SystemUiOverlayStyle based on the ThemeMode setting. In other words, if the theme is dark, returns light; if the theme is light, returns dark.

Implementation

SystemUiOverlayStyle resolvedSystemUiOverlayStyle() {
  Brightness brightness;
  switch (themeMode) {
    case ThemeMode.light:
      brightness = Brightness.light;
      break;
    case ThemeMode.dark:
      brightness = Brightness.dark;
      break;
    default:
      brightness = WidgetsBinding.instance!.window.platformBrightness;
  }

  final overlayStyle = brightness == Brightness.dark
      ? SystemUiOverlayStyle.light
      : SystemUiOverlayStyle.dark;

  return overlayStyle;
}