Implements the basic material design visual layout structure.

This class provides APIs for showing drawers, snack bars, and bottom sheets.

To display a snackbar or a persistent bottom sheet, obtain the ScaffoldState for the current BuildContext via Scaffold.of and use the ScaffoldState.showSnackBar and ScaffoldState.showBottomSheet functions.

See also:

  • AppBar, which is a horizontal bar typically shown at the top of an app using the appBar property.
  • FloatingActionButton, which is a circular button typically shown in the bottom right corner of the app using the floatingActionButton property.
  • Drawer, which is a vertical panel that is typically displayed to the left of the body (and often hidden on phones) using the drawer property.
  • BottomNavigationBar, which is a horizontal array of buttons typically shown along the bottom of the app using the bottomNavigationBar property.
  • SnackBar, which is a temporary notification typically shown near the bottom of the app using the ScaffoldState.showSnackBar method.
  • BottomSheet, which is an overlay typically shown near the bottom of the app. A bottom sheet can either be persistent, in which case it is shown using the ScaffoldState.showBottomSheet method, or modal, in which case it is shown using the showModalBottomSheet function.
  • ScaffoldState, which is the state associated with this widget.
  • material.google.com/layout/structure.html
Inheritance

Static Methods

of(BuildContext context, { bool nullOk: false }) ScaffoldState

The state from the closest instance of this class that encloses the given context.

Constructors

Scaffold({Key key, AppBar appBar, Widget body, Widget floatingActionButton, List<Widget> persistentFooterButtons, Widget drawer, Widget bottomNavigationBar, Color backgroundColor, GlobalKey<ScrollableState> scrollableKey, AppBarBehavior appBarBehavior: AppBarBehavior.anchor, bool resizeToAvoidBottomPadding: true })

Creates a visual scaffold for material design widgets.

Properties

appBar AppBar

An app bar to display at the top of the scaffold.

read-only
appBarBehavior AppBarBehavior

How the appBar should respond to scrolling.

read-only
backgroundColor Color

The color of the Material widget that underlies the entire Scaffold.

read-only
body Widget

The primary content of the scaffold.

read-only
bottomNavigationBar Widget

A bottom navigation bar to display at the bottom of the scaffold.

read-only
drawer Widget

A panel displayed to the side of the body, often hidden on mobile devices.

read-only
floatingActionButton Widget

A button displayed floating above body, in the bottom right corner.

read-only
persistentFooterButtons List<Widget>

A set of buttons that are displayed at the bottom of the scaffold.

read-only
resizeToAvoidBottomPadding bool

Whether the body (and other floating widgets) should size themselves to avoid the window's bottom padding.

read-only
scrollableKey GlobalKey<ScrollableState>

The key of the primary Scrollable widget in the body.

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

createState() ScaffoldState

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
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