Container means a parent widget that contain a child widget and manage it, such as width, height, background and so on.
Container, you can just replace the
Text("Hello world")like below, it just contain a child with default parameters.
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:
EdgeInsetsin the flutter.
EdgeInsetsDirectionalis 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.You can use them as your try, such as below.
EdgeInsetsGeometry. So we can use
Alignmenthas follow constant.
AlignmentDirectionalto show locate our child widget. Also, we have these constants as following.
textDirection. The using is the same as the Alignment.
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
minWidth,maxWidth =double.infinity. Show below.
foregroundDecorationcover on the child, and the child is upon the
foregroundDecorationas 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.