setStatusBarAndNavigationBarColors static method

void setStatusBarAndNavigationBarColors(
  1. ThemeMode themeMode
)

Applies status bar and system navigation bar colours to match themeMode.

Call this whenever the active theme changes (for example, from ThemeCubit). Uses SystemChrome.setSystemUIOverlayStyle — no rebuild is triggered.

Implementation

static void setStatusBarAndNavigationBarColors(ThemeMode themeMode) {
  SystemChrome.setSystemUIOverlayStyle(
    SystemUiOverlayStyle(
      statusBarColor: Colors.transparent,
      statusBarBrightness: (themeMode == ThemeMode.light) ? Brightness.light : Brightness.dark,
      statusBarIconBrightness: (themeMode == ThemeMode.light) ? Brightness.dark : Brightness.light,
      systemNavigationBarIconBrightness: (themeMode == ThemeMode.light) ? Brightness.dark : Brightness.light,
      systemNavigationBarDividerColor: Colors.transparent,
      systemNavigationBarColor: (themeMode == ThemeMode.light)
          ? LightThemeColors.colorScheme.surfaceBright
          : DarkThemeColors.colorScheme.surfaceBright,
    ),
  );
}