Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EasyRefresh.builder+CustomScrollView组合,如果加上footer就报错。 #123

Closed
curls opened this issue Aug 6, 2019 · 7 comments
Closed

Comments

@curls
Copy link

curls commented Aug 6, 2019

EasyRefresh.builder(

    onRefresh: () async {
      await Future.delayed(Duration(seconds: 2), () {
      });
    },

    onLoad: () async {
      await Future.delayed(Duration(seconds: 2), () {
      });
    },
    firstRefresh: true,
    header: MaterialHeader(),

    builder: (BuildContext context, ScrollPhysics physics, Widget header, Widget footer) {
      return CustomScrollView(
        controller: ScrollController(),
        key: PageStorageKey<HomeItemPage>(widget),
        physics: physics,
        slivers: <Widget>[

            SliverOverlapInjector(
              handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
                  context),
            ),
          header, //加上hearder不报错
          SliverPadding(
            padding: const EdgeInsets.all(8.0),
            sliver: StoreConnector<AppState, HomeTabItemState>(
              converter: (store) {
                if (store.state.goodsItemList.containsKey(widget.item.id)) {
                  return store.state.goodsItemList[widget.item.id];
                }
                return HomeTabItemState();
              },
              builder: (_, homeTabItem) {
                return SliverGrid(
                  gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                      crossAxisCount: 2,
                      mainAxisSpacing: 8,
                      crossAxisSpacing: 8,
                      childAspectRatio: 0.56),
                  delegate: SliverChildBuilderDelegate(
                        (BuildContext context, int index) {
                      return ColumnGood(homeTabItem.goodList[index],key: Key(homeTabItem.goodList[index].title),);
                    },
                    childCount: homeTabItem.goodList.length,
                  ),
                );
              },
            ),
          ),
          footer, //如果加此行,就报错
        ],
      );
    },
  ),
);

错误:

flutter: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following assertion was thrown building Container(topCenter, constraints:
flutter: BoxConstraints(w=Infinity, h=60.0)):
flutter: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14:
flutter: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter:
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix the underlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter: https://github.com/flutter/flutter/issues/new?template=BUG.md
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2 RenderObject._debugSubtreeRelayoutRootAlreadyMarkedNeedsLayout (package:flutter/src/rendering/object.dart:1348:14)
flutter: #3 RenderObject.markNeedsLayout (package:flutter/src/rendering/object.dart:1398:14)
flutter: #4 RenderBox.markNeedsLayout (package:flutter/src/rendering/box.dart:2048:11)
flutter: #5 RenderObject.markParentNeedsLayout (package:flutter/src/rendering/object.dart:1432:14)
flutter: #6 RenderObject.markNeedsLayout (package:flutter/src/rendering/object.dart:1403:7)
flutter: #7 RenderBox.markNeedsLayout (package:flutter/src/rendering/box.dart:2048:11)
flutter: #8 RenderObject.markParentNeedsLayout (package:flutter/src/rendering/object.dart:1432:14)
flutter: #9 RenderObject.markNeedsLayout (package:flutter/src/rendering/object.dart:1403:7)
flutter: #10 RenderBox.markNeedsLayout (package:flutter/src/rendering/box.dart:2048:11)
flutter: #11 RenderConstrainedBox.additionalConstraints= (package:flutter/src/rendering/proxy_box.dart:209:5)
flutter: #12 ConstrainedBox.updateRenderObject (package:flutter/src/widgets/basic.dart:2110:18)
flutter: #13 RenderObjectElement.update (package:flutter/src/widgets/framework.dart:4726:12)
flutter: #14 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5097:11)
flutter: #15 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #16 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #17 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #18 StatelessElement.update (package:flutter/src/widgets/framework.dart:3981:5)
flutter: #19 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #20 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #21 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #22 ProxyElement.update (package:flutter/src/widgets/framework.dart:4219:5)
flutter: #23 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #24 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4817:32)
flutter: #25 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5208:17)
flutter: #26 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #27 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #28 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #29 StatefulElement.update (package:flutter/src/widgets/framework.dart:4085:5)
flutter: #30 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #31 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5099:14)
flutter: #32 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #33 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #34 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #35 StatelessElement.update (package:flutter/src/widgets/framework.dart:3981:5)
flutter: #36 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #37 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4817:32)
flutter: #38 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5208:17)
flutter: #39 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #40 _LayoutBuilderElement._layout. (package:flutter/src/widgets/layout_builder.dart:120:18)
flutter: #41 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2320:19)
flutter: #42 _LayoutBuilderElement._layout (package:flutter/src/widgets/layout_builder.dart:109:11)
flutter: #43 RenderObject.invokeLayoutCallback. (package:flutter/src/rendering/object.dart:1715:58)
flutter: #44 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:796:15)
flutter: #45 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1715:13)
flutter: #46 _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:207:5)
flutter: #47 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
flutter: #48 _RenderEasyRefreshSliverLoad.performLayout (package:flutter_easyrefresh/src/footer/load_indicator.dart:235:11)
flutter: #49 RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
flutter: #50 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:406:13)
flutter: #51 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1334:12)
flutter: #52 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1252:20)
flutter: #53 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1496:7)
flutter: #54 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:765:18)
flutter: #55 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:346:19)
flutter: #56 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:701:13)
flutter: #57 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:285:5)
flutter: #58 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1016:15)
flutter: #59 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:958:9)
flutter: #60 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:874:5)
flutter: #64 _invoke (dart:ui/hooks.dart:236:10)
flutter: #65 _drawFrame (dart:ui/hooks.dart:194:3)
flutter: (elided 5 frames from class _AssertionError and package dart:async)
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter: Anothe

