Container Widget

Container widget just like "div" in HTML. It is used to contain child widget and manages its layout like padding, margin, background color etc. You can use following argument to customize the widget.

color

The color argument specifies the background color of the container widget. Learn how to specify color in Colors Section.

padding

This argument is used to specify the padding of the widget. The distance between the container edge and its child edge. The padding is specified using EdgeInsets class.

width

It specifies the width of the container.

height

It specifies the height of the container.

margin

It specifies the margin. The value is specified the same way we specify padding, which is using EdgeInsets. Margin is the distance between the container edge and its nearest widget edge.

Even though the Container widget can have margin argument, but note that in flutter there's no concept of margin at all. Even margin is achieved with an outer Padding widget. When you use margin argument, the Container widget creates an outer Padding widget and set the Container as child. That's why there's no margin widget in flutter.

alignment

This argument specifies the position of the child. Learn how to specify alignment in flutter in Alignment section.

decoration

Decoration argument is used to decorate box in varius way. Like you can set background color, or background gradient, or background image. You can also control the roundness of border and set border etc. To know more how it is done head to Decoration chapter.