Understanding constraints

UI

Layout

Understanding constraints

Note:
  To better understand how Flutter implements layout
  constraints, check out the following 5-minute video:

Decoding Flutter: Unbounded height and width

When someone learning Flutter asks you why some widget
with width:100 isn’t 100 pixels wide,
the default answer is to tell them to put that widget
inside of a Center, right?

Don’t do that.

If you do, they’ll come back again and again,
asking why some FittedBox isn’t working,
why that Column is overflowing, or what
IntrinsicWidth is supposed to be doing.

Instead, first tell them that Flutter layout is very different
from HTML layout (which is probably where they’re coming from),
and then make them memorize the following rule:

Constraints go down. Sizes go up. Parent sets position.