I'm confused about crossAxisAlignment
and mainAxisAlignment
. Can anyone please explain it in simple words?
Main Axis is vertical and the Cross Axis is horizontal. MainAxisAlignment aligns its children vertically and CrossAxisAlignment aligns horizontally in that Column.
A Row 's main axis is horizontal, and a Column 's main axis is vertical. The mainAxisSize property determines how much space a Row and Column can occupy on their main axes. The mainAxisSize property has two possible values: MainAxisSize.
Place the free space evenly between the children as well as before and after the first and last child. Place the children as close to the start of the main axis as possible. If this value is used in a horizontal direction, a TextDirection must be available to determine if the start is the left or the right.
For Row:
mainAxisAlignment
= Horizontal AxiscrossAxisAlignment
= Vertical Axis
For Column:
mainAxisAlignment
= Vertical AxiscrossAxisAlignment
= Horizontal Axis
Image source
This two pictures are clear to show the meaning of MainAxisAlignment and CrossAxisAlignment.
(Pictures are from Network)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With