Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tightly wrap a Column of widgets inside a Card?

Tags:

flutter

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


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!