不知道什么原因引起的
导致第一行最后一个item下陷一个位置
日志:
The following NoSuchMethodError was thrown during performLayout():
The getter 'parentData' was called on null.
Receiver: null
Tried calling: parentData
The relevant error-causing widget was:
LoadingMoreSliverList<GoodsItem> file:///C:/Users/lvccz/AndroidStudioProjects/demo1/lib/pages/index_page/index_home.dart:149:12
When the exception was thrown, this was the stack:
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
#1 CrossAxisItems.insertLeading (package:waterfall_flow/src/rendering/sliver_waterfall_flow.dart:569:48)
#2 RenderSliverWaterfallFlow.performLayout (package:waterfall_flow/src/rendering/sliver_waterfall_flow.dart:199:28)
#3 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
#4 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:134:11)
...
The following RenderObject was being processed when the exception was fired: RenderSliverWaterfallFlow#aacb0 relayoutBoundary=up2 NEEDS-LAYOUT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: paintOffset=Offset(13.6, 0.0) (can use size)
... constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.forward, scrollOffset: 522.5, remainingPaintExtent: 768.9, crossAxisExtent: 365.5, crossAxisDirection: AxisDirection.right, viewportMainAxisExtent: 768.9, remainingCacheExtent: 1268.9 cacheOrigin: -250.0 )
... geometry: SliverGeometry(scrollExtent: 8346.8, paintExtent: 768.9, maxPaintExtent: 8346.8, hasVisualOverflow: true, cacheExtent: 1268.9)
... scrollExtent: 8346.8
... paintExtent: 768.9
... maxPaintExtent: 8346.8
... hasVisualOverflow: true
... cacheExtent: 1268.9
... currently live children: 0 to 9
RenderObject: RenderSliverWaterfallFlow#aacb0 relayoutBoundary=up2 NEEDS-LAYOUT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: paintOffset=Offset(13.6, 0.0) (can use size)
constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.forward, scrollOffset: 522.5, remainingPaintExtent: 768.9, crossAxisExtent: 365.5, crossAxisDirection: AxisDirection.right, viewportMainAxisExtent: 768.9, remainingCacheExtent: 1268.9 cacheOrigin: -250.0 )
geometry: SliverGeometry(scrollExtent: 8346.8, paintExtent: 768.9, maxPaintExtent: 8346.8, hasVisualOverflow: true, cacheExtent: 1268.9)
scrollExtent: 8346.8
paintExtent: 768.9
maxPaintExtent: 8346.8
hasVisualOverflow: true
cacheExtent: 1268.9
currently live children: 0 to 9
... child with index 0: RenderIndexedSemantics#51a2e relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: crossAxisIndex=0;crossAxisOffset=0.0;trailingLayoutOffset=316.77886977886976; index=0; layoutOffset=-16.9 (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... semantic boundary
... size: Size(175.7, 333.7)
... index: 0
... child: RenderRepaintBoundary#ab28e relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 333.7)
... usefulness ratio: no metrics collected yet (never painted)
... child: RenderSemanticsAnnotations#b7eb5 relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 333.7)
... child: RenderMouseRegion#9e5e6 relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 333.7)
... listeners: enter, exit
... child with index 1: RenderIndexedSemantics#ef0b5 relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: crossAxisIndex=1;crossAxisOffset=189.77886977886982;trailingLayoutOffset=315.8550368550368; index=1; layoutOffset=-16.9 (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... semantic boundary
... size: Size(175.7, 332.8)
... index: 1
... child: RenderRepaintBoundary#fefb4 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 332.8)
... usefulness ratio: no metrics collected yet (never painted)
... child: RenderSemanticsAnnotations#b7613 relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 332.8)
... child: RenderMouseRegion#93d8d relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 332.8)
... listeners: enter, exit
... child with index 2: RenderIndexedSemantics#6341c relayoutBoundary=up3
... needs compositing
... parentData: crossAxisIndex=1;crossAxisOffset=189.77886977886982;trailingLayoutOffset=646.2702702702702; index=2; layoutOffset=329.5 (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... semantic boundary
... size: Size(175.7, 316.8)
... index: 2
... child: RenderRepaintBoundary#4ffd8 relayoutBoundary=up4
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... layer: OffsetLayer#efcd0
... offset: Offset(203.4, -284.6)
... size: Size(175.7, 316.8)
... metrics: 99.6% useful (2 bad vs 475 good)
... diagnosis: this is an outstandingly useful repaint boundary and should definitely be kept
... child: RenderSemanticsAnnotations#ff3d2 relayoutBoundary=up5
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 316.8)
... child: RenderMouseRegion#6c37d relayoutBoundary=up6
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 316.8)
... listeners: enter, exit
... child with index 3: RenderIndexedSemantics#00e2f relayoutBoundary=up3
... needs compositing
... parentData: crossAxisIndex=0;crossAxisOffset=0.0;trailingLayoutOffset=647.1941031941031; index=3; layoutOffset=330.4 (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... semantic boundary
... size: Size(175.7, 316.8)
... index: 3
... child: RenderRepaintBoundary#dd151 relayoutBoundary=up4
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... layer: OffsetLayer#18673
... offset: Offset(13.6, -283.7)
... size: Size(175.7, 316.8)
... metrics: 99.6% useful (2 bad vs 474 good)
... diagnosis: this is an outstandingly useful repaint boundary and should definitely be kept
... child: RenderSemanticsAnnotations#03a6d relayoutBoundary=up5
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 316.8)
... child: RenderMouseRegion#694cc relayoutBoundary=up6
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 316.8)
... listeners: enter, exit
... child with index 4: RenderIndexedSemantics#e61b8 relayoutBoundary=up3
... needs compositing
... parentData: crossAxisIndex=1;crossAxisOffset=189.77886977886982;trailingLayoutOffset=976.6855036855036; index=4; layoutOffset=659.9 (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... semantic boundary
... size: Size(175.7, 316.8)
... index: 4
... child: RenderRepaintBoundary#680a7 relayoutBoundary=up4
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... layer: OffsetLayer#acd76
... offset: Offset(203.4, 45.8)
... size: Size(175.7, 316.8)
... metrics: 98.3% useful (3 bad vs 177 good)
... diagnosis: this is an outstandingly useful repaint boundary and should definitely be kept
... child: RenderSemanticsAnnotations#38e2f relayoutBoundary=up5
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 316.8)
... child: RenderMouseRegion#2fe33 relayoutBoundary=up6
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 316.8)
... listeners: enter, exit
... child with index 5: RenderIndexedSemantics#51375 relayoutBoundary=up3
... needs compositing
... parentData: crossAxisIndex=0;crossAxisOffset=0.0;trailingLayoutOffset=977.6093366093365; index=5; layoutOffset=660.8 (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... semantic boundary
... size: Size(175.7, 316.8)
... index: 5
... child: RenderRepaintBoundary#56717 relayoutBoundary=up4
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... layer: OffsetLayer#3c9b2
... offset: Offset(13.6, 46.7)
... size: Size(175.7, 316.8)
... metrics: 98.3% useful (3 bad vs 175 good)
... diagnosis: this is an outstandingly useful repaint boundary and should definitely be kept
... child: RenderSemanticsAnnotations#28fa0 relayoutBoundary=up5
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 316.8)
... child: RenderMouseRegion#bf370 relayoutBoundary=up6
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 316.8)
... listeners: enter, exit
... child with index 6: RenderIndexedSemantics#aa09b relayoutBoundary=up3
... needs compositing
... parentData: crossAxisIndex=1;crossAxisOffset=189.77886977886982;trailingLayoutOffset=1307.100737100737; index=6; layoutOffset=990.3 (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... semantic boundary
... size: Size(175.7, 316.8)
... index: 6
... child: RenderRepaintBoundary#d6555 relayoutBoundary=up4
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... layer: OffsetLayer#8273a
... offset: Offset(203.4, 376.2)
... size: Size(175.7, 316.8)
... metrics: 98.7% useful (1 bad vs 75 good)
... diagnosis: this is an outstandingly useful repaint boundary and should definitely be kept
... child: RenderSemanticsAnnotations#fb511 relayoutBoundary=up5
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 316.8)
... child: RenderMouseRegion#85d40 relayoutBoundary=up6
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 316.8)
... listeners: enter, exit
... child with index 7: RenderIndexedSemantics#4c1ee relayoutBoundary=up3
... needs compositing
... parentData: crossAxisIndex=0;crossAxisOffset=0.0;trailingLayoutOffset=1308.02457002457; index=7; layoutOffset=991.2 (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... semantic boundary
... size: Size(175.7, 316.8)
... index: 7
... child: RenderRepaintBoundary#6734c relayoutBoundary=up4
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... layer: OffsetLayer#a8f86
... offset: Offset(13.6, 377.1)
... size: Size(175.7, 316.8)
... metrics: 98.7% useful (1 bad vs 75 good)
... diagnosis: this is an outstandingly useful repaint boundary and should definitely be kept
... child: RenderSemanticsAnnotations#a757a relayoutBoundary=up5
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 316.8)
... child: RenderMouseRegion#6b9e8 relayoutBoundary=up6
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 316.8)
... listeners: enter, exit
... child with index 8: RenderIndexedSemantics#10f69 relayoutBoundary=up3
... needs compositing
... parentData: crossAxisIndex=1;crossAxisOffset=189.77886977886982;trailingLayoutOffset=1636.5921375921375; index=8; layoutOffset=1320.7 (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... semantic boundary
... size: Size(175.7, 315.9)
... index: 8
... child: RenderRepaintBoundary#a713a relayoutBoundary=up4
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... layer: OffsetLayer#ac017
... offset: Offset(203.4, 706.6)
... size: Size(175.7, 315.9)
... metrics: 80.0% useful (1 bad vs 4 good)
... diagnosis: this is a useful repaint boundary and should be kept
... child: RenderSemanticsAnnotations#d0c4e relayoutBoundary=up5
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 315.9)
... child: RenderMouseRegion#a5fb3 relayoutBoundary=up6
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 315.9)
... listeners: enter, exit
... child with index 9: RenderIndexedSemantics#27f00 relayoutBoundary=up3
... needs compositing
... parentData: crossAxisIndex=0;crossAxisOffset=0.0;trailingLayoutOffset=1638.4398034398037; index=9; layoutOffset=1321.7 (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... semantic boundary
... size: Size(175.7, 316.8)
... index: 9
... child: RenderRepaintBoundary#de1e4 relayoutBoundary=up4
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... layer: OffsetLayer#b5394
... offset: Offset(13.6, 707.6)
... size: Size(175.7, 316.8)
... metrics: 80.0% useful (1 bad vs 4 good)
... diagnosis: this is a useful repaint boundary and should be kept
... child: RenderSemanticsAnnotations#8b50f relayoutBoundary=up5
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 316.8)
... child: RenderMouseRegion#d3951 relayoutBoundary=up6
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=175.7, 0.0<=h<=Infinity)
... size: Size(175.7, 316.8)
... listeners: enter, exit
════════════════════════════════════════════════════════════════════════════════════════════════════
这是我的瀑布流wiget
首页商品列表
Widget _buildGoodsList() {
return LoadingMoreSliverList(SliverListConfig<GoodsItem>(
waterfallFlowDelegate: WaterfallFlowDelegate(
crossAxisCount: 2, crossAxisSpacing: ScreenUtil().setHeight(50), mainAxisSpacing: ScreenUtil().setWidth(50)),
itemBuilder: (context, item, index) {
return WaterfallGoodsCard(item);
},
sourceList: indexGoodsRepository,
padding: EdgeInsets.only(left: ScreenUtil().setWidth(50),right: ScreenUtil().setWidth(50)),
lastChildLayoutType: LastChildLayoutType.foot,
indicatorBuilder: (context, state) {
return LoadingMoreListCostumIndicator(state, isSliver: true);
},
// collectGarbage: (List<int> indexes) {
// indexes.forEach((index) {
// final item = indexGoodsRepository[index];
// final provider = ExtendedNetworkImageProvider(
// item.mainPic,
// );
// provider.evict();
// });
// },
));
}