updateByThemeMode static method

Future<void> updateByThemeMode({
  1. required ThemeMode mode,
  2. PlayxThemeAnimation animation = const PlayxThemeAnimation.fade(),
  3. bool animate = true,
  4. bool forceUpdateNonAnimatedTheme = false,
})

Updates the app's theme to the first theme that matches the given ThemeMode.

You can specify an animation for the theme change using the animation parameter. If animate is true, the theme change will be animated based on the specified animation. If animate is false, the theme will change instantly. Use forceUpdateNonAnimatedTheme to force a theme update without animation if animation is disabled.

Throws an Exception if no theme matching the given ThemeMode is found in the supportedThemes.

Implementation

static Future<void> updateByThemeMode({
  required ThemeMode mode,
  PlayxThemeAnimation animation = const PlayxThemeAnimation.fade(),
  bool animate = true,
  bool forceUpdateNonAnimatedTheme = false,
}) {
  return _controller.updateByThemeMode(
    mode: mode,
    animation: animation,
    animate: animate,
    forceUpdateNonAnimatedTheme: forceUpdateNonAnimatedTheme,
  );
}