【发布时间】:2019-03-09 07:00:16
【问题描述】:
我的身体中有一个选项卡,然后是一个列,我在其中调用以使用另一个小部件类构建一个动态卡片列表。一切似乎都很好,但我收到了这个错误。
The following message was thrown during layout:
I/flutter ( 5090): A RenderFlex overflowed by 115 pixels on the bottom.
问题是列表无法滚动,尽管我将它包装到一个灵活的小部件中。这是构建列表的代码 sn-p。我还启用了物理:AlwaysScrollableScrollPhysics(),但同样的问题。我知道如果我固定一个特定的高度,它会起作用,但我不想这样做,因为这会破坏整个想法。
Widget buildDynamicList(BuildContext context) {
return new Flexible(
//decoration: new BoxDecoration(border: new Border.all(width: 2.0)),
//height:double.infinity,
//fit: FlexFit.loose ,
child: ListView.builder(
physics: AlwaysScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: vehicles.length,
itemBuilder: (BuildContext ctxt, int index) {
return Row(
mainAxisSize: MainAxisSize.max,
//mainAxisSize: MainAxisSize.max,
children: <Widget>[
RouteTile(index: index)
// expansionConfigurableRouteTile(ctxt, index),
],
);
}
)
);
}
【问题讨论】: