The Expanded Widget
Improve your rows and columns by assigning the available space to some or all of the children.
We'll cover the following
All important layouts in Flutter use the Row
and Column
widgets. We use them to arrange their children widgets horizontally or vertically. We can also combine them to create a complex layout. Both have a built-in method to align their children with mainAxisAlignment
and crossAxisAlignment
. Sometimes, however, they’re not enough if we want to have a responsive UI.
We’ll learn more about using the aligning methods to improve the responsiveness of our UI in future chapters. For now, we’ll focus on the space taken by each child. For example, look at the following code:
Get hands-on with 1400+ tech skills courses.