我最近在Column和SingleChildScrollView内部制作了一个ListView 但是它显示出诸如“ NEEDS PAINT”之类的错误。这是我的身体代码
body: Container(
child: SingleChildScrollView(
child: Column(
children: <Widget>[
ListView.builder(
itemCount: 4,
itemBuilder: (BuildContext context, int index) {
Text("Hoi");
},
)
],
),
),
),
我想退回“ Hoi” 4次。.但是它向我显示了类似的内容
Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#6c04f relayoutBoundary=up1 NEEDS-PAINT
答案 0 :(得分:0)
您可以使用shrinkWrap
的{{1}}属性。
ListView
更多信息:https://docs.flutter.io/flutter/widgets/ScrollView/shrinkWrap.html
不要忘记在ListView.builder(
shrinkWrap: true,
...
内返回一个Widget
itemBuilder