我需要横向生成一个列表。但是,我面临以下问题:
引发异常时正在处理下列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。
代码是:
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];
},
),
),
),
],
),发布于 2021-12-16 13:25:00
请参阅以下守则:
CustomScrollView(
controller: scrollController,
scrollDirection: Axis.horizontal,
slivers: <Widget>[
SliverList(
delegate: SliverChildBuilderDelegate(
(_, int index) {
return Container(
child: Text(list[index]['index'],),
);
},
childCount: list.length,
)
),
],
))https://stackoverflow.com/questions/70378729
复制相似问题