Container means a parent widget that contain a child widget and manage it, such as width, height, background and so on.
children
of Column
like Text("Hello world")
Container
, you can just replace the Text("Hello world")
like below, it just contain a child with default parameters.Container
.Text("Hello world")
, only if the type of this parameter is a widget, it can be used here.So the example is above, we do not need more explanation for it.EdgeInsetsGeometry
. So we only have two choices: EdgeInsetsDirectional
and EdgeInsets
in the flutter. EdgeInsetsDirectional
is depends on direction of the TextDirection
, its using is the same as EdgeInsets
. Now, let's focus on the class EdgeInsets
, it just depends on the distance from top,bottom, left and right.EdgeInsets
.EdgeInsets
.You can use them as your try, such as below.EdgeInsetsGeometry
. So we can use EdgeInsets
too.AlignmentGeometry
. Alignment
has follow constant.Container
.AlignmentDirectional
to show locate our child widget. Also, we have these constants as following.textDirection
. The using is the same as the Alignment.BoxConstaints
.tight
, loose
and expand
. I will focus on these three constructors, others will remain to you.infinity
, so it will as large as possible in the parent widget. This time, I just show an example with expand
.minHeight,maxHeight=50.0
,minWidth,maxWidth =double.infinity
. Show below.foregroundDecoration
cover on the child, and the child is upon the decoration
. foregroundDecoration
as the same way. The Decoration is abstract class, so you can't use it directly. You must use its child class, let's see its extends relation with two main classes.