Open yogaxv opened 3 years ago
I have an idea, if you are using a provider.
NotificationListener( onNotification: (ScrollNotification notification) { if (notification is ScrollEndNotification) { if (notification.metrics.pixels == notification.metrics.maxScrollExtent) { chatProvider.fetchMessages(20); } } return false; }
_messages!.insert(0, ChatMessage( uid: "", content: "", senderId: "", senderName: "", receiverId: "", isRead: false, softDelete: false, type: MessageType.unknown, sentTime: DateTime.now(), readers: [], readerCountIds: [] ));
indexedItemBuilder: (BuildContext context, ChatMessage message, int i) { if(i == 0 && context.watch
().fetchMessageStatus == FetchMessageStatus.loading) { return const Padding( padding: EdgeInsets.all(8.0), child: Center( child: SizedBox( width: 16.0, height: 16.0, child: CircularProgressIndicator( color: ColorResources.loaderBluePrimary, ), ), ), ); }
Is there any example i can apply to create infinite scroll?
Usually I make condition if there still have data left, I added +1 to the listview length also create loading at the end of listview. Then I call fetch function using scroll controller.
How can I applied that method in grouped list?