ThemeConfig<T> class

Manages theme data and preferences for the application. It can be used to switch between different themes and persist the user's choice.

Inheritance
Mixed-in types
Implementers

Constructors

ThemeConfig({dynamic initial, required ThemeFactory themes})

Properties

currentTheme → dynamic
Returns the key of the current active theme.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
initial → dynamic
The key of the initial theme to use.
final
prefs → ControlPrefs
Provides direct access to the ControlPrefs instance.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
themes → ThemeFactory
The factory containing all available themes.
final
value ↔ T
The current value stored in this notifier.
getter/setter pairinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
changeTheme(dynamic key, [bool preferred = true]) → bool
Changes the current theme to the one identified by key. key - The key of the new theme. preferred - If true, saves this theme as the user's preferred theme.
dispose() → void
Discards any resources used by the object.
inherited
getTheme(dynamic key) → T
Retrieves a theme object by its key. key - The key identifying the theme.
isPreferred(dynamic key) → bool
Checks if the given theme key is currently set as the preferred theme.
mount() → Future<void>
Mounts the theme configuration, loading preferences and setting the initial theme.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
resetPreferred() → void
Resets the user's preferred theme to the default.
setAsPreferred(dynamic key) → void
Sets the given theme key as the user's preferred theme.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

platformBrightness → Brightness
Returns the current brightness of the platform (light or dark).
no setter
preferredTheme → String
Returns the user's preferred theme key from shared preferences. Defaults to 'auto' if no preference is found.
no setter

Constants

preference_key → const String
The key used to store the preferred theme in shared preferences.