From b917ca453ada81ecd25178bac5549e79590495aa Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Wed, 6 Dec 2023 16:21:40 +0000 Subject: [PATCH] msglist: Move message timestamp together with message sender An additional `Flexible` around the `GestureDetector` was necessary to maintain the user name being able to overflow properly. --- lib/widgets/message_list.dart | 74 ++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/lib/widgets/message_list.dart b/lib/widgets/message_list.dart index 6ad6471a46..f041b1d0e4 100644 --- a/lib/widgets/message_list.dart +++ b/lib/widgets/message_list.dart @@ -785,31 +785,44 @@ class MessageWithPossibleSender extends StatelessWidget { final Widget senderWidget; if (item.showSender) { - senderWidget = Column( + senderWidget = Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.baseline, + textBaseline: TextBaseline.alphabetic, children: [ - const SizedBox(height: 3), - GestureDetector( - onTap: () => Navigator.push(context, - ProfilePage.buildRoute(context: context, - userId: message.senderId)), - child: Row( - children: [ - Avatar(size: 32, borderRadius: 3, userId: message.senderId), - const SizedBox(width: 8), - Flexible( - child: Text(message.senderFullName, // TODO get from user data - style: const TextStyle( - fontFamily: 'Source Sans 3', - fontSize: 18, - height: (22 / 18), - ).merge(weightVariableTextStyle(context, wght: 600, - wghtIfPlatformRequestsBold: 900)), - overflow: TextOverflow.ellipsis), - ), - ])), - const SizedBox(height: 4), - ], - ); + Flexible( + child: GestureDetector( + onTap: () => Navigator.push(context, + ProfilePage.buildRoute(context: context, + userId: message.senderId)), + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 2), + child: Row( + children: [ + Avatar(size: 32, borderRadius: 3, userId: message.senderId), + const SizedBox(width: 8), + Flexible( + child: Text(message.senderFullName, // TODO get from user data + style: const TextStyle( + fontFamily: 'Source Sans 3', + fontSize: 18, + height: (22 / 18), + ).merge(weightVariableTextStyle(context, wght: 600, + wghtIfPlatformRequestsBold: 900)), + overflow: TextOverflow.ellipsis), + ), + ]), + )), + ), + Text(time, + style: TextStyle( + color: _kMessageTimestampColor, + fontFamily: 'Source Sans 3', + fontSize: 16, + height: (18 / 16), + fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')], + ).merge(weightVariableTextStyle(context))), + ]); } else { senderWidget = const SizedBox.shrink(); } @@ -830,18 +843,7 @@ class MessageWithPossibleSender extends StatelessWidget { if ((message.reactions?.total ?? 0) > 0) ReactionChipsList(messageId: message.id, reactions: message.reactions!) ])), - Container( - width: 80, - padding: const EdgeInsets.only(top: 4, right: 16), - alignment: Alignment.topRight, - child: Text(time, - style: TextStyle( - color: _kMessageTimestampColor, - fontFamily: 'Source Sans 3', - fontSize: 16, - height: (18 / 16), - fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')], - ).merge(weightVariableTextStyle(context)))), + const SizedBox(width: 16), ]))); } }