From 3fb13f364cf5e5685e973372a47708a5073c5418 Mon Sep 17 00:00:00 2001 From: Luis Pulido Date: Tue, 7 Apr 2020 11:10:35 -0400 Subject: [PATCH] added user's name to message box --- lib/src/message_widget.dart | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/src/message_widget.dart b/lib/src/message_widget.dart index 8eaed2a5..9fe748de 100644 --- a/lib/src/message_widget.dart +++ b/lib/src/message_widget.dart @@ -980,12 +980,23 @@ class _MessageWidgetState extends State Widget _buildTimestamp(Alignment alignment) { return Padding( padding: const EdgeInsets.only(top: 5.0), - child: widget.message.createdAt != null - ? Text( - Jiffy(widget.message.createdAt.toLocal()).format('HH:mm'), - style: _messageTheme.createdAt, - ) - : SizedBox(), + child: RichText( + text: TextSpan( + style: _messageTheme.createdAt, + children: [ + if (!_isMyMessage) + TextSpan( + text: widget.message.user.name, + style: TextStyle(fontWeight: FontWeight.bold), + ), + if (widget.message.createdAt != null) + TextSpan( + text: + Jiffy(widget.message.createdAt.toLocal()).format(' HH:mm'), + ), + ], + ), + ), ); }