When building mobile applications with Flutter and Dart, two of the most essential layout widgets you will use are Column and Row. These widgets allow you to arrange child widgets either vertically or horizontally in your application’s user interface. In this article, we will explore how to use Column and Row in Dart, complete with detailed examples and case studies for better understanding.

Introduction to Column and Row in Dart
In Flutter, the Column
widget arranges its children vertically from top to bottom, while the Row
widget arranges its children horizontally from left to right. They are fundamental for structuring UIs, whether you are creating simple layouts or complex screen designs. Both widgets are highly customizable, allowing you to manage alignment, spacing, and flexibility with ease.
Why Column and Row Are Important
- Flexibility: You can build almost any design structure using combinations of Column and Row.
- Simplicity: They are intuitive and easy to use, even for beginners.
- Scalability: You can nest multiple Columns and Rows to create responsive layouts.
- Control: They give full control over alignment, spacing, and layout behavior.
Basic Syntax of Column
Column( children: [ Text('Item 1'), Text('Item 2'), Text('Item 3'), ], )
The example above creates a vertical list of three Text
widgets. By default, they are aligned at the top of the available space.
Basic Syntax of Row
Row( children: [ Icon(Icons.home), Icon(Icons.star), Icon(Icons.settings), ], )
The example above places three icons in a horizontal row.
Controlling Alignment
Both Column and Row allow you to control alignment using mainAxisAlignment
and crossAxisAlignment
. Let’s break down how these work:
- Main Axis: The direction of the widget’s layout (vertical for Column, horizontal for Row).
- Cross Axis: The direction perpendicular to the main axis.
Example: Using mainAxisAlignment and crossAxisAlignment
Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('Aligned Text 1'), Text('Aligned Text 2'), Text('Aligned Text 3'), ], )
In this example, the text widgets are centered vertically (main axis) and aligned to the start of the cross axis (left side).
Case Study: Building a Profile Page
Let’s put this knowledge into practice by creating a simple profile screen layout using both Column and Row in Dart.
import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar(title: Text('Profile Page')), body: ProfilePage(), ), ); } } class ProfilePage extends StatelessWidget { @override Widget build(BuildContext context) { return Column( children: [ // Profile picture and name in a row Row( mainAxisAlignment: MainAxisAlignment.center, children: [ CircleAvatar( radius: 40, backgroundImage: AssetImage('assets/profile.jpg'), ), SizedBox(width: 20), Text( 'John Doe', style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold), ), ], ), SizedBox(height: 30), // Contact info using column Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Icon(Icons.email, color: Colors.blue), SizedBox(width: 10), Text('john.doe@email.com'), ], ), SizedBox(height: 10), Row( children: [ Icon(Icons.phone, color: Colors.green), SizedBox(width: 10), Text('+123 456 7890'), ], ), ], ), ], ); } }
In this case study, the Row
widget is used to display the profile picture alongside the user’s name, while the Column
widget is used to stack contact details vertically.
Best Practices When Using Column and Row
- Use Expanded widget: Wrap child widgets in
Expanded
to distribute space evenly. - Combine with Padding: Always use
Padding
orSizedBox
for better spacing control. - Nested Layouts: Don’t hesitate to nest Columns inside Rows and vice versa for complex designs.
- Responsive Design: Use
Flexible
to adapt layouts across different screen sizes.
Example: Responsive Layout with Expanded
Row( children: [ Expanded(child: Container(color: Colors.red, height: 100)), Expanded(child: Container(color: Colors.green, height: 100)), Expanded(child: Container(color: Colors.blue, height: 100)), ], )
In this example, three containers take equal space horizontally because of the Expanded
widget. This ensures a clean and balanced design.
Conclusion
Understanding how to use Column and Row in Dart is fundamental for anyone working with Flutter. These widgets provide powerful tools for building user-friendly and responsive interfaces. By practicing with alignment, spacing, and nesting, you can master Flutter layouts and bring your design ideas to life.
For further details, you can read the official Flutter documentation on Flutter.dev, which provides additional guides and examples.