Container class
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 width and height sizing to the padded extent. The container is then surrounded by additional empty space described from the margin.
During painting, the container 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 small as possible within terminal constraints. Containers with children size themselves to their children. The width and height arguments to the constructor override this.
- Inheritance
-
- Object
- Widget
- StatelessWidget
- Container
Constructors
- Container({Alignment? alignment, EdgeInsets? padding, Color? color, BoxDecoration? decoration, BoxDecoration? foregroundDecoration, int? width, int? height, BoxConstraints? constraints, EdgeInsets? margin, Widget? child, Key? key})
-
Creates a widget that combines common painting, positioning, and sizing widgets.
const
Properties
- alignment → Alignment?
-
Align the child within the container.
final
- child → Widget?
-
The child contained by the container.
final
- color → Color?
-
The color to paint behind the child.
final
- constraints → BoxConstraints?
-
Additional constraints to apply to the child.
final
- decoration → BoxDecoration?
-
The decoration to paint behind the child.
final
- foregroundDecoration → BoxDecoration?
-
The decoration to paint in front of the child.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → int?
-
If non-null, the height of this widget in terminal character cells.
final
- key → Key?
-
Controls how this widget replaces another of the same type.
finalinherited
- 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
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- width → int?
-
If non-null, the width of this widget in terminal character cells.
final
Methods
-
build(
BuildContext context) → Widget -
Properties REMOVED for terminal compatibility:
override
-
createElement(
) → Element -
Inflates this widget into a concrete Element.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited