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 RenderRepaintBoundary expected a child of type RenderBox but received a child of type RenderSliverStickyHeader. #94

Open
cloudoftg0 opened this issue Oct 10, 2023 · 0 comments

Comments

@cloudoftg0
Copy link

this code where _StickyHeaderGrid() is widget from example "side_header.dart" class MyScrollingScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( body: CustomScrollView(slivers: [ SliverList( delegate: SliverChildBuilderDelegate( (context, i) => _StickyHeaderGrid(index: i), childCount: 10, ), ), ]), ); } } is throwing this error `Restarted application in 661ms.

════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building _StickyHeaderGrid:
A RenderRepaintBoundary 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 RenderRepaintBoundary that expected a RenderBox child was created by: RepaintBoundary ← IndexedSemantics ← _SelectionKeepAlive ← NotificationListener ← KeepAlive ← AutomaticKeepAlive ← KeyedSubtree ← SliverList ← Viewport ← IgnorePointer-[GlobalKey#42c8d] ← Semantics ← Listener ← ⋯
The RenderSliverStickyHeader that did not match the expected child type was created by: SliverStickyHeader ← _StickyHeaderGrid ← RepaintBoundary ← IndexedSemantics ← _SelectionKeepAlive ← NotificationListener ← KeepAlive ← AutomaticKeepAlive ← KeyedSubtree ← SliverList ← Viewport ← IgnorePointer-[GlobalKey#42c8d] ← ⋯
The relevant error-causing widget was
_StickyHeaderGrid
When the exception was thrown, this was the stack
#0 RenderObjectWithChildMixin.debugValidateChild.
#1 RenderObjectWithChildMixin.debugValidateChild
#2 SingleChildRenderObjectElement.insertRenderObjectChild
#3 RenderObjectElement.attachRenderObject
#4 RenderObjectElement.mount
#5 SliverStickyHeaderRenderObjectElement.mount
... Normal element mounting (47 frames)
#52 Element.inflateWidget
#53 Element.updateChild
#54 SliverMultiBoxAdaptorElement.updateChild
#55 SliverMultiBoxAdaptorElement.createChild.
#56 BuildOwner.buildScope
#57 SliverMultiBoxAdaptorElement.createChild
#58 RenderSliverMultiBoxAdaptor._createOrObtainChild.
#59 RenderObject.invokeLayoutCallback.
#60 PipelineOwner._enableMutationsToDirtySubtrees
#61 RenderObject.invokeLayoutCallback
#62 RenderSliverMultiBoxAdaptor._createOrObtainChild
#63 RenderSliverMultiBoxAdaptor.addInitialChild
#64 RenderSliverList.performLayout
#65 RenderObject.layout
#66 RenderViewportBase.layoutChildSequence
#67 RenderViewport._attemptLayout
#68 RenderViewport.performLayout
#69 RenderObject.layout
#70 RenderBox.layout
#71 RenderProxyBoxMixin.performLayout
#72 RenderObject.layout
#73 RenderBox.layout
#74 RenderProxyBoxMixin.performLayout
#75 RenderObject.layout
#76 RenderBox.layout
#77 RenderProxyBoxMixin.performLayout
#78 RenderObject.layout
#79 RenderBox.layout
#80 RenderProxyBoxMixin.performLayout
#81 RenderObject.layout
#82 RenderBox.layout
#83 RenderProxyBoxMixin.performLayout
#84 RenderObject.layout
#85 RenderBox.layout
#86 RenderProxyBoxMixin.performLayout
#87 RenderObject.layout
#88 RenderBox.layout
#89 RenderProxyBoxMixin.performLayout
#90 RenderObject.layout
#91 RenderBox.layout
#92 RenderProxyBoxMixin.performLayout
#93 RenderCustomPaint.performLayout
#94 RenderObject.layout
#95 RenderBox.layout
#96 RenderProxyBoxMixin.performLayout
#97 RenderObject.layout
#98 RenderBox.layout
#99 RenderProxyBoxMixin.performLayout
#100 RenderObject.layout
#101 RenderBox.layout
#102 RenderProxyBoxMixin.performLayout
#103 RenderObject.layout
#104 RenderBox.layout
#105 RenderProxyBoxMixin.performLayout
#106 RenderObject.layout
#107 RenderBox.layout
#108 RenderProxyBoxMixin.performLayout
#109 RenderObject.layout
#110 RenderBox.layout
#111 MultiChildLayoutDelegate.layoutChild
#112 _ScaffoldLayout.performLayout
#113 MultiChildLayoutDelegate._callPerformLayout
#114 RenderCustomMultiChildLayoutBox.performLayout
#115 RenderObject.layout
#116 RenderBox.layout
#117 RenderProxyBoxMixin.performLayout
#118 RenderObject.layout
#119 RenderBox.layout
#120 RenderProxyBoxMixin.performLayout
#121 _RenderCustomClip.performLayout
#122 RenderObject.layout
#123 RenderBox.layout
#124 RenderProxyBoxMixin.performLayout
#125 RenderObject.layout
#126 RenderBox.layout
#127 RenderProxyBoxMixin.performLayout
#128 RenderObject.layout
#129 RenderBox.layout
#130 RenderProxyBoxMixin.performLayout
#131 RenderObject.layout
#132 RenderBox.layout
#133 RenderProxyBoxMixin.performLayout
#134 RenderObject.layout
#135 RenderBox.layout
#136 RenderProxyBoxMixin.performLayout
#137 RenderObject.layout
#138 RenderBox.layout
#139 RenderProxyBoxMixin.performLayout
#140 RenderObject.layout
#141 RenderBox.layout
#142 RenderProxyBoxMixin.performLayout
#143 RenderObject.layout
#144 RenderBox.layout
#145 RenderProxyBoxMixin.performLayout
#146 RenderObject.layout
#147 RenderBox.layout
#148 RenderProxyBoxMixin.performLayout
#149 RenderObject.layout
#150 RenderBox.layout
#151 RenderProxyBoxMixin.performLayout
#152 RenderOffstage.performLayout
#153 RenderObject.layout
#154 RenderBox.layout
#155 RenderProxyBoxMixin.performLayout
#156 RenderObject.layout
#157 RenderBox.layout
#158 _RenderTheaterMixin.performLayout
#159 RenderObject.layout
#160 RenderBox.layout
#161 RenderProxyBoxMixin.performLayout
#162 RenderObject.layout
#163 RenderBox.layout
#164 RenderProxyBoxMixin.performLayout
#165 RenderObject.layout
#166 RenderBox.layout
#167 RenderProxyBoxMixin.performLayout
#168 RenderObject.layout
#169 RenderBox.layout
#170 RenderProxyBoxMixin.performLayout
#171 RenderCustomPaint.performLayout
#172 RenderObject.layout
#173 RenderBox.layout
#174 RenderProxyBoxMixin.performLayout
#175 RenderObject.layout
#176 RenderBox.layout
#177 RenderProxyBoxMixin.performLayout
#178 RenderObject.layout
#179 RenderBox.layout
#180 RenderProxyBoxMixin.performLayout
#181 RenderObject.layout
#182 RenderBox.layout
#183 RenderProxyBoxMixin.performLayout
#184 RenderObject.layout
#185 RenderBox.layout
#186 RenderProxyBoxMixin.performLayout
#187 RenderObject.layout
#188 RenderBox.layout
#189 RenderProxyBoxMixin.performLayout
#190 RenderObject.layout
#191 RenderBox.layout
#192 RenderView.performLayout
#193 RenderObject._layoutWithoutResize
#194 PipelineOwner.flushLayout
#195 RendererBinding.drawFrame
#196 WidgetsBinding.drawFrame
#197 RendererBinding._handlePersistentFrameCallback
#198 SchedulerBinding._invokeFrameCallback
#199 SchedulerBinding.handleDrawFrame
#200 SchedulerBinding.scheduleWarmUpFrame.
#204 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)
(elided 3 frames from class _Timer and dart:async-patch)
════════════════════════════════════════════════════════════════════════════════
` Any solution?

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

1 participant