A Column widget arranges its child widgets vertically, one below the other, like stacking blocks in a column.
Click to reveal answer
beginner
What does the Row widget do in Flutter?
A Row widget arranges its child widgets horizontally, side by side, like items on a shelf.
Click to reveal answer
intermediate
How do you control the alignment of children inside a Column or Row?
Use properties like mainAxisAlignment to align children along the main axis (vertical for Column, horizontal for Row), and crossAxisAlignment for the opposite axis.
Click to reveal answer
intermediate
What happens if children inside a Row or Column overflow the available space?
If children take more space than available, Flutter shows an overflow error (yellow and black stripes). You can fix this by wrapping children with Expanded or Flexible widgets or using scrolling widgets.
Click to reveal answer
intermediate
Why use Expanded inside a Row or Column?
Expanded tells a child widget to fill the remaining space in the main axis, helping to create flexible layouts that adapt to screen size.
Click to reveal answer
Which widget arranges children vertically in Flutter?
AContainer
BRow
CStack
DColumn
✗ Incorrect
The Column widget stacks children vertically, one below the other.
What property controls the main axis alignment in a Row?
AmainAxisAlignment
BcrossAxisAlignment
Calignment
Ddirection
✗ Incorrect
mainAxisAlignment controls how children are placed along the main axis (horizontal for Row).
If children overflow in a Row, what widget can help fix this?
AText
BExpanded
CPadding
DScaffold
✗ Incorrect
Expanded lets a child fill available space and prevents overflow.
Which axis is the cross axis in a Column?
AHorizontal
BVertical
CDiagonal
DNone
✗ Incorrect
In a Column, the main axis is vertical, so the cross axis is horizontal.
What will happen if you put multiple children in a Row without constraints and they are too wide?
AThey will wrap automatically
BThey will be hidden
COverflow error with yellow-black stripes
DThey will stack vertically
✗ Incorrect
Flutter shows an overflow error if children exceed available space in a Row.
Explain how Column and Row widgets arrange their children and how you can control their alignment.
Think about stacking blocks vertically or lining them up horizontally.
You got /3 concepts.
Describe what causes overflow errors in Column or Row and how to prevent them.
Imagine trying to fit too many items on a small shelf.
You got /4 concepts.
Practice
(1/5)
1. What does the Column widget do in Flutter?
easy
A. Arranges child widgets vertically
B. Arranges child widgets horizontally
C. Stacks child widgets on top of each other
D. Creates a scrollable list of widgets
Solution
Step 1: Understand the purpose of Column
The Column widget arranges its children in a vertical direction, one below the other.
Step 2: Compare with other widgets
Row arranges children horizontally, Stack overlays them, and ListView scrolls.
Final Answer:
Arranges child widgets vertically -> Option A
Quick Check:
Column = vertical layout [OK]
Hint: Column means vertical layout, Row means horizontal [OK]
Common Mistakes:
Confusing Column with Row
Thinking Column stacks widgets
Assuming Column scrolls automatically
2. Which of the following is the correct syntax to create a Row with two Text widgets in Flutter?
easy
A. Row(children: Text('Hello'), Text('World'))
B. Row(children: [Text('Hello'), Text('World')])
C. Row(child: Text('Hello'), Text('World'))
D. Row([Text('Hello'), Text('World')])
Solution
Step 1: Check Row constructor parameters
Row requires a named parameter children which is a list of widgets.
Step 2: Validate each option
Row(children: [Text('Hello'), Text('World')]) uses children: [Text('Hello'), Text('World')] correctly. Others misuse parameters or omit the list.
Final Answer:
Row(children: [Text('Hello'), Text('World')]) -> Option B
Quick Check:
Row needs children list [OK]
Hint: Use children: [widget1, widget2] for Row and Column [OK]
Common Mistakes:
Using child instead of children
Not wrapping widgets in a list
Passing widgets without parameter name
3. What will be the visual output of this Flutter code?
Hint: Column stacks vertically, Row stacks horizontally inside it [OK]
Common Mistakes:
Thinking Row inside Column causes error
Assuming all texts are horizontal
Ignoring nested Row layout
4. Identify the error in this Flutter code snippet:
Row(
children: Text('Hello'),
)
medium
A. children should be a list of widgets, not a single widget
B. Row cannot have Text widgets as children
C. Missing comma after Text widget
D. Row requires a child parameter, not children
Solution
Step 1: Check the children parameter type
The children parameter expects a list of widgets, but here it is given a single Text widget without list brackets.
Step 2: Understand correct syntax
It should be children: [Text('Hello')] to be valid.
Final Answer:
children should be a list of widgets, not a single widget -> Option A
Quick Check:
children = list of widgets [OK]
Hint: Always wrap children widgets in square brackets [OK]
Common Mistakes:
Passing single widget without list
Confusing child and children
Forgetting brackets around children
5. You want to create a layout with three buttons arranged horizontally, each spaced evenly across the screen width. Which Flutter widget combination is best to achieve this?
hard
A. Use a Stack with Positioned widgets for each button
B. Use a Column with MainAxisAlignment.spaceEvenly and three ElevatedButton children
C. Use a Row with CrossAxisAlignment.stretch and three ElevatedButton children
D. Use a Row with MainAxisAlignment.spaceEvenly and three ElevatedButton children
Solution
Step 1: Understand horizontal arrangement
Row arranges children horizontally, which fits the requirement for buttons side by side.
Step 2: Use MainAxisAlignment.spaceEvenly
This property spaces children evenly along the main axis (horizontal for Row), distributing buttons evenly.
Step 3: Evaluate other options
Column arranges vertically, CrossAxisAlignment.stretch stretches vertically, Stack overlays widgets which is not desired.
Final Answer:
Use a Row with MainAxisAlignment.spaceEvenly and three ElevatedButton children -> Option D