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.

Static Methods

hasDrawer(BuildContext context, { bool registerForUpdates: true }) bool

Whether the Scaffold that most tightly encloses the given context has a drawer.

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

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


Scaffold({Key key, PreferredSizeWidget appBar, Widget body, Widget floatingActionButton, List<Widget> persistentFooterButtons, Widget drawer, Widget bottomNavigationBar, Color backgroundColor, bool resizeToAvoidBottomPadding: true, bool primary: true })

Creates a visual scaffold for material design widgets.



→ dynamic

read / write
→ dynamic

read / write
→ dynamic

read / write
appBar PreferredSizeWidget

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

backgroundColor Color

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

body Widget

The primary content of the scaffold.

bottomNavigationBar Widget

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

drawer Widget

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

floatingActionButton Widget

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

persistentFooterButtons List<Widget>

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

primary bool

Whether this scaffold is being displayed at the top of the screen.

resizeToAvoidBottomPadding bool

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

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


operator ==(other) bool

The equality operator.



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.

debugFillDescription(List<String> description) → void

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

mustCallSuper, protected, inherited
noSuchMethod(Invocation invocation) → dynamic

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

toString() String

Returns a string representation of this object.

toStringShort() String

A short, textual description of this widget.