There are Questions here that sound similar, but don’t solve my specific issue, and I cannot seem to extract the information to get it to run. I have a MultiSliver I want to display, I get however the following Error Message. I tried using SliverToBoxAdapter, but I cannot seem to figure out where to put it.
The following assertion was thrown building QuestionnaireListPage(dependencies: [_InheritedProviderScope<QuestionnaireBloc?>], state: _QuestionnaireListPageState#82d9b):
A RenderCustomMultiChildLayoutBox expected a child of type RenderBox but received a child of type RenderMultiSliver.
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 ← _ActionsScope ← Actions ← AnimatedBuilder ← DefaultTextStyle ← AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#2c7bf ink renderer] ← NotificationListener<LayoutChangedNotification> ← PhysicalModel ← AnimatedPhysicalModel ← Material ← _ScrollNotificationObserverScope ← ⋯
The RenderMultiSliver that did not match the expected child type was created by: MultiSliver ← QuestionnaireListPage ← KeyedSubtree-[GlobalKey#829a8] ← _BodyBuilder ← MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ← CustomMultiChildLayout ← _ActionsScope ← Actions ← AnimatedBuilder ← DefaultTextStyle ← AnimatedDefaultTextStyle ← ⋯
Code:
main -> App -> MultiBlocProvider -> Scaffold -> CustomView extends StatefullWidget -> State -> build:
return MultiSliver(
pushPinnedChildren: true,
children: <Widget>[
SliverPinnedHeader(
child: Container(child: Text("I am a Pinned Header",))),
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: SizedBox(
height: 80,
child: Text(
"Item $index",
style: const TextStyle(fontSize: 30),
),
),
);
},
childCount: 40,
),
),
],
);
The above code is mostly taken from the MultiSliver code example, I wanted to get something ‘guaranteed to work’ in, before making my own custom stuff. What should be changed to get this to work together? Why don’t Box and Sliver Renderer like each other?
edit: this Question has the BlocProvider within the Sliver, since my Question seems to be the inverse (not a Box in a Sliver being the issue, but a sliver in a Box), it is unique
3