xuelongqy / flutter_easy_refresh

A flutter widget that provides pull-down refresh and pull-up load.
https://xuelongqy.github.io/flutter_easy_refresh/
MIT License
3.89k stars 633 forks source link

demo中NestedScrollView 必现error #627

Open BurnieLiu opened 1 year ago

BurnieLiu commented 1 year ago

demo中NestedScrollView 必现error

操作步骤:1、向下滑动触发load more ,2、向上滑到头下拉触发刷新

════════ Exception caught by rendering library ═════════════════════════════════ The following assertion was thrown during performLayout(): RenderBox.size accessed beyond the scope of resize, layout, or permitted parent access. RenderBox can always access its own size, otherwise, the only object that is allowed to read RenderBox.size is its parent, if they have said they will. It you hit this assert trying to access a child's size, pass "parentUsesSize: true" to that child's layout(). 'package:flutter/src/rendering/box.dart': Failed assertion: line 2009 pos 13: 'debugDoingThisResize || debugDoingThisLayout || _computingThisDryLayout || (RenderObject.debugActiveLayout == parent && size._canBeUsedByParent)'

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause. In either case, please report this assertion by filing a bug on GitHub: https://github.com/flutter/flutter/issues/new?template=2_bug.md

The relevant error-causing widget was CustomScrollView When the exception was thrown, this was the stack

2 RenderBox.size.

3 RenderBox.size

4 Element.size

5 IndicatorNotifier.position=

6 IndicatorNotifier._updateBySimulation

7 _ERScrollPhysics.createBallisticSimulation

8 ScrollPhysics.createBallisticSimulation

9 _NestedScrollPosition.goBallistic

10 BallisticScrollActivity.applyNewDimensions

11 ScrollPosition.applyNewDimensions

12 _NestedScrollPosition.applyNewDimensions

13 _ExtendedNestedScrollPosition.applyNewDimensions

14 ScrollPosition.applyContentDimensions

15 _ExtendedNestedScrollPosition.applyContentDimensions

16 RenderViewport.performLayout

17 RenderObject._layoutWithoutResize

18 PipelineOwner.flushLayout

19 RendererBinding.drawFrame

20 WidgetsBinding.drawFrame

21 RendererBinding._handlePersistentFrameCallback

22 SchedulerBinding._invokeFrameCallback

23 SchedulerBinding.handleDrawFrame

24 SchedulerBinding._handleDrawFrame

25 _invoke (dart:ui/hooks.dart:148:13)

26 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:318:5)

27 _drawFrame (dart:ui/hooks.dart:115:31)

