【发布时间】:2017-11-28 05:00:16
【问题描述】:
我有一个应用程序使用GridView 来尝试布置一些Cards。相关代码看起来有点像这样
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”按钮下方结束。我该如何解决这个问题,并让网格行自动尊重内容的高度?
【问题讨论】: