Skip to content

TabBarTheme

Customizes the appearance of descendant TabBar controls.

属性 ​

名称类型默认值说明
indicator_sizeOptional[TabBarIndicatorSize]NoneOverrides the default value for indicator_size.
indicatorOptional[UnderlineTabIndicator]NoneOverrides the default value for indicator.
indicator_animationOptional[TabIndicatorAnimation]NoneOverrides the default value for indicator_animation.
splash_border_radiusOptional[BorderRadiusValue]NoneOverrides the default value for splash_border_radius.
tab_alignmentOptional[TabAlignment]NoneOverrides the default value for tab_alignment.
overlay_colorOptional[ControlStateValue[ColorValue]]NoneOverrides the default value for overlay_color.
divider_colorOptional[ColorValue]NoneOverrides the default value for divider_color.
indicator_colorOptional[ColorValue]NoneOverrides the default value for indicator_color.
mouse_cursorOptional[ControlStateValue[Optional[MouseCursor]]]NoneOverrides the default value for mouse_cursor.
divider_heightOptional[Number]NoneOverrides the default value for divider_height.
label_colorOptional[ColorValue]NoneOverrides the default value for label_color.
unselected_label_colorOptional[ColorValue]NoneOverrides the default value for unselected_label_color.
label_paddingOptional[PaddingValue]NoneOverrides the default value for label_padding.
label_text_styleOptional[TextStyle]NoneOverrides the default value for label_text_style.
unselected_label_text_styleOptional[TextStyle]NoneOverrides 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),
        },
    )
)

关注我,学习大模型、大数据、Python等热门技术。