PlayxTheme class abstract
Manages the app's theme and provides methods to update it.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- colors → PlayxColors
-
Gets the colors used in the current theme.
no setter
- currentTheme → XTheme
-
Gets the currently active theme.
no setter
- currentThemeData → ThemeData
-
Gets the
ThemeDatafor the current theme.no setter - id → String
-
Gets the ID of the currently active theme.
no setter
- index → int
-
Gets the index of the currently active theme.
no setter
- initialTheme → XTheme
-
Gets the initial theme based on the configuration.
no setter
- name → String
-
Gets the name of the currently active theme.
no setter
-
supportedThemes
→ List<
XTheme> -
Gets the list of all supported themes.
no setter
- themeMode → ThemeMode
-
Gets the current theme mode (system, light, or dark).
no setter
-
themeModeNotifier
→ ValueNotifier<
ThemeMode> -
Gets the notifier for current theme mode.
Used to listen to theme mode changes.
no setter
Static Methods
-
boot(
{required PlayxThemeConfig config}) → Future< void> - Initializes the theme management system.
-
clearLastSavedTheme(
) → Future< void> - Clears the last saved theme from local storage.
-
dispose(
) → Future< bool> - Disposes of the Playx theme dependencies.
-
isDeviceInDarkMode(
) → bool - Determines if the device is currently in dark mode.
-
next(
{PlayxThemeAnimation animation = const PlayxThemeAnimation.fade(), bool animate = true, bool forceUpdateNonAnimatedTheme = false, bool updateMode = true}) → Future< void> - Updates the app's theme to the next theme in the list.
-
updateById(
String id, {PlayxThemeAnimation animation = const PlayxThemeAnimation.fade(), bool animate = true, bool forceUpdateNonAnimatedTheme = false, bool updateMode = true}) → Future< void> - Updates the app's theme to the theme with the specified ID.
-
updateByIndex(
int index, {PlayxThemeAnimation animation = const PlayxThemeAnimation.fade(), bool animate = true, bool forceUpdateNonAnimatedTheme = false, bool updateMode = true}) → Future< void> - Updates the app's theme to the theme at the specified index.
-
updateByThemeMode(
{required ThemeMode mode, PlayxThemeAnimation animation = const PlayxThemeAnimation.fade(), bool animate = true, bool forceUpdateNonAnimatedTheme = false}) → Future< void> - Updates the app's theme to the first theme that matches the given ThemeMode.
-
updateTo(
XTheme theme, {PlayxThemeAnimation animation = const PlayxThemeAnimation.fade(), bool animate = true, bool forceUpdateNonAnimatedTheme = false, bool updateMode = true}) → Future< void> -
Updates the app's theme to the provided theme.
If
animateistrue, the theme change will be animated based on the specifiedanimation. Ifanimateisfalse, the theme will change instantly. You can specify an animation for the theme change using theanimationparameter. UseforceUpdateNonAnimatedThemeto force a theme update without animation if animation is disabled. IfupdateModeistrue, it updates thethemeModeto light or dark based on the Theme's brightness. -
updateToDarkMode(
{PlayxThemeAnimation animation = const PlayxThemeAnimation.fade(), bool animate = true, bool forceUpdateNonAnimatedTheme = false}) → Future< void> - Updates the app's theme to the first dark theme available.
-
updateToDeviceMode(
{PlayxThemeAnimation animation = const PlayxThemeAnimation.fade(), bool animate = true, bool forceUpdateNonAnimatedTheme = false}) → Future< void> - Updates the app's theme to the first theme that matches the device's current mode.
-
updateToLightMode(
{PlayxThemeAnimation animation = const PlayxThemeAnimation.fade(), bool animate = true, bool forceUpdateNonAnimatedTheme = false}) → Future< void> - Updates the app's theme to the first light theme available.