A piece of material.

Material is the central metaphor in material design. Each piece of material exists at a given elevation, which influences how that piece of material visually relates to other pieces of material and how that material casts shadows on other pieces of material.

Most user interface elements are either conceptually printed on a piece of material or themselves made of material. Material reacts to user input using InkSplash and InkHighlight effects. To trigger a reaction on the material, use a MaterialInkController obtained via Material.of.

If the layout changes (e.g. because there's a list on the paper, and it's been scrolled), a LayoutChangedNotification must be dispatched at the relevant subtree. (This in particular means that Transitions should not be placed inside Material.) Otherwise, in-progress ink features (e.g., ink splashes and ink highlights) won't move to account for the new layout.

In general, the features of a Material should not change over time (e.g. a Material should not change its color or type). The one exception is the elevation, changes to which will be animated.

See also:

Inheritance

Static Methods

of(BuildContext context) MaterialInkController

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

Constructors

Material({Key key, MaterialType type: MaterialType.canvas, int elevation: 0, Color color, TextStyle textStyle, BorderRadius borderRadius, Widget child })

Creates a piece of material.

Properties

borderRadius BorderRadius

If non-null, the corners of this box are rounded by this BorderRadius. Otherwise, the corners specified for the current type of material are used.

read-only
child Widget

The widget below this widget in the tree.

read-only
color Color

The color to paint the material.

read-only
elevation int

The z-coordinate at which to place this material.

read-only
textStyle TextStyle

The typographical style to use for text within this material.

read-only
type MaterialType

The kind of material to show (e.g., card or canvas). This affects the shape of the widget, the roundness of its corners if the shape is rectangular, and the default color.

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() → _MaterialState

Creates the mutable state for this widget at a given location in the tree.

debugFillDescription(List<String> description) → void

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

createElement() StatefulElement

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

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