Home > database >  Another exception was thrown: RenderBox was not laid out: CustomRenderShrinkWrappingViewport#f6727 r
Another exception was thrown: RenderBox was not laid out: CustomRenderShrinkWrappingViewport#f6727 r

Time:12-17

I need to generate a list horizontally, but i found this issue with no UI.

The Error Is:

he following RenderObject was being processed when the exception was fired: CustomRenderShrinkWrappingViewport#f6727 relayoutBoundary=up17 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE: needs compositing creator: CustomShrinkWrappingViewport ← IgnorePointer-[GlobalKey#952f0] ← Semantics ← Listener ← _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey#f0fc7] ← Listener ← _ScrollableScope ← _ScrollSemantics-[GlobalKey#c0651] ← RepaintBoundary ← CustomPaint ← RepaintBoundary ← ⋯ parentData: (can use size) constraints: BoxConstraints(0.0<=w<=331.2, 0.0<=h<=Infinity) size: MISSING axisDirection: right crossAxisDirection: down offset: ScrollPositionWithSingleContext#c3ca2(offset: 0.0, range: null..null, viewport: null, ScrollableState, ClampingScrollPhysics -> RangeMaintainingScrollPhysics, IdleScrollActivity#d7dd2, ScrollDirection.idle) anchor: 0.0 This RenderObject had the following descendants (showing up to depth 5): child 0: RenderSliverPadding#963bb NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE child: RenderSliverList#5357f NEEDS-LAYOUT NEEDS-PAINT child 1: RenderSliverPadding#2291f NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE child: RenderSliverList#6db77 NEEDS-LAYOUT NEEDS-PAINT ════════════════════════════════════════════════════════════════════════════════════════════════════

Another exception was thrown: RenderBox was not laid out: CustomRenderShrinkWrappingViewport#f6727 relayoutBoundary=up17 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

The Code Is:

CustomScrollView( // physics: ScrollPhysics(), scrollDirection: Axis.vertical,

      slivers: [
        SliverList(
          delegate: SliverChildBuilderDelegate(
            (context, index) => ScrollablePositionedList.builder(
              shrinkWrap: true,
              scrollDirection: Axis.horizontal,
              itemScrollController: _scrollController,
              itemCount: dummyQuestions.length,
              itemBuilder: (context, index) {
              currentPageIndex = index;
              return dummyQuestions[index];
              },
            ),
          ),
        ),
      ],
    ),

CodePudding user response:

Please Refer Below Code:

CustomScrollView(
      controller: scrollController,
      scrollDirection: Axis.horizontal,
      slivers: <Widget>[
        SliverList(
          delegate: SliverChildBuilderDelegate(
            (_, int index) {
             return Container(
             child: Text(list[index]['index'],),
             );
            },
            childCount: list.length,
          )
        ),
      ],
    ))

  • Related