CupertinoTabScaffold class

Implements a tabbed iOS application's root layout and behavior structure.

The scaffold lays out the tab bar at the bottom and the content between or behind the tab bar.

A tabBar and a tabBuilder are required. The CupertinoTabScaffold will automatically listen to the provided CupertinoTabBar's tap callbacks to change the active tab.

Tabs' contents are built with the provided tabBuilder at the active tab index. The tabBuilder must be able to build the same number of pages as there are tabBar.items. Inactive tabs will be moved Offstage and their animations disabled.

Use CupertinoTabView as the content of each tab to support tabs with parallel navigation state and history.

Sample code

A sample code implementing a typical iOS information architecture with tabs.

new CupertinoTabScaffold(
  tabBar: new CupertinoTabBar(
    items: <BottomNavigationBarItem> [
      // ...
    ],
  ),
  tabBuilder: (BuildContext context, int index) {
    return new CupertinoTabView(
      builder: (BuildContext context) {
        return new CupertinoPageScaffold(
          navigationBar: new CupertinoNavigationBar(
            middle: new Text('Page 1 of tab $index'),
          ),
          child: new Center(
            child: new CupertinoButton(
              child: const Text('Next page'),
              onPressed: () {
                Navigator.of(context).push(
                  new CupertinoPageRoute<Null>(
                    builder: (BuildContext context) {
                      return new CupertinoPageScaffold(
                        navigationBar: new CupertinoNavigationBar(
                          middle: new Text('Page 2 of tab $index'),
                        ),
                        child: new Center(
                          child: new CupertinoButton(
                            child: const Text('Back'),
                            onPressed: () { Navigator.of(context).pop(); },
                          ),
                        ),
                      );
                    },
                  ),
                );
              },
            ),
          ),
        );
      },
    );
  },
)

See also:

Inheritance

Constructors

CupertinoTabScaffold({Key key, @required CupertinoTabBar tabBar, @required IndexedWidgetBuilder tabBuilder })
Creates a layout for applications with a tab bar at the bottom. [...]
const

Properties

tabBar CupertinoTabBar
The tabBar is a CupertinoTabBar drawn at the bottom of the screen that lets the user switch between different tabs in the main content area when present. [...]
final
tabBuilder IndexedWidgetBuilder
An IndexedWidgetBuilder that's called when tabs become active. [...]
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() → _CupertinoTabScaffoldState
Creates the mutable state for this widget at a given location in the tree. [...]
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