feat: Added sticky header to display position data

This commit is contained in:
Deven Joshi
2020-10-27 13:37:00 +05:30
parent bbb71ec47f
commit d93dfb5af4
+5 -4
View File
@@ -160,6 +160,7 @@ class _MessageListViewState extends State<MessageListView> {
return WidgetsVisibilityProvider( return WidgetsVisibilityProvider(
condition: (c) => null, condition: (c) => null,
child: Stack( child: Stack(
alignment: Alignment.center,
children: [ children: [
NotificationListener<ScrollNotification>( NotificationListener<ScrollNotification>(
onNotification: (_) { onNotification: (_) {
@@ -301,13 +302,13 @@ class _MessageListViewState extends State<MessageListView> {
child: WidgetsVisibilityListener( child: WidgetsVisibilityListener(
listener: (context, event) { listener: (context, event) {
setState(() { setState(() {
positionData = event.positionDataList.first.startPosition; positionData = event.positionDataList.isNotEmpty ? event.positionDataList[0] : null;
}); });
}, },
child: Chip( child: DateDivider(
label: Text(positionData.toString()), dateTime: _messages[positionData].createdAt.toLocal(),
),
), ),
),
), ),
], ],
), ),