TabBar class

A material design widget that displays a horizontal row of tabs.

Typically created as the AppBar.bottom part of an AppBar and in conjunction with a TabBarView.

If a TabController is not provided, then a DefaultTabController ancestor must be provided instead. The tab controller's TabController.length must equal the length of the tabs list.

Requires one of its ancestors to be a Material widget.

Uses values from TabBarTheme if it is set in the current context.

See also:

  • TabBarView, which displays page views that correspond to each tab.
Inheritance
Implemented types

Constructors

TabBar({Key key, @required List<Widget> tabs, TabController controller, bool isScrollable: false, Color indicatorColor, double indicatorWeight: 2.0, EdgeInsetsGeometry indicatorPadding: EdgeInsets.zero, Decoration indicator, TabBarIndicatorSize indicatorSize, Color labelColor, TextStyle labelStyle, EdgeInsetsGeometry labelPadding, Color unselectedLabelColor, TextStyle unselectedLabelStyle })
Creates a material design tab bar. [...]
const

Properties

controller TabController
This widget's selection and animation state. [...]
final
indicator Decoration
Defines the appearance of the selected tab indicator. [...]
final
indicatorColor Color
The color of the line that appears below the selected tab. If this parameter is null then the value of the Theme's indicatorColor property is used. [...]
final
indicatorPadding EdgeInsetsGeometry
The horizontal padding for the line that appears below the selected tab. For isScrollable tab bars, specifying kTabLabelPadding will align the indicator with the tab's text for Tab widgets and all but the shortest Tab.text values. [...]
final
indicatorSize TabBarIndicatorSize
Defines how the selected tab indicator's size is computed. [...]
final
indicatorWeight double
The thickness of the line that appears below the selected tab. The value of this parameter must be greater than zero. [...]
final
isScrollable bool
Whether this tab bar can be scrolled horizontally. [...]
final
labelColor Color
The color of selected tab labels. [...]
final
labelPadding EdgeInsetsGeometry
The padding added to each of the tab labels. [...]
final
labelStyle TextStyle
The text style of the selected tab labels. If unselectedLabelStyle is null then this text style will be used for both selected and unselected label styles. [...]
final
preferredSize Size
A size whose height depends on if the tabs have both icons and text. [...]
read-only, override
tabs List<Widget>
Typically a list of two or more Tab widgets. [...]
final
unselectedLabelColor Color
The color of unselected tab labels. [...]
final
unselectedLabelStyle TextStyle
The text style of the unselected tab labels [...]
final
hashCode int
The hash code for this object. [...]
read-only, inherited
key Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

createState() → _TabBarState
Creates the mutable state for this widget at a given location in the tree. [...]
override
createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree. [...]
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toDiagnosticsNode({String name, DiagnosticsTreeStyle style }) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by toStringDeep. [...]
inherited
toString({DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a string representation of this object.
inherited
toStringDeep({String prefixLineOne: '', String prefixOtherLines, DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a string representation of this node and its descendants. [...]
inherited
toStringShallow({String joiner: ', ', DiagnosticLevel minLevel: DiagnosticLevel.debug }) String
Returns a one-line detailed description of the object. [...]
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited