ThemeManager class
Central manager for LYCN Theme Engine.
Configuration precedence:
- Built-in package defaults
- Bundled application seed
- Saved runtime configuration
The manager keeps the bundled/base configuration separately so an application can reset runtime changes without losing its bundled theme.
- Inheritance
-
- Object
- ChangeNotifier
- ThemeManager
Constructors
- ThemeManager({ThemeConfig? config, ThemeStorage? storage})
Properties
- baseConfig → ThemeConfig
-
Configuration before runtime customization is applied.
no setter
- bgScaffold → Color
-
no setter
- bgSurface → Color
-
no setter
- borderDisabled → Color
-
no setter
- borderEnabled → Color
-
no setter
- borderOther → Color
-
no setter
-
no setter
-
no setter
-
no setter
- config → ThemeConfig
-
Current theme configuration.
no setter
- darkTheme → ThemeData
-
Dark Material theme generated from the current configuration.
no setter
- flutterThemeMode → ThemeMode
-
Converts the package theme mode into Flutter's ThemeMode.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isInitialized → bool
-
Whether initialization has completed.
no setter
- lightTheme → ThemeData
-
Light Material theme generated from the current configuration.
no setter
- mode → ThemeModeType
-
Current theme mode.
no setter
- primary → Color
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- secondary → Color
-
no setter
-
statuses
→ List<
StatusDef> -
no setter
- tertiary → Color
-
no setter
- textDescription → Color
-
no setter
- textOther → Color
-
no setter
- textSubtitle → Color
-
no setter
- textTitle → Color
-
no setter
-
tokenDefs
→ List<
TokenDef> -
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
addOrUpdateStatus(
StatusDef status) → Future< void> - Adds or updates a status definition.
-
addOrUpdateToken(
TokenDef token) → Future< void> - Adds or updates a token definition.
-
clearSavedConfiguration(
) → Future< void> - Clears persisted runtime configuration and restores the base theme.
-
color(
String tokenKey, {ThemeModeType? mode}) → Color -
Returns the color associated with
tokenKey. -
dispose(
) → void -
Discards any resources used by the object.
inherited
-
exportJson(
{bool pretty = true}) → String - Exports the current theme configuration as JSON.
-
getTokenDef(
String key) → TokenDef? -
hasStatus(
String actualValue) → bool -
hasToken(
String tokenKey) → bool -
importJson(
String json) → Future< bool> - Imports a theme configuration from JSON.
-
initialize(
{ThemeSeed? seed}) → Future< void> - Initializes the manager.
-
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
-
removeStatus(
String actualValue) → Future< void> - Removes a status definition.
-
removeToken(
String tokenKey) → Future< void> - Removes a non-locked token.
-
reset(
) → Future< void> - Restores the built-in package defaults.
-
resetToSeed(
) → Future< void> - Restores the bundled application theme.
-
setColor(
String tokenKey, Color color, {ThemeModeType? mode}) → Future< void> - Updates a color token.
-
setConfig(
ThemeConfig config) → Future< void> - Replaces the complete configuration.
-
setMode(
ThemeModeType mode) → Future< void> - Changes the active theme mode.
-
statusColor(
String actualValue, {ThemeModeType? mode, Color? fallback}) → Color - Returns the color associated with a status value.
-
statusLabel(
String actualValue, {String? fallback}) → String - Returns the display label associated with a status value.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited