A convenience widget that combines common painting, positioning, and sizing widgets.

A container first surrounds the child with padding (inflated by any borders present in the decoration) and then applies additional constraints to the padded extent (incorporating the width and height as constraints, if either is non-null). The container is then surrounded by additional empty space described from the margin.

During painting, the container first applies the given transform, then paints the decoration to fill the padded extent, then it paints the child, and finally paints the foregroundDecoration, also filling the padded extent.

Containers with no children try to be as big as possible unless the incoming constraints are unbounded, in which case they try to be as small as possible. Containers with children size themselves to their children. The width, height, and constraints arguments to the constructor override this.

Inheritance

Constructors

Container({Key key, FractionalOffset alignment, EdgeInsets padding, Color color, Decoration decoration, Decoration foregroundDecoration, double width, double height, BoxConstraints constraints, EdgeInsets margin, Matrix4 transform, Widget child })

Creates a widget that combines common painting, positioning, and sizing widgets.

Properties

alignment FractionalOffset

Align the child within the container.

final
child Widget

The child contained by the container.

final
constraints BoxConstraints

Additional constraints to apply to the child.

final
decoration Decoration

The decoration to paint behind the child.

final
foregroundDecoration Decoration

The decoration to paint in front of the child.

final
margin EdgeInsets

Empty space to surround the decoration and child.

final
padding EdgeInsets

Empty space to inscribe inside the decoration. The child, if any, is placed inside this padding.

final
transform Matrix4

The transformation matrix to apply before painting the container.

final
hashCode int

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

Operators

operator ==(other) bool

The equality operator.

inherited

Methods

build(BuildContext context) Widget

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

debugFillDescription(List<String> description) → void

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

createElement() StatelessElement

Creates a StatelessElement 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