From 881c5b583007b18427b42d52722ad247b981c6b9 Mon Sep 17 00:00:00 2001 From: Rafael <1024481@stud.hs-mannheim.de> Date: Fri, 3 May 2024 11:12:36 +0200 Subject: [PATCH] showing timestamps on chats --- lib/pages/chat_page.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/pages/chat_page.dart b/lib/pages/chat_page.dart index 509642a..8c476b1 100644 --- a/lib/pages/chat_page.dart +++ b/lib/pages/chat_page.dart @@ -135,12 +135,22 @@ class _ChatPageState extends State { var alignment = isCurrentUser ? Alignment.centerRight : Alignment.centerLeft; + List msgDate = + (data['timestamp'] as Timestamp).toDate().toIso8601String().split("T"); + return Container( alignment: alignment, child: Column( crossAxisAlignment: isCurrentUser ? CrossAxisAlignment.end : CrossAxisAlignment.start, children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 25.0), + child: Text( + "${msgDate[0]} ${msgDate[1].substring(0, 8)}", + style: TextStyle(color: Colors.grey.shade600), + ), + ), ChatBubble( message: data["message"], isCurrentUser: isCurrentUser,