@josephchenghmlet
Copy link

Similar issue when using EasyRefresh.custom

@override
Widget build(BuildContext context) {
  return Scaffold(
    body: EasyRefresh.custom(
      onLoad: () async {
          _loadMore();
      },
      slivers: <Widget>[
        ...
      ],
      ...
    ),
  );
}
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following assertion was thrown building Container(topCenter, constraints:
flutter: BoxConstraints(w=Infinity, h=60.0)):
flutter: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14:
flutter: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter:
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix the underlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter:   https://github.com/flutter/flutter/issues/new?template=BUG.md
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2      RenderObject._debugSubtreeRelayoutRootAlreadyMarkedNeedsLayout (package:flutter/src/rendering/object.dart:1348:14)
flutter: #3      RenderObject.markNeedsLayout (package:flutter/src/rendering/object.dart:1398:14)
flutter: #4      RenderBox.markNeedsLayout (package:flutter/src/rendering/box.dart:2048:11)
flutter: #5      RenderObject.markParentNeedsLayout (package:flutter/src/rendering/object.dart:1432:14)
flutter: #6      RenderObject.markNeedsLayout (package:flutter/src/rendering/object.dart:1403:7)
flutter: #7      RenderBox.markNeedsLayout (package:flutter/src/rendering/box.dart:2048:11)
flutter: #8      RenderObject.markParentNeedsLayout (package:flutter/src/rendering/object.dart:1432:14)
flutter: #9      RenderObject.markNeedsLayout (package:flutter/src/rendering/object.dart:1403:7)
flutter: #10     RenderBox.markNeedsLayout (package:flutter/src/rendering/box.dart:2048:11)
flutter: #11     RenderConstrainedBox.additionalConstraints= (package:flutter/src/rendering/proxy_box.dart:209:5)
flutter: #12     ConstrainedBox.updateRenderObject (package:flutter/src/widgets/basic.dart:2110:18)
flutter: #13     RenderObjectElement.update (package:flutter/src/widgets/framework.dart:4726:12)
flutter: #14     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5097:11)
flutter: #15     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #16     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #17     Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #18     StatelessElement.update (package:flutter/src/widgets/framework.dart:3981:5)
flutter: #19     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #20     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #21     Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #22     ProxyElement.update (package:flutter/src/widgets/framework.dart:4219:5)
flutter: #23     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #24     RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4817:32)
flutter: #25     MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5208:17)
flutter: #26     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #27     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #28     Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #29     StatefulElement.update (package:flutter/src/widgets/framework.dart:4085:5)
flutter: #30     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #31     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5099:14)
flutter: #32     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #33     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #34     Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #35     StatelessElement.update (package:flutter/src/widgets/framework.dart:3981:5)
flutter: #36     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #37     RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4817:32)
flutter: #38     MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5208:17)
flutter: #39     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #40     _LayoutBuilderElement._layout.<anonymous closure> (package:flutter/src/widgets/layout_builder.dart:120:18)
flutter: #41     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2320:19)
flutter: #42     _LayoutBuilderElement._layout (package:flutter/src/widgets/layout_builder.dart:109:11)
flutter: #43     RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1715:58)
flutter: #44     PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:796:15)
flutter: #45     RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1715:13)
flutter: #46     _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:207:5)
flutter: #47     RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
flutter: #48     _RenderEasyRefreshSliverLoad.performLayout (package:flutter_easyrefresh/src/footer/load_indicator.dart:235:11)
flutter: #49     RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
flutter: #50     RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:406:13)
flutter: #51     RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1334:12)
flutter: #52     RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1252:20)
flutter: #53     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1496:7)
flutter: #54     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:765:18)
flutter: #55     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:346:19)
flutter: #56     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:701:13)
flutter: #57     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:285:5)
flutter: #58     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1016:15)
flutter: #59     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:958:9)
flutter: #60     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:874:5)
flutter: #64     _invoke (dart:ui/hooks.dart:236:10)
flutter: #65     _drawFrame (dart:ui/hooks.dart:194:3)
flutter: (elided 5 frames from class _AssertionError and package dart:async)
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter: Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 2324 pos 20: '_debugCurrentBuildTarget == context': is not true.

