CupertinoTabBar class

An iOS-styled bottom navigation tab bar.

Displays multiple tabs using BottomNavigationBarItem with one tab being active, the first tab by default.

This StatelessWidget doesn't store the active tab itself. You must listen to the onTap callbacks and call setState with a new currentIndex for the new selection to reflect. This can also be done automatically by wrapping this with a CupertinoTabScaffold.

Tab changes typically trigger a switch between Navigators, each with its own navigation stack, per standard iOS design. This can be done by using CupertinoTabViews inside each tab builder in CupertinoTabScaffold.

If the given backgroundColor's opacity is not 1.0 (which is the case by default), it will produce a blurring effect to the content behind it.

See also:

Inheritance
Implemented types

Constructors

CupertinoTabBar({Key key, @required List<BottomNavigationBarItem> items, ValueChanged<int> onTap, int currentIndex: 0, Color backgroundColor, Color activeColor, Color inactiveColor: CupertinoColors.inactiveGray, double iconSize: 30.0, Border border: const Border(top: BorderSide(color: _kDefaultTabBarBorderColor, width: 0.0, style: BorderStyle.solid)), bool showIndicator: true })
Creates a tab bar in the iOS style.

Properties

activeColor Color
The foreground color of the icon and title for the BottomNavigationBarItem of the selected tab. [...]
final
backgroundColor Color
The background color of the tab bar. If it contains transparency, the tab bar will automatically produce a blurring effect to the content behind it. [...]
final
border Border
The border of the CupertinoTabBar. [...]
final
currentIndex → int
The index into items of the current active item. [...]
final
iconSize → double
The size of all of the BottomNavigationBarItem icons. [...]
final
inactiveColor Color
The foreground color of the icon and title for the BottomNavigationBarItems in the unselected state. [...]
final
items → List<BottomNavigationBarItem>
The interactive items laid out within the bottom navigation bar. [...]
final
onTap ValueChanged<int>
The callback that is called when a item is tapped. [...]
final
preferredSize Size
The size this widget would prefer if it were otherwise unconstrained. [...]
read-only, override
showIndicator → bool
when the icon is null, will add ad indicator.
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

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget. [...]
override
copyWith({Key key, List<BottomNavigationBarItem> items, Color backgroundColor, Color activeColor, Color inactiveColor, Size iconSize, Border border, int currentIndex, ValueChanged<int> onTap, bool showIndicator }) CupertinoTabBar
Create a clone of the current CupertinoTabBar but with provided parameters overridden.
opaque(BuildContext context) → bool
Indicates whether the tab bar is fully opaque or can have contents behind it show through it.
createElement() StatelessElement
Creates a StatelessElement 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 DiagnosticsNode.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