【发布时间】:2020-08-20 10:20:52
【问题描述】:
我想将我的事务标题和日期向左对齐,但是当我为父容器提供行的完整宽度时,即 double.infinity,会引发以下异常“BoxConstraints 强制使用无限宽度”。可能的原因是什么?
body: new Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
new Card(child: new Text("CHART!")),
new Column(
children: [
...transactions.map((transaction) {
return new Card(
child: new Row(
children: [
new Container(
padding: EdgeInsets.all(10),
decoration: new BoxDecoration(
border: Border.all(
color: Colors.purple,
width: 2,
),
),
margin: EdgeInsets.symmetric(
vertical: 10,
horizontal: 15,
),
child: new Text(
transaction.amount.toString(),
style: new TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
color: Colors.purple),
),
),
new Column(
children: [
new Container(
width: double.infinity,
child: new Text(
transaction.title,
style: new TextStyle(
fontWeight: FontWeight.bold, fontSize: 17),
),
),
new Container(
child: new Text(
transaction.date.toString(),
style: new TextStyle(color: Colors.grey),
),
),
],
)
],
),
);
})
],);
【问题讨论】:
标签: flutter