@xuelongqy
Copy link
Owner

Similar issue when using EasyRefresh.custom

@override
Widget build(BuildContext context) {
  return Scaffold(
    body: EasyRefresh.custom(
      onLoad: () async {
          _loadMore();
      },
      slivers: <Widget>[
        ...
      ],
      ...
    ),
  );
}
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following assertion was thrown building Container(topCenter, constraints:
flutter: BoxConstraints(w=Infinity, h=60.0)):
flutter: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14:
flutter: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter:
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix the underlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter:   https://github.com/flutter/flutter/issues/new?template=BUG.md
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2      RenderObject._debugSubtreeRelayoutRootAlreadyMarkedNeedsLayout (package:flutter/src/rendering/object.dart:1348:14)
flutter: #3      RenderObject.markNeedsLayout (package:flutter/src/rendering/object.dart:1398:14)
flutter: #4      RenderBox.markNeedsLayout (package:flutter/src/rendering/box.dart:2048:11)
flutter: #5      RenderObject.markParentNeedsLayout (package:flutter/src/rendering/object.dart:1432:14)
flutter: #6      RenderObject.markNeedsLayout (package:flutter/src/rendering/object.dart:1403:7)
flutter: #7      RenderBox.markNeedsLayout (package:flutter/src/rendering/box.dart:2048:11)
flutter: #8      RenderObject.markParentNeedsLayout (package:flutter/src/rendering/object.dart:1432:14)
flutter: #9      RenderObject.markNeedsLayout (package:flutter/src/rendering/object.dart:1403:7)
flutter: #10     RenderBox.markNeedsLayout (package:flutter/src/rendering/box.dart:2048:11)
flutter: #11     RenderConstrainedBox.additionalConstraints= (package:flutter/src/rendering/proxy_box.dart:209:5)
flutter: #12     ConstrainedBox.updateRenderObject (package:flutter/src/widgets/basic.dart:2110:18)
flutter: #13     RenderObjectElement.update (package:flutter/src/widgets/framework.dart:4726:12)
flutter: #14     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5097:11)
flutter: #15     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #16     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #17     Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #18     StatelessElement.update (package:flutter/src/widgets/framework.dart:3981:5)
flutter: #19     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #20     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #21     Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #22     ProxyElement.update (package:flutter/src/widgets/framework.dart:4219:5)
flutter: #23     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #24     RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4817:32)
flutter: #25     MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5208:17)
flutter: #26     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #27     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #28     Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #29     StatefulElement.update (package:flutter/src/widgets/framework.dart:4085:5)
flutter: #30     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #31     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5099:14)
flutter: #32     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #33     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #34     Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #35     StatelessElement.update (package:flutter/src/widgets/framework.dart:3981:5)
flutter: #36     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #37     RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4817:32)
flutter: #38     MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5208:17)
flutter: #39     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #40     _LayoutBuilderElement._layout.<anonymous closure> (package:flutter/src/widgets/layout_builder.dart:120:18)
flutter: #41     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2320:19)
flutter: #42     _LayoutBuilderElement._layout (package:flutter/src/widgets/layout_builder.dart:109:11)
flutter: #43     RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1715:58)
flutter: #44     PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:796:15)
flutter: #45     RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1715:13)
flutter: #46     _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:207:5)
flutter: #47     RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
flutter: #48     _RenderEasyRefreshSliverLoad.performLayout (package:flutter_easyrefresh/src/footer/load_indicator.dart:235:11)
flutter: #49     RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
flutter: #50     RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:406:13)
flutter: #51     RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1334:12)
flutter: #52     RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1252:20)
flutter: #53     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1496:7)
flutter: #54     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:765:18)
flutter: #55     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:346:19)
flutter: #56     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:701:13)
flutter: #57     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:285:5)
flutter: #58     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1016:15)
flutter: #59     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:958:9)
flutter: #60     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:874:5)
flutter: #64     _invoke (dart:ui/hooks.dart:236:10)
flutter: #65     _drawFrame (dart:ui/hooks.dart:194:3)
flutter: (elided 5 frames from class _AssertionError and package dart:async)
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter: Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 2324 pos 20: '_debugCurrentBuildTarget == context': is not true.

