A material design app bar.

An app bar consists of a toolbar and potentially other widgets, such as a TabBar and a FlexibleSpaceBar. App bars typically expose one or more common actions with IconButtons which are optionally followed by a PopupMenuButton for less common operations.

App bars are most commonly used in the appBar property, which places the app bar at the top of the app.

The AppBar displays the toolbar widgets, leading, title, and actions, above the bottom (if any). If a flexibleSpace widget is specified then it is stacked behind the toolbar and the bottom widget.

The Scaffold typically creates the app bar with an initial height equal to expandedHeight. If the appBarBehavior is set then the AppBar's collapsedHeight and bottomHeight define how small the app bar will become when the application is scrolled.

See also:

Inheritance

Static Methods

getExpandedHeightFor(BuildContext context) double

Returns the expandedHeight of the AppBar nearest to the given BuildContext.

Constructors

AppBar({Key key, Widget leading, Widget title, List<Widget> actions, Widget flexibleSpace, AppBarBottomWidget bottom, int elevation: 4, Color backgroundColor, Brightness brightness, IconThemeData iconTheme, TextTheme textTheme, EdgeInsets padding: EdgeInsets.zero, bool centerTitle, Object heroTag, double expandedHeight, double collapsedHeight })

Creates a material design app bar.

Properties

actions List<Widget>

Widgets to display after the title widget.

read-only
backgroundColor Color

The color to use for the app bar's material. Typically this should be set along with brightness, iconTheme, textTheme.

read-only
bottom AppBarBottomWidget

This widget appears across the bottom of the appbar.

read-only
bottomHeight double

The height of the bottom widget. The Scaffold uses this value to control the size of the app bar when its appBarBehavior is AppBarBehavior.scroll or AppBarBehavior.under.

read-only
brightness Brightness

The brightness of the app bar's material. Typically this is set along with backgroundColor, iconTheme, textTheme.

read-only
centerTitle bool

Whether the title should be centered.

read-only
collapsedHeight double

By default, the height of the toolbar and the bottom widget (if any). If the height of the app bar is constrained to be less than this value then the toolbar and bottom widget are scrolled upwards, out of view.

read-only
elevation int

The z-coordinate at which to place this app bar.

read-only
expandedHeight double

By default, the total height of the toolbar and the bottom widget (if any). The Scaffold gives its app bar this height initially. If a flexibleSpace widget is specified this height should be big enough to accommodate whatever that widget contains.

read-only
flexibleSpace Widget

This widget is stacked behind the toolbar and the tabbar and it is not inset by the specified padding. It's height will be the same as the the app bar's overall height.

read-only
heroTag Object

The tag to apply to the app bar's Hero widget.

read-only
iconTheme IconThemeData

The color, opacity, and size to use for app bar icons. Typically this is set along with backgroundColor, brightness, textTheme.

read-only
leading Widget

A widget to display before the title.

read-only
padding EdgeInsets

The amount of space by which to inset the contents of the app bar. The Scaffold increases padding.top by the height of the system status bar so that the toolbar appears below the status bar.

read-only
textTheme TextTheme

The typographic styles to use for text in the app bar. Typically this is set along with brightness backgroundColor, iconTheme.

read-only
title Widget

The primary widget displayed in the appbar.

read-only
hashCode int

Get a hash code for this object.

read-only, inherited
key Key

Controls how one widget replaces another widget in the tree.

read-only, inherited
runtimeType Type

A representation of the runtime type of the object.

read-only, inherited

Operators

operator ==(other) bool

The equality operator.

inherited

Methods

build(BuildContext context) Widget

Describes the part of the user interface represented by this widget.

copyWith({Key key, Widget leading, Widget title, List<Widget> actions, Widget flexibleSpace, AppBarBottomWidget bottom, int elevation, Color backgroundColor, Brightness brightness, TextTheme textTheme, EdgeInsets padding, Object heroTag, double expandedHeight, double collapsedHeight }) AppBar

Creates a copy of this app bar but with the given fields replaced with the new values.

createElement() StatelessElement

Creates a StatelessElement to manage this widget's location in the tree.

inherited
debugFillDescription(List<String> description) → void

Add additional information to the given description for use by toString.

inherited
noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
toString() String

Returns a string representation of this object.

inherited
toStringShort() String

A short, textual description of this widget.

inherited