To center every child horizontally in a Flutter Column, set crossAxisAlignment: CrossAxisAlignment.center—the default. To center the children vertically as a group, use mainAxisAlignment: MainAxisAlignment.center and give the column finite height with unused space to distribute. The two properties control different axes.
Which alignment property should you use?
A Column arranges children from top to bottom. Its main axis is vertical; its cross axis is horizontal. Choose the property that matches the direction you want to control.
As an Amazon Associate I earn from qualifying purchases.
| Goal | Property or widget | Effect |
|---|---|---|
| Center all children horizontally | crossAxisAlignment: CrossAxisAlignment.center |
Centers children on the horizontal cross axis. This is the default. Flutter Column documentation and CrossAxisAlignment API |
| Align children to the start or end horizontally | CrossAxisAlignment.start or CrossAxisAlignment.end |
Places children at the cross-axis start or end; the precise direction depends on text direction. CrossAxisAlignment API |
| Make children fill the available width | CrossAxisAlignment.stretch |
Gives children tight constraints across the cross axis; this is sizing, not centering. CrossAxisAlignment API |
| Center the children vertically as a group | mainAxisAlignment: MainAxisAlignment.center |
Positions the group in the vertical main axis when the column has free height. Flutter Column documentation and MainAxisAlignment API |
| Distribute children vertically | MainAxisAlignment.spaceBetween, .spaceAround, or .spaceEvenly |
Distributes available main-axis free space in different ways. MainAxisAlignment API |
| Position a single child | Center or Align |
Positions one child within its available space. Flutter Column documentation |
Center children horizontally
For horizontal centering, set crossAxisAlignment. Because the default is already CrossAxisAlignment.center, you can omit it unless making the intent explicit helps readability.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteColumn(
crossAxisAlignment: CrossAxisAlignment.center,
children: const [
Text('First'),
Text('Second'),
],
)
Each child is centered across the column’s width. If you use CrossAxisAlignment.stretch instead, children are given tight cross-axis constraints to fill that space, so they will not behave like naturally sized, horizontally centered children.
#1 Best Overall
Center children vertically as a group
Use mainAxisAlignment: MainAxisAlignment.center to place the children together in the middle of the column’s vertical space:
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Text('First'),
Text('Second'),
],
)
This works visibly only if the column has unused vertical space. If it is only as tall as the combined height of its children, there is no extra space in which to center the group.
Rank #2
Why vertical centering may not appear
The column has no extra height
mainAxisSize controls whether the column tries to occupy the maximum height allowed by its constraints or shrink to the combined size of its children. With MainAxisSize.min, the column shrink-wraps its children subject to those constraints; with MainAxisSize.max, it takes the maximum permitted height. Main-axis alignment distributes or positions children within whatever free space remains.
The parent does not provide a finite height
A column can center children vertically only when its constraints leave it finite free height. A column in a vertically unbounded context, such as a ListView, cannot divide an infinite amount of remaining height among flex children. A non-zero flex child such as Expanded may therefore cause a runtime exception.
If a nested column should occupy the remaining height, constrain it so that remaining space is finite. In a scrolling context with no finite remaining height, remove flex children rather than asking them to expand into unbounded space. The appropriate fix depends on whether the content is meant to fill a bounded area or scroll.
The children are taller than the available space
A Column does not scroll. If its contents exceed the available height, it can overflow; when the content should scroll, Flutter points to ListView as the usual alternative.
Rank #4
Center just one child
If only one widget needs positioning, use Center or Align rather than changing the alignment of every child in the column.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Quick Recap
Best Value
Center(
child: Text('Centered child'),
)
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




