I am try use SliverList
for render data from backend (Firestore) in list. But I get error:
The following assertion was thrown building NotificationListener: Incorrect use of ParentDataWidget.
Flexible widgets must be placed inside Flex widgets. Flexible(no depth, flex: 1, dirty) has no Flex ancestor at all. The ownership chain for the parent of the offending Flexible was: RepaintBoundary ← IndexedSemantics ← NotificationListener ← KeepAlive ← AutomaticKeepAlive ← KeyedSubtree ← SliverList ← Viewport ← IgnorePointer-[GlobalKey#1e502] ← Semantics ← ⋯
new CustomScrollView(
slivers: <Widget>[
SliverList(
delegate: SliverChildListDelegate([
new Flexible(
child:
new FirestoreAnimatedList(
query: reference
.orderBy('timestamp', descending: true)
.snapshots(),
itemBuilder: (_, DocumentSnapshot snapshot,
Animation<double> animation) {
return new Widget(
snapshot: snapshot,
animation: animation,
But if I remove Flexible
it give error:
The following assertion was thrown during performResize(): Vertical viewport was given unbounded height.
Viewports expand in the scrolling direction to fill their container.In this case, a vertical viewport was given an unlimited amount of vertical space in which to expand. This situation typically happens when a scrollable widget is nested inside another scrollable widget. If this widget is always nested in a scrollable widget there is no need to use a viewport because there will always be enough vertical space for the children. In this case, consider using a Column instead. Otherwise, consider using the "shrinkWrap" property (or a ShrinkWrappingViewport) to size the height of the viewport to the sum of the heights of its children. User-created ancestor of the error-causing widget was: FirestoreAnimatedList
If I replace FirestoreAnimatedlist
with Placeholder()
there is no problem:
new CustomScrollView(
slivers: <Widget>[
SliverList(
delegate: SliverChildListDelegate([
Placeholder(),
Placeholder(),
Placeholder(),
How I can solve?
Thanks everyone!