Can you give me your sample code?

@josephchenghmlet
Copy link

josephchenghmlet commented Aug 6, 2019

Similar issue when using EasyRefresh.custom

@override
Widget build(BuildContext context) {
  return Scaffold(
    body: EasyRefresh.custom(
      onLoad: () async {
          _loadMore();
      },
      slivers: <Widget>[
        ...
      ],
      ...
    ),
  );
}
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following assertion was thrown building Container(topCenter, constraints:
flutter: BoxConstraints(w=Infinity, h=60.0)):
flutter: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14:
flutter: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter:
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix the underlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter:   https://github.com/flutter/flutter/issues/new?template=BUG.md
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2      RenderObject._debugSubtreeRelayoutRootAlreadyMarkedNeedsLayout (package:flutter/src/rendering/object.dart:1348:14)
flutter: #3      RenderObject.markNeedsLayout (package:flutter/src/rendering/object.dart:1398:14)
flutter: #4      RenderBox.markNeedsLayout (package:flutter/src/rendering/box.dart:2048:11)
flutter: #5      RenderObject.markParentNeedsLayout (package:flutter/src/rendering/object.dart:1432:14)
flutter: #6      RenderObject.markNeedsLayout (package:flutter/src/rendering/object.dart:1403:7)
flutter: #7      RenderBox.markNeedsLayout (package:flutter/src/rendering/box.dart:2048:11)
flutter: #8      RenderObject.markParentNeedsLayout (package:flutter/src/rendering/object.dart:1432:14)
flutter: #9      RenderObject.markNeedsLayout (package:flutter/src/rendering/object.dart:1403:7)
flutter: #10     RenderBox.markNeedsLayout (package:flutter/src/rendering/box.dart:2048:11)
flutter: #11     RenderConstrainedBox.additionalConstraints= (package:flutter/src/rendering/proxy_box.dart:209:5)
flutter: #12     ConstrainedBox.updateRenderObject (package:flutter/src/widgets/basic.dart:2110:18)
flutter: #13     RenderObjectElement.update (package:flutter/src/widgets/framework.dart:4726:12)
flutter: #14     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5097:11)
flutter: #15     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #16     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #17     Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #18     StatelessElement.update (package:flutter/src/widgets/framework.dart:3981:5)
flutter: #19     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #20     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #21     Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #22     ProxyElement.update (package:flutter/src/widgets/framework.dart:4219:5)
flutter: #23     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #24     RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4817:32)
flutter: #25     MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5208:17)
flutter: #26     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #27     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #28     Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #29     StatefulElement.update (package:flutter/src/widgets/framework.dart:4085:5)
flutter: #30     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #31     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5099:14)
flutter: #32     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #33     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
flutter: #34     Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
flutter: #35     StatelessElement.update (package:flutter/src/widgets/framework.dart:3981:5)
flutter: #36     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #37     RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4817:32)
flutter: #38     MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5208:17)
flutter: #39     Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
flutter: #40     _LayoutBuilderElement._layout.<anonymous closure> (package:flutter/src/widgets/layout_builder.dart:120:18)
flutter: #41     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2320:19)
flutter: #42     _LayoutBuilderElement._layout (package:flutter/src/widgets/layout_builder.dart:109:11)
flutter: #43     RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1715:58)
flutter: #44     PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:796:15)
flutter: #45     RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1715:13)
flutter: #46     _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:207:5)
flutter: #47     RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
flutter: #48     _RenderEasyRefreshSliverLoad.performLayout (package:flutter_easyrefresh/src/footer/load_indicator.dart:235:11)
flutter: #49     RenderObject.layout (package:flutter/src/rendering/object.dart:1619:7)
flutter: #50     RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:406:13)
flutter: #51     RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1334:12)
flutter: #52     RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1252:20)
flutter: #53     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1496:7)
flutter: #54     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:765:18)
flutter: #55     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:346:19)
flutter: #56     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:701:13)
flutter: #57     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:285:5)
flutter: #58     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1016:15)
flutter: #59     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:958:9)
flutter: #60     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:874:5)
flutter: #64     _invoke (dart:ui/hooks.dart:236:10)
flutter: #65     _drawFrame (dart:ui/hooks.dart:194:3)
flutter: (elided 5 frames from class _AssertionError and package dart:async)
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1348 pos 14: 'node._relayoutBoundary == _relayoutBoundary': is not true.
flutter: Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 2324 pos 20: '_debugCurrentBuildTarget == context': is not true.

