Overview
Column is a layout control that arranges child controls vertically, optionally aligning and spacing them within the available space. Children are positioned from top to bottom in the order they appear in the controls list.Basic Example
Class Definition
Properties
controls
A list of controls to display vertically. Controls are arranged from top to bottom in the order they appear in the list.
alignment
How the child controls should be placed vertically along the main (vertical) axis.Options:
MainAxisAlignment.START- Place children at the topMainAxisAlignment.END- Place children at the bottomMainAxisAlignment.CENTER- Place children in the middleMainAxisAlignment.SPACE_BETWEEN- Place free space evenly between childrenMainAxisAlignment.SPACE_AROUND- Place free space evenly between children and half of that space before and afterMainAxisAlignment.SPACE_EVENLY- Place free space evenly between children and before/after the first/last child
horizontal_alignment
Defines how the controls should be placed horizontally along the cross (horizontal) axis.Options:
CrossAxisAlignment.START- Align children to the leftCrossAxisAlignment.END- Align children to the rightCrossAxisAlignment.CENTER- Center children horizontallyCrossAxisAlignment.STRETCH- Stretch children to fill horizontal spaceCrossAxisAlignment.BASELINE- Align children by their text baseline
spacing
Spacing (in pixels) between the child controls.
This property only has effect when
alignment is MainAxisAlignment.START, MainAxisAlignment.END, or MainAxisAlignment.CENTER.tight
Determines how vertical space is allocated.
- If
False(default), children expand to fill the available vertical space. - If
True, only the minimum vertical space required by the children is used.
wrap
Whether the controls should wrap into additional columns (runs) when they don’t fit in a single vertical column.When
True, controls that exceed the available height will wrap horizontally into additional columns.run_spacing
The spacing (in pixels) between runs when
wrap is True.This controls the horizontal spacing between columns when wrapping occurs.run_alignment
How the runs should be placed in the cross-axis when
wrap is True.This controls how multiple columns are aligned horizontally when wrapping is enabled.intrinsic_width
If
True, the Column will be as wide as the widest child control.If False, the Column expands to fill the available width.Layout Behavior
How Children Are Arranged
-
Main Axis (Vertical): Children are placed from top to bottom along the vertical axis according to the
alignmentproperty. -
Cross Axis (Horizontal): Children are aligned horizontally according to the
horizontal_alignmentproperty. -
Spacing: The
spacingproperty adds vertical gaps between children when using START, END, or CENTER alignment. -
Wrapping: When
wrapis enabled, children that don’t fit vertically will wrap into new columns to the right.
Scrolling
Column inherits fromScrollableControl, which means it can be made scrollable: