Row lays out children in which direction?
Row arranges children horizontally from left to right.
Layout widgets horizontally and vertically
Passing the Quiz & Exercises is mandatory to earn FX and proceed. If you fail, try again to gain the required FX, then the Proceed button will become available.
You can read this lesson publicly. Sign in to unlock exercises, quiz, and FX progress tracking.
Having trouble? AI is here to help
Ask context-aware questions about this lesson. Free plan: 5 questions/day. Upgrade to Premium for higher daily limits.
Use the AI button at the bottom of the screen
Row and Column are the two most important layout widgets in Flutter. Nearly every screen you build will use one or both of them.
1// Row - horizontal layout2Row(3children: [4Icon(Icons.star),5Text('4.5'),6Text('(120 reviews)'),7],8)910// Column - vertical layout11Column(12children: [13Text('Title'),14Text('Subtitle'),15ElevatedButton(onPressed: () {}, child: Text('Action')),16],17)
MainAxisAlignment controls how children are spaced along the main direction of the layout. For a Row, that means horizontally. For a Column, that means vertically.
1Row(2mainAxisAlignment: MainAxisAlignment.spaceBetween,3children: [4Text('Left'),5Text('Right'),6],7)89// Options:10// start - [■ ■ ■ ]11// end - [ ■ ■ ■]12// center - [ ■ ■ ■ ]13// spaceBetween - [■ ■ ■]14// spaceAround - [ ■ ■ ■ ]15// spaceEvenly - [ ■ ■ ■ ]
CrossAxisAlignment controls how children are aligned on the axis perpendicular to the main direction. For a Row, the cross axis is vertical. For a Column, the cross axis is horizontal.
1Row(2crossAxisAlignment: CrossAxisAlignment.start,3children: [4Container(height: 50, width: 50, color: Colors.red),5Container(height: 100, width: 50, color: Colors.blue),6],7)89// Options:10// start - align to top (Row) or left (Column)11// end - align to bottom (Row) or right (Column)12// center - center alignment13// stretch - stretch to fill cross axis
Main axis is the direction of flow (horizontal for Row, vertical for Column). Cross axis is perpendicular to the main axis. Understanding this distinction is key to mastering Flutter layouts.
Here is a common pattern you will see in real Flutter apps: a profile header that combines Row and Column together.
1// Profile header2Row(3children: [4CircleAvatar(radius: 30, child: Text('JD')),5SizedBox(width: 12),6Column(7crossAxisAlignment: CrossAxisAlignment.start,8children: [9Text('John Doe', style: TextStyle(fontWeight: FontWeight.bold)),10Text('Flutter Developer', style: TextStyle(color: Colors.grey)),11],12),13Spacer(), // Pushes everything after it to the end14IconButton(icon: Icon(Icons.more_vert), onPressed: () {}),15],16)
When Row/Column layouts break, debug in this order:
This process solves most layout bugs faster than random property changes.
Layout widgets horizontally and vertically. Widgets are reusable UI blocks. You combine them like LEGO pieces to build screens.
Build confidence with basics first; speed comes later.
Sketch the widget tree first, then code from top to bottom.
Most Flutter productivity comes from understanding layout rules and composing widgets cleanly.
Row arranges children horizontally from left to right.
spaceBetween distributes children with equal space between them, none at edges.
Spacer takes up all available space, pushing siblings to the edges.
For Row, cross axis is vertical, so start means top.
Something seems incorrect, unclear, or missing? Let us know.
FlutterCraft editorial lessons are reviewed by experienced Flutter developers and updated to stay aligned with modern Flutter and Dart best practices.
Reference docs: Flutter Documentation, Dart Language Tour, and official package documentation where relevant.
Sign in to continue with exercises and quiz for this lesson.
Sign In to Continue