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

前端 未结 2 477
误落风尘
误落风尘 2021-02-06 20:34

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

2条回答
  •  我寻月下人不归
    2021-02-06 21:41

    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: [
                  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

提交回复
热议问题