Home > Blockchain >  Flutter: Is there any difference between these layouts?
Flutter: Is there any difference between these layouts?

Time:05-29

In flutter, Is there any difference between these layouts? -

  • Expanded
  • SizedBox.expand
  • BoxConstraints.expand()

If all are same, why there are multiple layout classes/functions for same functionality?

CodePudding user response:

As far as I know.

Expanded widget can only used inside of Row, Column and Flex. It helps to expand the children based on the flex value. By default - it's 1.

SizedBox.expand - It will expand the child as large as it's parent allows. You can put anywhere unlike Expanded.

BoxConstraints.expand - Usually takes as object of ConstrainedBox constraints property.

From the documentation -

Creates box constraints that expand to fill another box constraints.

If width or height is given, the constraints will require exactly the given value in the given dimension.

  • Related