Facebook : / edmtdev
Link donate : http://paypal.me/edmtdev
#Flutter #FlutterEDMTDev #EDMTDev
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.
Layout behavior
See BoxConstraints for an introduction to box layout models.
Since Container combines a number of other widgets each with their own layout behavior, Container's layout behavior is somewhat complicated.
Summary: Container tries, in order: to honor alignment, to size itself to the child, to honor the width, height, and constraints, to expand to fit the parent, to be as small as possible.
More specifically:
If the widget has no child, no height, no width, no constraints, and the parent provides unbounded constraints, then Container tries to size as small as possible.
If the widget has no child and no alignment, but a height, width, or constraints are provided, then the Container tries to be as small as possible given the combination of those constraints and the parent's constraints.
If the widget has no child, no height, no width, no constraints, and no alignment, but the parent provides bounded constraints, then Container expands to fit the constraints provided by the parent.
If the widget has an alignment, and the parent provides unbounded constraints, then the Container tries to size itself around the child.
If the widget has an alignment, and the parent provides bounded constraints, then the Container tries to expand to fit the parent, and then positions the child within itself as per the alignment.
Otherwise, the widget has a child but no height, no width, no constraints, and no alignment, and the Container passes the constraints from the parent to the child and sizes itself to match the child.
The margin and padding properties also affect the layout, as described in the documentation for those properties. (Their effects merely augment the rules described above.) The decoration can implicitly increase the padding (e.g. borders in a BoxDecoration contribute to the padding); see Decoration.padding.
flutter tutorial,flutter tutorial android,flutter tutorial ios,flutter cross platform,flutter tutorial beginner,flutter tutorial for beginners android studio,flutter tutorial in android studio,flutter tutorial app,flutter tutorial android studio,flutter tutorial android studio for beginners,dart flutter tutorial,flutter tutorial for ios,flutter tutorial for beginners,flutter tutorial firebase,flutter tutorial from scratch