By WalkingTree   April  10, 2020

Almost every Flutter layout uses rows and columns. They can be spread or hug their children tightly. But what if you want some extra space between your rows or columns? You can just wrap it in the Expanded widget. 

Expanded has two important constructors:

  • Flex
  • Child

Child parameter is used to hold another widget and when multiple children are expanded, the available space is divided using the Flex factor. An Expanded widget must be a descendant of a Row or a Column and the path from the Expanded widget to its Row, Column, or Flex must contain only StatelessWidgets or StatefulWidgets. 

How does the expanded widget actually look like?

How to use the Flex factor?

Translate »