Last updated:
0 purchases
flutter chat list
Chat List #
Chat list library is based on flutter list view library to implement full chat list functionality.
Features #
Support loading more and loading previous messages.
Support keeping scroll position when user scroll to other position to read messages.
Support scrolling to unread message.
Support detecting receive message and tip new received messages
Support timetag in messages
Support load fragment messages and infine load prev messages
Screen #
Example #
Widget _renderList() {
return ChatList(
msgCount: messages?.length ?? 0,
itemBuilder: (BuildContext context, int index) => _renderItem(index),
onMsgKey: (int index) => messages![index].id,
controller: chatListController,
// New message tip
showReceivedMsgButton: true,
onIsReceiveMessage: (int i) => messages![i].type == MsgType.receive,
// Scroll to top
showScrollToTopButton: true,
);
}
copied to clipboard
More complex example
Widget _renderList() {
return ChatList(
msgCount: messages?.length ?? 0,
itemBuilder: (BuildContext context, int index) => _renderItem(index),
onMsgKey: (int index) => messages![index].id,
controller: chatListController,
// New message tip
showReceivedMsgButton: true,
receivedMsgButtonPosition: const Position(right: 0, bottom: 20),
// newMessageComingButtonBuilder: defaultNewMessageComingButtonBuilder,
onIsReceiveMessage: (int i) => messages![i].type == MsgType.receive,
// Scroll to top
showScrollToTopButton: true,
offsetToShowScrollToTop: 400.0,
// scrollToTopBuilder: defaultScrollToTopBuilder,
onLoadTopMsgs: _loadTopMessagesWhenJumpToTop,
// Last read message
showUnreadMsgButton: true,
latestReadMsgKey: latestMessageKey,
unreadMsgCount: unreadMsgCount,
unreadMsgButtonPosition: const Position(right: 0, top: 20),
onLoadMsgsByLatestReadMsgKey: _loadMoreMessagesWhileMissLatestMsg,
offsetFromUnreadTipToTop: 50,
// lastReadMessageButtonBuilder: defaultLastReadMessageButtonBuilder,
// Refresh
hasPrevMsgs: hasPrevMessages,
offsetToTriggerLoadPrev: 100,
loadPrevProgressBuilder: defaultLoadPrevProgressBuilder,
onLoadPrevMsgs: _loadPrevMessages,
// Load more
hasMoreMsgs: hasMoreMessages,
offsetToTriggerLoadMore: 10,
loadMoreProgressBuilder: defaultLoadMoreProgressBuilder,
onLoadMoreMsgs: _loadMoreMessages,
);
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.