Widgets

TabBar

TabBar

TabBar control. Build it with the tab_bar helper.

Example

tab_bar(
  expand: true,
  width: 240,
  height: 120,
  on_click: ->(event) {}
)

Properties

  • adaptive — Adapts to the platform (Material/Cupertino) when true.
  • divider_color — Divider color.
  • divider_height — Divider height.
  • enable_feedback — Plays touch feedback (sound/haptic) on interaction.
  • indicator — Sets the indicator property.
  • indicator_animation — Sets the indicator animation property.
  • indicator_color — Indicator color.
  • indicator_size — Sets the indicator size property.
  • indicator_thickness — Sets the indicator thickness property.
  • label_color — Label color.
  • label_padding — Label padding.
  • label_text_style — Label text style.
  • mouse_cursor — Cursor shown when hovering the control.
  • overlay_color — Overlay color.
  • padding — Inner spacing between the border and the content.
  • scrollable — Sets the scrollable property.
  • secondary — Sets the secondary property.
  • splash_border_radius — Splash border radius.
  • tab_alignment — Tab alignment.
  • tabs — The tabs to display.
  • unselected_label_color — Unselected label color.
  • unselected_label_text_style — Unselected label text style.

Common layout and animation properties

  • align — Alignment of the control within its parent.
  • animate_align — Animates alignment changes.
  • animate_margin — Animates margin changes.
  • animate_offset — Animates offset changes.
  • animate_opacity — Animates opacity changes.
  • animate_position — Animates position changes.
  • animate_rotation — Animates rotation changes.
  • animate_scale — Animates scale changes.
  • animate_size — Animates size changes.
  • aspect_ratio — Width-to-height ratio to maintain.
  • badge — Badge drawn on the corner of the control.
  • bottom — Bottom offset when positioned inside a stack.
  • col — Responsive column span (1-12) per breakpoint.
  • data — Arbitrary value you can attach to the control and read back in handlers.
  • disabled — Disables interaction when true.
  • expand — Fills the available space along the parent's main axis when true.
  • expand_loose — Like expand, but only grows up to the child's natural size.
  • height — Fixed height in logical pixels.
  • key — Stable identity used to preserve state across rebuilds.
  • left — Left offset when positioned inside a stack.
  • margin — Outer spacing around the control.
  • offset — Translation offset applied to the control.
  • opacity — Opacity from 0.0 (transparent) to 1.0 (opaque).
  • right — Right offset when positioned inside a stack.
  • rotate — Rotation applied to the control.
  • rtl — Renders right-to-left when true.
  • scale — Scale transform applied to the control.
  • size_change_interval — Throttle interval for on_size_change, in ms.
  • tooltip — Text shown on hover/long-press.
  • top — Top offset when positioned inside a stack.
  • visible — Hides the control when false.
  • width — Fixed width in logical pixels.

Events

  • on_animation_end — Fired when an animation completes.
  • on_click — Fired when the control is clicked/tapped.
  • on_hover — Fired when the pointer enters/leaves the control.
  • on_size_change — Fired when the control's size changes.

Reference

  • Family: materials
  • Widget type: tabbar
  • Helpers: tab_bar, tabbar