TabBar class
A horizontal row of Tab widgets that lets the user switch views.
Highlights the active tab and calls onTap when a new tab is selected. Must be used with a TabController (typically via DefaultTabController).
- Inheritance
-
- Object
- Widget
- StatefulWidget
- TabBar
Constructors
-
TabBar({Key? key, required List<
Tab> tabs, TabController? controller, Color? indicatorColor, Color? labelColor, Color? unselectedLabelColor, TextStyle? labelStyle, TextStyle? unselectedLabelStyle, EdgeInsets? labelPadding, ValueChanged<int> ? onTap, FocusNode? focusNode}) -
Creates a TabBar with the given
tabs.const
Properties
- controller → TabController?
-
An optional external TabController; defaults to DefaultTabController.of.
final
- focusNode → FocusNode?
-
An optional focus node for keyboard navigation.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- indicatorColor → Color?
-
The color of the active tab indicator line.
final
- key → Key?
-
Controls how one widget replaces another in the tree.
finalinherited
- labelColor → Color?
-
The text color of the selected tab.
final
- labelPadding → EdgeInsets?
-
Padding around each tab label.
final
- labelStyle → TextStyle?
-
The text style of the selected tab label.
final
-
onTap
→ ValueChanged<
int> ? -
Called when the user taps a tab, receiving the new index.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
tabs
→ List<
Tab> -
The list of Tab widgets to display.
final
- unselectedLabelColor → Color?
-
The text color of unselected tabs.
final
- unselectedLabelStyle → TextStyle?
-
The text style of unselected tab labels.
final
Methods
-
createElement(
) → StatefulElement -
Creates the Element for this widget.
inherited
-
createState(
) → State< TabBar> -
Creates the mutable state for this widget.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited