Skip to main content

Module theme

Module theme 

Source
Expand description

阶段 4-A:Theme + Direction — 第一个 InheritedWidget 用例

设计文档 § 6 + § 19.Theme:全局视觉风格沿树向下传递。

ⓘ
ThemeWidget::new(ThemeData::dark())
    .direction(Direction::Ltr)
    .child(MyApp())

任何后代 widget 在 state.build(ctx) 中调 ctx.depend_on::<ThemeWidget>() 或 便捷的 ctx.theme() / ctx.direction() 拿当前主题。

Structs§

ButtonStyle
Button style defaults.
DialogStyle
Dialog 遮罩 + 对话框样式。
DirectionWidget
单独的 Direction 提供者,方便只想换方向不换主题的场景。
DropdownStyle
Dropdown 触发器 + 弹出面板样式。
FeedbackStyle
反馈类组件样式(进度条 / Toast 等)。
InputStyle
TextField / 输入框样式(IDEA 风格:无边框底色 + 焦点蓝边)。
ListStyle
ListView / 列表类样式。
MenuStyle
菜单 / 右键 ContextMenu / 下拉列表样式。
NavStyle
NavigationMenu 样式。
ScrollbarStyle
Scrollbar style defaults (ListView + ScrollView).
TabStyle
TabBar / TabView / TabbedPane 样式。
TextStyleTheme
TextTheme
Text style defaults (theme-level). Individual TextWidget can override via TextStyle.
ThemeData
主题色板 + 子主题。
ThemeWidget
Theme 提供者 widget。挂到树中,所有后代可通过 ctx.theme() 访问。
TooltipStyle
Tooltip 浮层样式。

Enums§

Direction

Functions§

resolve_color
用户显式颜色优先,否则回退到主题/token 值。
resolve_f32
数值版 resolve_color:显式尺寸/宽度优先,否则用主题/回退值。