我有一个应用程序,使用GridView
来布局一些Card
。相关代码看起来像这样:
body: new GridView.count(
crossAxisCount: 2,
children: [new Card(
child: new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const ListTile(
leading: const Text("0", style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 24.0)),
title: const Text('Some Heading'),
subtitle: const Text('My Subtitle'),
),
new ButtonTheme
.bar( // make buttons use the appropriate styles for cards
child: new ButtonBar(
children: <Widget>[
new FlatButton(
child: const Text('CALL TO ACTION'),
onPressed: () {
/* ... */
},
),
],
),
),
],
),
),
// same card repeated
],
),
不幸的是,它的呈现效果不好:
卡片太高了,应该在“CALL TO ACTION”按钮的下方结束。我该如何解决这个问题,并使网格行自动尊重内容的高度?