MiuixThemeController class
管理并解析当前 Miuix 配色,向子树提供 MiuixTheme。对应 Kotlin ThemeController。
按 colorSchemeMode 决定配色来源:
- system/light/dark → 直接用 lightColors/darkColors(跟随系统或强制明暗)。
- monet* → 动态取色:
- keyColor 非空 → 同步 miuixColorsFromSeed(纯 HCT 计算)。
- keyColor 为空 → 异步 miuixPlatformDynamicColors(Android 壁纸;其他平台回退 固定种子)。结果就绪前用 miuixMonetSystemColors 占位,避免闪烁。
参数含义与原版一致。isDark 为 null 时跟随系统亮度(MediaQuery.platformBrightnessOf)。
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- MiuixThemeController
Constructors
- MiuixThemeController({Key? key, MiuixColorSchemeMode colorSchemeMode = MiuixColorSchemeMode.system, MiuixColors? lightColors, MiuixColors? darkColors, MiuixTextStyles? textStyles, int? fontWeightAdjustment, int boldTextFontWeightAdjustment = 100, Color? keyColor, MiuixThemeColorSpec colorSpec = MiuixThemeColorSpec.spec2021, MiuixThemePaletteStyle paletteStyle = MiuixThemePaletteStyle.tonalSpot, bool? isDark, required Widget child})
-
const
Properties
- boldTextFontWeightAdjustment → int
-
自动模式下,系统「粗体文字」开启时施加的字重偏移量,默认 +100(一档)。
final
- child → Widget
-
final
- colorSchemeMode → MiuixColorSchemeMode
-
配色模式。对应 Kotlin
colorSchemeMode。final - colorSpec → MiuixThemeColorSpec
-
配色规范版本。对应 Kotlin
colorSpec。final - darkColors → MiuixColors?
-
深色静态配色,默认 darkColorScheme。对应 Kotlin
darkColors。final - fontWeightAdjustment → int?
-
显式指定全局字重偏移量(权重数值,100 为一档)。为 null(默认)时自动跟随系统
MediaQuery.boldText:开启时加 boldTextFontWeightAdjustment,关闭时为 0。 见 MiuixThemeData.fontWeightAdjustment。final - hashCode → int
-
The hash code for this object.
no setterinherited
- isDark → bool?
-
是否深色。null 时跟随系统。对应 Kotlin
isDark。final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyColor → Color?
-
动态取色的种子色。对应 Kotlin
keyColor。为 null 时 monet 模式走平台壁纸取色。final - lightColors → MiuixColors?
-
浅色静态配色,默认 lightColorScheme。对应 Kotlin
lightColors。final - paletteStyle → MiuixThemePaletteStyle
-
palette 风格。对应 Kotlin
paletteStyle。final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textStyles → MiuixTextStyles?
-
文本样式,默认 defaultTextStyles。
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< MiuixThemeController> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited