如何在扑朔迷离的ListView.Builder小部件中解决“未布局RenderBox:”?

时间:2020-09-01 13:34:09

标签: flutter dart exception flutter-layout render

我在Expanded小部件内使用ListView.Builder,但这是通过异常

RenderFlex children have non-zero flex but incoming height constraints are unbounded.

RenderBox was not laid out: RenderRepaintBoundary#508c1 NEEDS-LAYOUT NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1696 pos 12: 'hasSize' 

名为LogTimeline的ListView.builder小部件

Widget build(BuildContext context) {
    return Expanded(
      child: ListView.builder(
        scrollDirection: Axis.vertical,
        shrinkWrap: true,
        itemCount: timelineList.length,
        itemBuilder: (context, index) {
          return Container(
            child: Row(
              children: [
                Column(
                  children: [
                    Container(),
                    Container(),
                    Container(),
                  ],),
              ],),
          ),}
      ),),}

LogTimeline使用的小部件

  Wrap(
        children: [
          LogHeader(
            headerTitle: "Overtime log",
          ),
          LogTimeline(
            timelineList: overtimeList,
          ),
        ],
      )

在包装小部件中使用ListView.builder时,它显示“底部溢出” 我该如何解决此异常,为什么会发生此异常,

Full code link

1 个答案:

答案 0 :(得分:0)

尝试删除扩展小部件,然后查看