(elided 2 frames from class _AssertionError) The following RenderObject was being processed when the exception was fired: RenderViewport#8dca2 NEEDS-LAYOUT NEEDS-PAINT RenderObject: RenderViewport#8dca2 NEEDS-LAYOUT NEEDS-PAINT needs compositing parentData: (can use size) constraints: BoxConstraints(0.0<=w<=430.0, 0.0<=h<=705.0) layer: OffsetLayer#32cf2 engine layer: OffsetEngineLayer#ad6b4 handles: 2 offset: Offset(0.0, 227.0) size: Size(430.0, 705.0) axisDirection: down crossAxisDirection: right offset: _ExtendedNestedScrollPosition#ec8f3(inner, offset: -126.0, range: 0.0..1695.0, viewport: 705.0) anchor: 0.0 center child: RenderSliverList#45f26 relayoutBoundary=up1 NEEDS-PAINT needs compositing parentData: paintOffset=Offset(0.0, 126.0) (can use size) constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle, scrollOffset: 0.0, remainingPaintExtent: 579.0, overlap: -126.0, crossAxisExtent: 430.0, crossAxisDirection: AxisDirection.right, viewportMainAxisExtent: 705.0, remainingCacheExtent: 829.0, cacheOrigin: 0.0) geometry: SliverGeometry(scrollExtent: 2400.0, paintExtent: 579.0, maxPaintExtent: 2400.0, hasVisualOverflow: true, cacheExtent: 829.0) scrollExtent: 2400.0 paintExtent: 579.0 maxPaintExtent: 2400.0 hasVisualOverflow: true cacheExtent: 829.0 currently live children: 0 to 6 child with index 0: RenderIndexedSemantics#c4012 relayoutBoundary=up2 needs compositing parentData: index=0; layoutOffset=0.0 (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) semantics node: SemanticsNode#324 Rect.fromLTRB(0.0, 129.0, 430.0, 249.0) tags: RenderViewport.twoPane size: Size(430.0, 120.0) index: 0 child: RenderRepaintBoundary#b7d89 relayoutBoundary=up3 needs compositing parentData: (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) layer: OffsetLayer#9f467 engine layer: OffsetEngineLayer#10f60 handles: 2 offset: Offset(0.0, 129.0) size: Size(430.0, 120.0) metrics: 98.1% useful (1 bad vs 53 good) diagnosis: this is an outstandingly useful repaint boundary and should definitely be kept child: RenderSemanticsAnnotations#20a77 relayoutBoundary=up4 parentData: (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) semantics node: SemanticsNode#325 Rect.fromLTRB(0.0, 0.0, 430.0, 120.0) semantic boundary size: Size(430.0, 120.0) child with index 1: RenderIndexedSemantics#19235 relayoutBoundary=up2 needs compositing parentData: index=1; layoutOffset=120.0 (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) semantics node: SemanticsNode#322 Rect.fromLTRB(0.0, 249.0, 430.0, 369.0) tags: RenderViewport.twoPane size: Size(430.0, 120.0) index: 1 child: RenderRepaintBoundary#0566c relayoutBoundary=up3 needs compositing parentData: (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) layer: OffsetLayer#02058 engine layer: OffsetEngineLayer#b8493 handles: 2 offset: Offset(0.0, 249.0) size: Size(430.0, 120.0) metrics: 98.2% useful (1 bad vs 54 good) diagnosis: this is an outstandingly useful repaint boundary and should definitely be kept child: RenderSemanticsAnnotations#dc292 relayoutBoundary=up4 parentData: (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) semantics node: SemanticsNode#323 Rect.fromLTRB(0.0, 0.0, 430.0, 120.0) semantic boundary size: Size(430.0, 120.0) child with index 2: RenderIndexedSemantics#b63f3 relayoutBoundary=up2 needs compositing parentData: index=2; layoutOffset=240.0 (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) semantics node: SemanticsNode#320 Rect.fromLTRB(0.0, 369.0, 430.0, 489.0) tags: RenderViewport.twoPane size: Size(430.0, 120.0) index: 2 child: RenderRepaintBoundary#baf8b relayoutBoundary=up3 needs compositing parentData: (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) layer: OffsetLayer#985e3 engine layer: OffsetEngineLayer#05478 handles: 2 offset: Offset(0.0, 369.0) size: Size(430.0, 120.0) metrics: 98.2% useful (1 bad vs 55 good) diagnosis: this is an outstandingly useful repaint boundary and should definitely be kept child: RenderSemanticsAnnotations#3d6f8 relayoutBoundary=up4 parentData: (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) semantics node: SemanticsNode#321 Rect.fromLTRB(0.0, 0.0, 430.0, 120.0) semantic boundary size: Size(430.0, 120.0) child with index 3: RenderIndexedSemantics#d7ac9 relayoutBoundary=up2 needs compositing parentData: index=3; layoutOffset=360.0 (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) semantics node: SemanticsNode#318 Rect.fromLTRB(0.0, 489.0, 430.0, 609.0) tags: RenderViewport.twoPane size: Size(430.0, 120.0) index: 3 child: RenderRepaintBoundary#82035 relayoutBoundary=up3 needs compositing parentData: (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) layer: OffsetLayer#afbd3 engine layer: OffsetEngineLayer#192b9 handles: 2 offset: Offset(0.0, 489.0) size: Size(430.0, 120.0) metrics: 98.2% useful (1 bad vs 56 good) diagnosis: this is an outstandingly useful repaint boundary and should definitely be kept child: RenderSemanticsAnnotations#47e1c relayoutBoundary=up4 parentData: (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) semantics node: SemanticsNode#319 Rect.fromLTRB(0.0, 0.0, 430.0, 120.0) semantic boundary size: Size(430.0, 120.0) child with index 4: RenderIndexedSemantics#322af relayoutBoundary=up2 needs compositing parentData: index=4; layoutOffset=480.0 (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) semantics node: SemanticsNode#316 Rect.fromLTRB(0.0, 609.0, 430.0, 705.0) tags: RenderViewport.twoPane size: Size(430.0, 120.0) index: 4 child: RenderRepaintBoundary#6a835 relayoutBoundary=up3 needs compositing parentData: (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) layer: OffsetLayer#7337b engine layer: OffsetEngineLayer#16538 handles: 2 offset: Offset(0.0, 609.0) size: Size(430.0, 120.0) metrics: 98.1% useful (1 bad vs 53 good) diagnosis: this is an outstandingly useful repaint boundary and should definitely be kept child: RenderSemanticsAnnotations#1c282 relayoutBoundary=up4 parentData: (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) semantics node: SemanticsNode#317 Rect.fromLTRB(0.0, 0.0, 430.0, 96.0) semantic boundary size: Size(430.0, 120.0) child with index 5: RenderIndexedSemantics#a9eba relayoutBoundary=up2 needs compositing parentData: index=5; layoutOffset=600.0 (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) semantics node: SemanticsNode#312 Rect.fromLTRB(0.0, 729.0, 430.0, 849.0) tags: RenderViewport.twoPane flags: isHidden HIDDEN size: Size(430.0, 120.0) index: 5 child: RenderRepaintBoundary#b32ad relayoutBoundary=up3 needs compositing parentData: (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) layer: OffsetLayer#21914 DETACHED engine layer: OffsetEngineLayer#8edc7 handles: 1 offset: Offset(0.0, 680.7) size: Size(430.0, 120.0) metrics: 87.5% useful (1 bad vs 7 good) diagnosis: this is a useful repaint boundary and should be kept child: RenderSemanticsAnnotations#d4ecb relayoutBoundary=up4 parentData: (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) semantics node: SemanticsNode#313 Rect.fromLTRB(0.0, 0.0, 430.0, 120.0) flags: isHidden HIDDEN semantic boundary size: Size(430.0, 120.0) child with index 6: RenderIndexedSemantics#f2f01 relayoutBoundary=up2 NEEDS-PAINT needs compositing parentData: index=6; layoutOffset=720.0 (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) semantics node: SemanticsNode#326 Rect.fromLTRB(0.0, 849.0, 430.0, 955.0) tags: RenderViewport.twoPane flags: isHidden HIDDEN size: Size(430.0, 120.0) index: 6 child: RenderRepaintBoundary#2b445 relayoutBoundary=up3 NEEDS-PAINT needs compositing parentData: (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) size: Size(430.0, 120.0) usefulness ratio: no metrics collected yet (never painted) child: RenderSemanticsAnnotations#22b39 relayoutBoundary=up4 NEEDS-PAINT parentData: (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) semantics node: SemanticsNode#327 Rect.fromLTRB(0.0, 0.0, 430.0, 106.0) flags: isHidden HIDDEN semantic boundary size: Size(430.0, 120.0) child 1: _FooterLocatorRenderSliver#3b1e5 relayoutBoundary=up1 needs compositing parentData: paintOffset=Offset(0.0, 705.0) (can use size) constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle, scrollOffset: 0.0, remainingPaintExtent: 0.0, crossAxisExtent: 430.0, crossAxisDirection: AxisDirection.right, viewportMainAxisExtent: 705.0, remainingCacheExtent: 0.0, cacheOrigin: 0.0) geometry: SliverGeometry(scrollExtent: 0.0, paintExtent: 0.0, maxPaintExtent: 0.0) scrollExtent: 0.0 paintExtent: 0.0 maxPaintExtent: 0.0 child: RenderConstrainedBox#1b7de relayoutBoundary=up2 needs compositing parentData: paintOffset=Offset(0.0, -0.0) (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) size: Size(430.0, 0.0) additionalConstraints: BoxConstraints(w=Infinity, h=0.0) child: RenderStack#fd517 needs compositing parentData: (can use size) constraints: BoxConstraints(w=430.0, h=0.0) size: Size(430.0, 0.0) alignment: AlignmentDirectional.topStart textDirection: ltr fit: loose child 1: RenderConstrainedBox#24e75 relayoutBoundary=up1 needs compositing parentData: top=0.0; right=0.0; left=0.0; offset=Offset(0.0, 0.0) (can use size) constraints: BoxConstraints(w=430.0, 0.0<=h<=Infinity) size: Size(430.0, 70.0) additionalConstraints: BoxConstraints(0.0<=w<=Infinity, h=70.0) ════════════════════════════════════════════════════════════════════════════════ flutter: [<'Tab0'>] is visible flutter: [<'Tab0'>] is visible ...

weichongchong commented 1 year ago

我遇到了同样的问题