0

This widget render as expected

Scaffold(
  appBar: AppBar(title: const Text('text'),),
  body: Column(
    children: <Widget>[
      ListView(
        shrinkWrap: true, // should it be here?
        children: <Widget>[
          ListTile(
            title: Row(
              children: const <Widget>[
                Expanded(child: Text('text'),),
                Expanded(child: Text('text'),),
              ],
            ),
          ),
        ],
      ),
      // RapportList(), - the issue arises when I uncomment this
    ],
  ),
);

The issue arises when I uncomment RapportList(). It is statefull widget which builds:

ListView.builder(
  itemCount: _rapports.length,
  itemBuilder: (context, index) {
    return ListTile(
      title: Row(
        children: <Widget>[
        ...

So if I uncommnet that line then I get a lot of errors

The following assertion was thrown during performResize(): Vertical viewport was given unbounded height.

Viewports expand in the scrolling direction to fill their container. In this case, a vertical viewport was given an unlimited amount of vertical space in which to expand. This situation typically happens when a scrollable widget is nested inside another scrollable widget.

If this widget is always nested in a scrollable widget there is no need to use a viewport because there will always be enough vertical space for the children. In this case, consider using a Column instead. Otherwise, consider using the "shrinkWrap" property (or a ShrinkWrappingViewport) to size the height of the viewport to the sum of the heights of its children.

The relevant error-causing widget was: ListView file:///C:/Users/andre/AndroidStudioProjects/rapport_help/lib/rappport_list.dart:147:21 When the exception was thrown, this was the stack: 0 RenderViewport.performResize. (package:flutter/src/rendering/viewport.dart:1172:15)

1 RenderViewport.performResize (package:flutter/src/rendering/viewport.dart:1233:6)

2 RenderObject.layout (package:flutter/src/rendering/object.dart:1703:9)

3 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)

4 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7) ... The following

RenderObject was being processed when the exception was fired: RenderViewport#8c103 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE ... needs compositing ... parentData: (can use size) ... constraints: BoxConstraints(0.0<=w<=360.0, 0.0<=h<=Infinity) ... size: MISSING ... axisDirection: down ... crossAxisDirection: right ... offset: ScrollPositionWithSingleContext#d6e6c(offset: 0.0, range: null..null, viewport: null, ScrollableState, AlwaysScrollableScrollPhysics -> ClampingScrollPhysics, IdleScrollActivity#96b7b, ScrollDirection.idle) ... anchor: 0.0 RenderObject: RenderViewport#8c103 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

And by alone the RapportList() renders with no issues, so why they can not be in the same column?

rozerro
  • 5,787
  • 9
  • 46
  • 94

0 Answers0