主题
TabBarTheme
Customizes the appearance of descendant TabBar controls.
属性
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
indicator_size | Optional[TabBarIndicatorSize] | None | Overrides the default value for indicator_size. |
indicator | Optional[UnderlineTabIndicator] | None | Overrides the default value for indicator. |
indicator_animation | Optional[TabIndicatorAnimation] | None | Overrides the default value for indicator_animation. |
splash_border_radius | Optional[BorderRadiusValue] | None | Overrides the default value for splash_border_radius. |
tab_alignment | Optional[TabAlignment] | None | Overrides the default value for tab_alignment. |
overlay_color | Optional[ControlStateValue[ColorValue]] | None | Overrides the default value for overlay_color. |
divider_color | Optional[ColorValue] | None | Overrides the default value for divider_color. |
indicator_color | Optional[ColorValue] | None | Overrides the default value for indicator_color. |
mouse_cursor | Optional[ControlStateValue[Optional[MouseCursor]]] | None | Overrides the default value for mouse_cursor. |
divider_height | Optional[Number] | None | Overrides the default value for divider_height. |
label_color | Optional[ColorValue] | None | Overrides the default value for label_color. |
unselected_label_color | Optional[ColorValue] | None | Overrides the default value for unselected_label_color. |
label_padding | Optional[PaddingValue] | None | Overrides the default value for label_padding. |
label_text_style | Optional[TextStyle] | None | Overrides the default value for label_text_style. |
unselected_label_text_style | Optional[TextStyle] | None | Overrides the default value for unselected_label_text_style. |
示例
Example 1
python
page.theme = ft.Theme(
tabs_theme=ft.TabBarTheme(
divider_color=ft.Colors.BLUE,
indicator_color=ft.Colors.RED,
indicator_tab_size=True,
label_color=ft.Colors.GREEN,
unselected_label_color=ft.Colors.AMBER,
overlay_color={
ft.MaterialState.FOCUSED: ft.Colors.with_opacity(0.2, ft.Colors.GREEN),
ft.MaterialState.DEFAULT: ft.Colors.with_opacity(0.2, ft.Colors.PINK),
},
)
)