I have a page of my app that consists solely of a Card
that holds a Column
at the end of which is a MaterialList
. Even if my list only has
By default, Column
expands to fill the maximum vertical space. You can change this behavior by setting the mainAxisSize
property to MainAxisSize.min
, which causes the Column
to take up only the minimum amount of vertical space it needs to fit its children.
Wrap widget may come to rescue if anyone wants to shrink its list, which exacts similar to @Adam answer
body: Container(
child: Card(
child: Wrap(
direction: Axis.vertical,
spacing: 10,
children: <Widget>[
Text('One'),
Text('Two'),
Text('Three'),
Text('Four'),
],
),
),
),
but this Wrap can do the job of both Row & Column if you add Column for Axis.vertical & Row for Axis.Horizontal. Also you can add equal spacing to all inbetween widgets which is missing in Column & Row