Bird
Raised Fist0
Fluttermobile~20 mins

Column and Row in Flutter - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Master of Column and Row
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ ui_behavior
intermediate
2:00remaining
What is the output of this Flutter code snippet?

Consider this Flutter widget tree:

Column(
  children: [
    Text('A'),
    Row(
      children: [
        Text('B'),
        Text('C'),
      ],
    ),
    Text('D'),
  ],
)

How will the texts be arranged on the screen?

Flutter
Column(
  children: [
    Text('A'),
    Row(
      children: [
        Text('B'),
        Text('C'),
      ],
    ),
    Text('D'),
  ],
)
ATexts A and D arranged vertically, with B and C arranged horizontally between them.
BTexts A, B, C, D arranged vertically in a single column.
CTexts A, B, C, D arranged horizontally in a single row.
DTexts A and D arranged horizontally, with B and C arranged vertically between them.
Attempts:
2 left
💡 Hint

Remember that Column arranges children vertically and Row arranges children horizontally.

📝 Syntax
intermediate
1:30remaining
Which option will cause a syntax error in Flutter layout code?

Identify the Flutter code snippet that will cause a syntax error when used inside a widget tree.

AColumn(children: [Text('M'), Text('N')])
BRow(children: [Text('X'), Text('Y')])
CColumn(children: Text('Z'))
DRow(children: [Text('P')])
Attempts:
2 left
💡 Hint

Check the type expected for the children property.

❓ lifecycle
advanced
2:30remaining
What happens if you nest multiple Columns inside a Row with unbounded width?

Consider a Row widget containing several Column widgets, each with many children. What is the likely runtime behavior?

Flutter
Row(
  children: [
    Column(children: List.generate(50, (i) => Text('Item $i'))),
    Column(children: List.generate(50, (i) => Text('Item $i'))),
  ],
)
AThe app will throw a layout overflow error because Row has unbounded width and Columns try to expand infinitely.
BThe app will crash with a null pointer exception.
CThe app will automatically wrap Columns to the next line to avoid overflow.
DThe app will render all items without issues, scrolling horizontally if needed.
Attempts:
2 left
💡 Hint

Think about how Row and Column handle constraints and available space.

❓ navigation
advanced
2:00remaining
How to make a Row with equally spaced children that respond to taps?

You want a Row with three buttons spaced evenly across the screen width. Which code snippet achieves this with proper tap handling?

A
Row(children: [
  ElevatedButton(onPressed: () {}, child: Text('One')),
  ElevatedButton(onPressed: () {}, child: Text('Two')),
  ElevatedButton(onPressed: () {}, child: Text('Three')),
])
B
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
  ElevatedButton(onPressed: () {}, child: Text('One')),
  ElevatedButton(onPressed: () {}, child: Text('Two')),
  ElevatedButton(onPressed: () {}, child: Text('Three')),
])
C
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
  ElevatedButton(onPressed: () {}, child: Text('One')),
  ElevatedButton(onPressed: () {}, child: Text('Two')),
  ElevatedButton(onPressed: () {}, child: Text('Three')),
])
D
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
  ElevatedButton(onPressed: null, child: Text('One')),
  ElevatedButton(onPressed: null, child: Text('Two')),
  ElevatedButton(onPressed: null, child: Text('Three')),
])
Attempts:
2 left
💡 Hint

Check the mainAxisAlignment property and whether buttons are enabled.

🔧 Debug
expert
3:00remaining
Why does this Flutter layout cause a vertical overflow error?

Analyze the code below and identify the cause of the vertical overflow error when rendered on a small screen.

Column(
  children: [
    Expanded(child: ListView(children: [Text('Item 1'), Text('Item 2')])),
    Container(height: 100, color: Colors.blue),
  ],
)
Flutter
Column(
  children: [
    Expanded(child: ListView(children: [Text('Item 1'), Text('Item 2')])),
    Container(height: 100, color: Colors.blue),
  ],
)
AThe ListView inside Expanded tries to take infinite height, conflicting with the fixed height Container.
BThe Column widget does not support Expanded children, causing overflow.
CThe ListView should be wrapped in a SingleChildScrollView to avoid overflow.
DThe Container's fixed height causes the Column to exceed screen height because Expanded takes all remaining space, leaving no room for Container.
Attempts:
2 left
💡 Hint

Consider how Expanded and fixed height widgets share space inside a Column.

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

  1. Step 1: Understand the purpose of Column

    The Column widget arranges its children in a vertical direction, one below the other.
  2. Step 2: Compare with other widgets

    Row arranges children horizontally, Stack overlays them, and ListView scrolls.
  3. Final Answer:

    Arranges child widgets vertically -> Option A
  4. 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

  1. Step 1: Check Row constructor parameters

    Row requires a named parameter children which is a list of widgets.
  2. 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.
  3. Final Answer:

    Row(children: [Text('Hello'), Text('World')]) -> Option B
  4. 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?
Column(
  children: [
    Text('A'),
    Row(
      children: [Text('B'), Text('C')],
    ),
    Text('D'),
  ],
)
medium
A. A vertical list: A, B, C, D all stacked vertically
B. A horizontal list: A, B, C, D all side by side
C. A vertical list: A, then B and C side by side, then D below
D. An error because Row inside Column is not allowed

Solution

  1. Step 1: Analyze the Column layout

    The Column arranges its children vertically: Text('A'), then a Row, then Text('D').
  2. Step 2: Analyze the Row inside Column

    The Row arranges its children horizontally: Text('B') and Text('C') side by side.
  3. Final Answer:

    A vertical list: A, then B and C side by side, then D below -> Option C
  4. Quick Check:

    Column vertical + Row horizontal = mixed layout [OK]
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

  1. 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.
  2. Step 2: Understand correct syntax

    It should be children: [Text('Hello')] to be valid.
  3. Final Answer:

    children should be a list of widgets, not a single widget -> Option A
  4. 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

  1. Step 1: Understand horizontal arrangement

    Row arranges children horizontally, which fits the requirement for buttons side by side.
  2. Step 2: Use MainAxisAlignment.spaceEvenly

    This property spaces children evenly along the main axis (horizontal for Row), distributing buttons evenly.
  3. Step 3: Evaluate other options

    Column arranges vertically, CrossAxisAlignment.stretch stretches vertically, Stack overlays widgets which is not desired.
  4. Final Answer:

    Use a Row with MainAxisAlignment.spaceEvenly and three ElevatedButton children -> Option D
  5. Quick Check:

    Row + spaceEvenly = evenly spaced horizontal buttons [OK]
Hint: Row + spaceEvenly spaces widgets horizontally evenly [OK]
Common Mistakes:
  • Using Column for horizontal layout
  • Confusing main and cross axis alignment
  • Using Stack for simple horizontal layout
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard