MaterialBanner class

A Material Design banner.

A banner displays an important, succinct message, and provides actions for users to address (or dismiss the banner). A user action is required for it to be dismissed.

Banners should be displayed at the top of the screen, below a top app bar. They are persistent and nonmodal, allowing the user to either ignore them or interact with them at any time.

The actions will be placed beside the content if there is only one. Otherwise, the actions will be placed below the content. Use forceActionsBelow to override this behavior.

The actions and content must be provided. An optional leading widget (typically an Image) can also be provided. The contentTextStyle and backgroundColor can be provided to customize the banner.

This widget is unrelated to the widgets library Banner widget.

Inheritance

Constructors

MaterialBanner({Key key, @required Widget content, TextStyle contentTextStyle, @required List<Widget> actions, Widget leading, Color backgroundColor, EdgeInsetsGeometry padding, EdgeInsetsGeometry leadingPadding, bool forceActionsBelow: false })
Creates a MaterialBanner. [...]
const

Properties

actions List<Widget>
The set of actions that are displayed at the bottom or trailing side of the MaterialBanner. [...]
final
backgroundColor Color
The color of the surface of this MaterialBanner. [...]
final
content Widget
The content of the MaterialBanner. [...]
final
contentTextStyle TextStyle
Style for the text in the content of the MaterialBanner. [...]
final
forceActionsBelow bool
An override to force the actions to be below the content regardless of how many there are. [...]
final
leading Widget
The (optional) leading widget of the MaterialBanner. [...]
final
leadingPadding EdgeInsetsGeometry
The amount of space by which to inset the leading widget. [...]
final
padding EdgeInsetsGeometry
The amount of space by which to inset the content. [...]
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

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget. [...]
override
createElement() StatelessElement
Creates a StatelessElement 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 DiagnosticsNode.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