I’ve a ListView
in web page. Every merchandise is wrapped with StreamBuilder
, which checks if merchandise is deleted or not. If merchandise is deleted, it can present SizedBox
, in any other case, it can present the merchandise. Nevertheless, when the merchandise does get deleted and I attempt to scroll, it retains scrolling on the identical place. I’m posting code and video.
ListView.builder(
// major: false,
shrinkWrap: true,
itemCount: upcomingEventsList?.size,
keyboardDismissBehavior:
ScrollViewKeyboardDismissBehavior.onDrag,
itemBuilder: (context, listViewIndex) {
var listViewEventsRecord =
upcomingEventsList![listViewIndex];
return StreamBuilder<DocumentSnapshot>(
key: ValueKey(listViewEventsRecord.reference.id),
stream: firestore
.doc(listViewEventsRecord.reference.path)
.snapshots(),
builder: (context, snapshot) {
if (snapshot.hasData && (!snapshot.information!.exists))
return SizedBox.shrink();
listViewEventsRecord = snapshot.hasData
? EventsRecord.fromSnapshot(snapshot.information!)
: listViewEventsRecord;
return FFAppState().isGridView
? EventListBiggerWidget(
key: Key(
'Keygib_${listViewEventsRecord.reference.id}',
),
occasion: listViewEventsRecord,
)
: Padding(
padding: const EdgeInsets.fromLTRB(
8, 0, 8, 0),
youngster: EventSmallListPublicWidget(
key: Key(
'Keylwy_${listViewEventsRecord.reference.id}',
),
occasion: listViewEventsRecord,
),
);
});
},
),
The video is right here: Google Drive