首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >另一个异常被抛出: RenderBox未被布局: CustomRenderShrinkWrappingViewport#f6727 relayoutBoundary=up17 RenderBox was -COMPOSITING

另一个异常被抛出: RenderBox未被布局: CustomRenderShrinkWrappingViewport#f6727 relayoutBoundary=up17 RenderBox was -COMPOSITING
EN

Stack Overflow用户
提问于 2021-12-16 12:04:36
回答 1查看 2.8K关注 0票数 0

我需要横向生成一个列表。但是,我面临以下问题:

引发异常时正在处理下列RenderObject : CustomRenderShrinkWrappingViewport#f6727 relayoutBoundary=up17需要-布局需要-绘制需要-组合-位-更新:需要复合创建者: CustomShrinkWrappingViewport←IgnorePointer#952f0语义处理程序_GestureSemantics CustomShrinkWrappingViewport RawGestureDetector-LabeledGlobalKey#f0fc 7-relayoutBoundary=up17侦听器_ScrollableScope _ScrollSemantics-GlobalKey#c0651 RepaintBoundary CustomPaint RepaintBoundary parentData:(可使用大小)约束: BoxConstraints(0.0<=w<=331.2,0.0<=h<=Infinity)大小:丢失axisDirection: right crossAxisDirection: down偏移:(偏移:0.00,范围: null..null,viewport: null,ScrollableState,ClampingScrollPhysics -> RangeMaintainingScrollPhysics,IdleScrollActivity#d7dd2ScrollDirection.idle)锚: 0.0此RenderObject具有以下后代(显示深度5):子0: RenderSliverPadding#963bb需要-布局需要-绘制需要-组合位-更新子- RenderSliverList#5357f需要-布局需要-绘制子需求-布局需要-绘制需要-组合-位- RenderSliverList#6db77需要-布局需要-油漆════════════════════════════════════。════════════════════════════════════════════════════════════════

另一个异常被抛出: RenderBox未被布局: CustomRenderShrinkWrappingViewport#f6727 relayoutBoundary=up17 RenderBox was -COMPOSITING BITS UPDATE。

代码是:

代码语言:javascript
复制
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];
              },
            ),
          ),
        ),
      ],
    ),
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-12-16 13:25:00

请参阅以下守则:

代码语言:javascript
复制
CustomScrollView(
      controller: scrollController,
      scrollDirection: Axis.horizontal,
      slivers: <Widget>[
        SliverList(
          delegate: SliverChildBuilderDelegate(
            (_, int index) {
             return Container(
             child: Text(list[index]['index'],),
             );
            },
            childCount: list.length,
          )
        ),
      ],
    ))
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70378729

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档