I\'m confused about crossAxisAlignment
and mainAxisAlignment
. Can anyone please explain it in simple words?
When you use a Row
, its children are laid out in a row, which is horizontally. So a Row
's main axis is horizontal.
Using mainAxisAlignment
in a Row
lets you align the row's children horizontally (e.g. left, right).
The cross axis to a Row
's main axis is vertical. So using crossAxisAlignment
in a Row
lets you define, how its children are aligned vertically.
In a Column
, it's the opposite. The children of a column are laid out vertically, from top to bottom (per default). So its main axis is vertical. This means, using mainAxisAlignment
in a Column
aligns its children vertically (e.g. top, bottom) and crossAxisAlignment
defines how the children are aligned horizontally in that Column.