RowWidget
Arranges children horizontally from left to right.Basic Usage
Constructor
Factory Function
ColumnWidget
Arranges children vertically from top to bottom.Basic Usage
Constructor
Factory Function
Alignment Options
MainAxisAlignment
Controls alignment along the primary axis (horizontal for Row, vertical for Column):- Start - Align children at the beginning
- Center - Center children
- End - Align children at the end
- SpaceBetween - Distribute children evenly with no space at edges
- SpaceAround - Distribute children evenly with half space at edges
- SpaceEvenly - Distribute children evenly with equal space everywhere
CrossAxisAlignment
Controls alignment along the secondary axis (vertical for Row, horizontal for Column):- Start - Align children at the start
- Center - Center children
- End - Align children at the end
- Stretch - Stretch children to fill the cross axis
Methods
Adding Children
Alignment
Layout
Examples
Basic Row
Basic Column
Row with Spacing
Column with Spacing
Centered Row
Space Between
Nested Layouts
Button Group
Form Layout
Multi-Column Layout
Complete Example
Fromexamples/cpp/new/06_button_styles.cpp:
Best Practices
Use SizedBox for Spacing
Instead of manually positioning widgets, useSizedBox for consistent spacing:
Initialize Widgets at (0, 0)
When using layout widgets, create children at position (0, 0) and let the layout position them:Combine with Center
UseCenter widget to center entire layouts: