Text wrapping in cols/rows

Column text wrapping

  • Column gives children BOUNDED width (from parent), UNBOUNDED height.
  • Text widget sees “here’s max width, infinite height available” → wraps to fit width.
  • No Expanded needed because text naturally wraps when width constrained.

Using expanding in unconstrained row

  • Row in Column with mainAxisSize.min gets UNBOUNDED height.
  • CrossAxisAlignment.stretch tries to give children TIGHT vertical constraints matching “max height”
    • but max height is infinite → constraint conflict/error.

When wrapped in Expanded:

  • Children become flex participants
  • Get allocated specific horizontal space first
  • Stretch then applies with actual bounded constraints
  • Works because flex layout phase runs before cross-axis alignment