Flutter Row vs Column: The Ultimate Alignment Cheat Sheet (2025)



This content originally appeared on DEV Community and was authored by SRF DEVELOPER

This guide was originally published on SRF Developer. Check out the blog for visual diagrams.

If you are coming from CSS (Flexbox), Flutter layouts will feel familiar but slightly different.

In Flutter, we don’t use display: flex. We use two specific widgets:

  • Row: Lays out children horizontally (Side-by-Side).
  • Column: Lays out children vertically (Top-to-Bottom).

The biggest confusion for beginners is understanding MainAxis vs CrossAxis.

💡 The Alignment Cheat Sheet

Save this table. It solves 99% of layout headaches.

Property In a ROW (→) In a COLUMN (↓)
MainAxisAlignment Controls Horizontal (Left/Right) Controls Vertical (Up/Down)
CrossAxisAlignment Controls Vertical (Up/Down) Controls Horizontal (Left/Right)

💻 Basic Usage Code

Here is a Column that centers its items vertically and horizontally:

Column(
  mainAxisAlignment: MainAxisAlignment.center, // Vertical center
  crossAxisAlignment: CrossAxisAlignment.center, // Horizontal center
  children: [
    Icon(Icons.star, size: 50),
    Text('I am below the star'),
  ],
)

⚠ Common Error: The “Yellow & Black” Tape

If your content is too wide for the screen, Flutter shows a yellow and black hazard tape (Overflow Error).

The Fix: Wrap the overflowing widget in an Expanded() or Flexible() widget.

Row(
  children: [
    Icon(Icons.person),
    // This text will shrink if the screen is too small
    Expanded(
      child: Text('This is a very long username that might not fit...'),
    ),
  ],
)

🚀 Pro Tip: SpaceBetween

Want to push one item to the left and one to the right (like a header)? Use MainAxisAlignment.spaceBetween.

Row(
  mainAxisAlignment: MainAxisAlignment.spaceBetween,
  children: [
    Text("Left"),
    Text("Right"),
  ],
)

Conclusion

Mastering Row and Column is 80% of Flutter UI development. Just remember: MainAxis flows with the widget, CrossAxis flows against it.

Want to build complex dashboards? Check out the full Flutter Course on SRF Developer.


This content originally appeared on DEV Community and was authored by SRF DEVELOPER