Created
January 28, 2023 09:20
-
-
Save ologunB/9e9acbb0f8bab29f02a1567ec8b681ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GroupedListView<NewMessageModel, String>( | |
elements: allMessages, | |
reverse: true, | |
controller: _scrollController, | |
groupBy: (element) => | |
(element.createdAt ~/ 86400000).toString(), | |
groupSeparatorBuilder: (String groupByValue) => Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: [ | |
Container( | |
padding: EdgeInsets.symmetric( | |
horizontal: 40.h, vertical: 10.h), | |
decoration: BoxDecoration( | |
color: AppColors.black, | |
borderRadius: BorderRadius.circular(8)), | |
child: regularText( | |
DateFormat('MMMM dd, yyyy').format( | |
DateTime.fromMillisecondsSinceEpoch( | |
int.parse(groupByValue) * 86400000)), | |
fontSize: 14, | |
color: AppColors.white, | |
), | |
) | |
], | |
), | |
itemBuilder: (context, dynamic element) => | |
MessageBubble( | |
text: element.text, | |
isSender: element.from == AppCache.getUser.uid, | |
isRead: element.isRead, | |
timeSent: DateFormat('hh:mm a').format( | |
DateTime.fromMillisecondsSinceEpoch( | |
element.createdAt)), | |
), | |
itemComparator: (a,b) => | |
a.createdAt.compareTo(b.createdAt), | |
useStickyGroupSeparators: true, | |
floatingHeader: true, | |
order: GroupedListOrder.DESC, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment