CupertinoToolbar constructor

CupertinoToolbar(
  1. {Key key,
  2. @required List<CupertinoToolbarItem> items,
  3. @required Widget body}
)

Creates a persistent bottom iOS styled toolbar for Cupertino themed app,

Typically used as the child attribute of a CupertinoPageScaffold.

{@tool sample}

A sample code implementing a typical iOS page with bottom toolbar.

CupertinoPageScaffold(
	navigationBar: CupertinoNavigationBar(
		middle: Text('Cupertino Toolbar')
	),
	child: CupertinoToolbar(
		items: <CupertinoToolbarItem>[
			CupertinoToolbarItem(
				icon: CupertinoIcons.delete,
				onPressed: () {}
			),
			CupertinoToolbarItem(
				icon: CupertinoIcons.settings,
				onPressed: () {}
			)
		],
		body: Center(
			child: Text('Hello World')
		)
	)
)

{@end-tool}

Implementation

CupertinoToolbar({
  Key key,
  @required this.items,
  @required this.body
}) : assert(items != null),
     assert(
      items.every((CupertinoToolbarItem item) => (item.icon != null && item.onPressed != null)) == true,
      'Every item must have an icon and onPressed defined',
     ),
     assert(body != null),
     super(key: key);