Can you give me your sample code?

...
import 'package:flutter_easyrefresh/easy_refresh.dart';
...

class ListMembersScreen extends StatefulWidget {
  const ListMembersScreen({ Key key }) : super(key: key);

  @override
  _ListMembersScreenState createState() => _ListMembersScreenState();
}

class _ListMembersScreenState extends State<ListMembersScreen> {
  ...
  @override
  void initState() {
    super.initState();
    ...
  }

  @override
  void dispose() {
    ...
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: EmptyAppBar(),
      body: SafeArea(
        top: true,
        right: true,
        bottom: true,
        left: true,
        child: _buildBody,
      ),
    );
  }

  List<Widget> get _buildActions { ... }

  Widget get _buildBackToPreviousAction { ... }

  Widget get _buildBody {
    return MultiBlocListener(
      listeners: [
        BlocListener<TokenBloc, TokenState>(
          bloc: _tokenBloc,
          listener: (context, state) {
            ...
          },
        ),
        BlocListener<ListMembersBloc, ListMembersState>(
          bloc: _listMembersBloc,
          listener: (context, state) {
            ...
          },
        ),
      ],
      child: BlocBuilder(
        bloc: _connectivityBloc,
        builder: (context, state) {
          final _isConnected = state is Connected;

          return BlocBuilder(
            bloc: _listMembersBloc,
            builder: (BuildContext context, ListMembersState state) {
              final _isFirstLoading = state is ListMembersLoading &&
              (state.data.results == null || state.data.results.length == 0);

              return _isConnected ? (_isFirstLoading ? _buildLoadingList : _buildList(members: state.data.results)) : _buildNoInternet;
            }
          );
        },
      ),
    );
  }

  Widget get _buildLoadingList { ... }

  Widget _buildList({ @required List<UserResult> members }) {
    return EasyRefresh.custom(
      onLoad: () async {
        _loadMore();
      },
      semanticChildCount: members == null ? 0 : members.length,
      slivers: <Widget>[
        _buildSliverAppbar,
        SliverList(
          delegate: SliverChildBuilderDelegate(
            (context, index) {
              return _buildMember(members.elementAt(index));
            },
            childCount: members == null ? 0 : members.length,
          ),
        ),
      ],
    );
  }

  Widget _buildMember(UserResult member) {
    return ListItemMember(
      member: member,
      ...
    );
  }

  Widget get _buildNoInternet { ... }

  Widget get _buildSliverAppbar {
    return SliverAppBar(
      actions: _buildActions,
      title: Text(
        AppLocalizations.of(context).tr(Constants.localKeyTitleMembers),
      ),
      centerTitle: true,
      leading: _buildBackToPreviousAction,
      pinned: false,
      snap: true,
      floating: true,
      // forceElevated: innerBoxIsScrolled,
      flexibleSpace: SingleChildScrollView(
        physics: NeverScrollableScrollPhysics(),
        child: Container(),
      ),
    );
  }

  void _onMemberItemTap({ UserResult member }) { ... }

  void _onSearchPressed() { ...}

  Future<void> _loadMore() async {
    // Load more members
    _listMembersBloc.dispatch(SubmitListMembers(...));
  }
}

The error is at _buildList ({ @required List<UserResult> members }) { ... }

I've followed /example/lib/page/more/support.dart which is the simplest.

Note that the bloc pattern does not affect the overall build. Assume that data has loaded successfully and executed _buildList ({ @required List<UserResult> members }) { ... }

@josephchenghmlet
Copy link

Following result that I've tried:

  1. If scroll is slow, it will not cause the error. Footer will appear as expected.
  2. If scroll is fast, error is thrown. Footer will not appear.

@xuelongqy
Copy link
Owner

Following result that I've tried:

  1. If scroll is slow, it will not cause the error. Footer will appear as expected.
  2. If scroll is fast, error is thrown. Footer will not appear.

Fixed,before releasing the new version, you can use git to import it.

@josephchenghmlet
Copy link

Thank you so much @xuelongqy! Appreciate your fast response and help!

@xuelongqy
Copy link
Owner

v2.0.1已修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants