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

A RenderCustomMultiChildLayoutBox expected a child of type RenderBox but received a child of type RenderSliverStickyHeader. #39

Closed
misskter opened this issue Jan 4, 2020 · 1 comment

Comments

@misskter
Copy link

misskter commented Jan 4, 2020

I use this library has this error

A RenderCustomMultiChildLayoutBox expected a child of type RenderBox but received a child of type RenderSliverStickyHeader.

RenderObjects expect specific types of children because they coordinate with their children during layout and paint. For example, a RenderSliver cannot be the child of a RenderBox because a RenderSliver does not understand the RenderBox layout protocol.
The RenderCustomMultiChildLayoutBox that expected a RenderBox child was created by: CustomMultiChildLayout ← AnimatedBuilder ← DefaultTextStyle ← AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#ba9f9 ink renderer] ← NotificationListener ← PhysicalModel ← AnimatedPhysicalModel ← Material ← PrimaryScrollController ← _ScaffoldScope ← Scaffold ← ⋯
The RenderSliverStickyHeader that did not match the expected child type was created by: SliverStickyHeader ← _BodyBuilder ← MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ← CustomMultiChildLayout ← AnimatedBuilder ← DefaultTextStyle ← AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#ba9f9 ink renderer] ← NotificationListener ← PhysicalModel ← AnimatedPhysicalModel ← ⋯
The relevant error-causing widget was:
Scaffold file:///home/dev_03/flutter-app/test_header/lib/main.dart:69:12
When the exception was thrown, this was the stack:
#0 ContainerRenderObjectMixin.debugValidateChild. (package:flutter/src/rendering/object.dart:2993:9)
#1 ContainerRenderObjectMixin.debugValidateChild (package:flutter/src/rendering/object.dart:3020:6)
#2 MultiChildRenderObjectElement.insertChildRenderObject (package:flutter/src/widgets/framework.dart:5509:25)
#3 RenderObjectElement.attachRenderObject (package:flutter/src/widgets/framework.dart:5295:35)
#4 RenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5058:5)
...
════════════════════════════════════════════════════════════════════════════════════════════════════

My development environment is like this:
Flutter 1.12.13+hotfix.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 27321ebbad (3 周前) • 2019-12-10 18:15:01 -0800
Engine • revision 2994f7e1e6
Tools • Dart 2.7.0

@letsar
Copy link
Owner

letsar commented Feb 21, 2020

You cannot use a Sliver in a CustomMultiChildLayout. This package is only intended to be used in a scroll view (like CustomScrollView).

@letsar letsar closed this as completed Feb 21, 2020
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

2 participants