showing timestamps on chats
parent
3425cec5b6
commit
881c5b5830
|
@ -135,12 +135,22 @@ class _ChatPageState extends State<ChatPage> {
|
||||||
var alignment =
|
var alignment =
|
||||||
isCurrentUser ? Alignment.centerRight : Alignment.centerLeft;
|
isCurrentUser ? Alignment.centerRight : Alignment.centerLeft;
|
||||||
|
|
||||||
|
List<String> msgDate =
|
||||||
|
(data['timestamp'] as Timestamp).toDate().toIso8601String().split("T");
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
alignment: alignment,
|
alignment: alignment,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
isCurrentUser ? CrossAxisAlignment.end : CrossAxisAlignment.start,
|
isCurrentUser ? CrossAxisAlignment.end : CrossAxisAlignment.start,
|
||||||
children: [
|
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(
|
ChatBubble(
|
||||||
message: data["message"],
|
message: data["message"],
|
||||||
isCurrentUser: isCurrentUser,
|
isCurrentUser: isCurrentUser,
|
||||||
|
|
Loading…
Reference in New Issue