Mobile development

Stage 2 · Lesson 3 of 10

Constraints go down, sizes go up

Widgets and layout

layout follows one rule. A parent passes , a minimum and maximum width and height, down to each child. The child picks a size within them and reports it back up.

The parent then decides where to place it. A cannot choose its own position or ignore its constraints. Once this clicks, the famous errors make sense.

The yellow and black striped overflow bar means a child wanted more space than it was allowed. An "unbounded height" error means a ListView inside a was offered endless height. Read the official "Understanding constraints" page and work through its examples.

Common trapwrapping widgets in SizedBox and Container at random until the error goes away.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with

  • GuideFree
    Flutter Documentation

    Google

    Do the first Flutter app codelab, then the layout, constraints and lists pages

Practise

  • Use a free challenge's mobile design image as the spec for a native screen

Keep handy

Mark this stage as not done?