overrideAppBarStyle function

void overrideAppBarStyle({
  1. required bool isDark,
})

overrideAppBarStyle overrides the app bar style. This should be used only when the theme changes from light to dark or vice versa.

Implementation

void overrideAppBarStyle({
  /// [isDark] is a boolean that indicates if the theme is dark.
  required bool isDark,
}) {
  if (kIsWeb) return;
  // isDark = !isDark; // Idk why, but when this algorithm is called, is inverted.

  if (isDark) {
    SystemChrome.setSystemUIOverlayStyle(kDarkSystemUiOverlayStyle);
  } else {
    SystemChrome.setSystemUIOverlayStyle(kLightSystemUiOverlayStyle);
  }
}