ThemeController class
- Inheritance
-
- Object
- ChangeNotifier
- ThemeController
Constructors
- ThemeController({ThemeData? light, ThemeData? dark, ThemeMap themes = const {}, ThemeMode initialMode = ThemeMode.system, String? initialTheme, ThemeModeIcons? modeIcons, ThemeExtensionBuilder? extensionBuilder, ThemeChanged? onAvailableChanged, ThemeChanged? onThemeChanged, ThemeChanged? onModeChanged, ThemeChanged? onColorChanged, ThemeChanged? onChanged})
-
Controller which handles updating and controlling current theme.
factory
Properties
- available ↔ ThemeMap
-
Available themes to select
getter/setter pair
- availableEntries → ThemeList
-
Return the list of available themes
no setter
- color ↔ Color?
-
This value will override the current theme color
getter/setter pair
- config → ThemeConfig
-
The current theme config
no setter
- darkData → ThemeData
-
The current dark theme data
no setter
- data → ThemeData
-
The current main/light theme data
no setter
- description → String?
-
The current theme description
no setter
- extensionBuilder → ThemeExtensionBuilder?
-
The current dark theme data
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- initialMode → ThemeMode
-
Initial provided theme mode
final
- initialTheme → String
-
Initial provided theme name/key
final
- isDarkMode → bool
-
Whether the theme mode is ThemeMode.dark or not
no setter
- isLightMode → bool
-
Whether the theme mode is ThemeMode.light or not
no setter
- isSystemMode → bool
-
Whether the theme mode is ThemeMode.dark or not
no setter
- lightData → ThemeData
-
The current light theme data
no setter
- mode ↔ ThemeMode
-
Current selected theme mode
getter/setter pair
- modeIcon → IconData
-
Return the icon represent to the current theme mode
no setter
- modeIcons → ThemeModeIcons
-
Map of the icons represent to the theme mode
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selected ↔ String
-
Current selected theme name/key
getter/setter pair
- selectedIndex → int
-
Return the current selected index
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
mergeThemes(
ThemeMap themes) → void - Update or insert one or multiple theme(s) to the available themes
-
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
-
removeTheme(
String name) → void - Remove a theme by it's key from the available themes
-
reset(
) → void - Reset all values to the initial provided value
-
resetColor(
) → void - Reset the color scheme to the theme color
-
resetMode(
) → void - Reset the theme mode to initial provided value
-
resetTheme(
) → void - Reset the selected theme to the initial provided value
-
select(
String name) → void - Set the current selected theme
-
selectIndex(
int index) → void -
selectNext(
) → void - Cycle to next theme in the theme list.
-
selectPrev(
) → void - Cycle to prev theme in the theme list.
-
selectRandom(
) → void - Select a random theme
-
setThemes(
ThemeMap themes) → void - Replace the available themes with new value
-
toColor(
Color? color) → void - Override the theme color
-
toDarkMode(
) → void - Set theme mode to ThemeMode.dark
-
toggleMode(
) → void - Toggle theme mode between ThemeMode.light and ThemeMode.dark
-
toLightMode(
) → void - Set theme mode to ThemeMode.light
-
toMode(
ThemeMode mode) → void - Set the theme mode
-
toString(
) → String -
A string representation of this object.
inherited
-
toSystemMode(
) → void - Set theme mode to ThemeMode.system
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- defaultModeIcons → const ThemeModeIcons
- Default map of the icons represent to the theme mode