Skip to content

Commit 35a6ee7

Browse files
committed
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.
1 parent b8144d1 commit 35a6ee7

File tree

1 file changed

+36
-31
lines changed

1 file changed

+36
-31
lines changed

lib/widgets/message_list.dart

+36-31
Original file line numberDiff line numberDiff line change
@@ -788,25 +788,41 @@ class MessageWithPossibleSender extends StatelessWidget {
788788
senderWidget = Column(
789789
children: [
790790
const SizedBox(height: 3),
791-
GestureDetector(
792-
onTap: () => Navigator.push(context,
793-
ProfilePage.buildRoute(context: context,
794-
userId: message.senderId)),
795-
child: Row(
796-
children: [
797-
Avatar(size: 32, borderRadius: 3, userId: message.senderId),
798-
const SizedBox(width: 8),
799-
Flexible(
800-
child: Text(message.senderFullName, // TODO get from user data
801-
style: const TextStyle(
802-
fontFamily: 'Source Sans 3',
803-
fontSize: 18,
804-
height: (22 / 18),
805-
).merge(weightVariableTextStyle(context, wght: 600,
806-
wghtIfPlatformRequestsBold: 900)),
807-
overflow: TextOverflow.ellipsis),
808-
),
809-
])),
791+
Row(
792+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
793+
crossAxisAlignment: CrossAxisAlignment.baseline,
794+
textBaseline: TextBaseline.alphabetic,
795+
children: [
796+
Flexible(
797+
child: GestureDetector(
798+
onTap: () => Navigator.push(context,
799+
ProfilePage.buildRoute(context: context,
800+
userId: message.senderId)),
801+
child: Row(
802+
children: [
803+
Avatar(size: 32, borderRadius: 3, userId: message.senderId),
804+
const SizedBox(width: 8),
805+
Flexible(
806+
child: Text(message.senderFullName, // TODO get from user data
807+
style: const TextStyle(
808+
fontFamily: 'Source Sans 3',
809+
fontSize: 18,
810+
height: (22 / 18),
811+
).merge(weightVariableTextStyle(context, wght: 600,
812+
wghtIfPlatformRequestsBold: 900)),
813+
overflow: TextOverflow.ellipsis),
814+
),
815+
])),
816+
),
817+
Text(time,
818+
style: TextStyle(
819+
color: _kMessageTimestampColor,
820+
fontFamily: 'Source Sans 3',
821+
fontSize: 16,
822+
height: (18 / 16),
823+
fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')],
824+
).merge(weightVariableTextStyle(context))),
825+
]),
810826
const SizedBox(height: 4),
811827
],
812828
);
@@ -830,18 +846,7 @@ class MessageWithPossibleSender extends StatelessWidget {
830846
if ((message.reactions?.total ?? 0) > 0)
831847
ReactionChipsList(messageId: message.id, reactions: message.reactions!)
832848
])),
833-
Container(
834-
width: 80,
835-
padding: const EdgeInsets.only(top: 4, right: 16),
836-
alignment: Alignment.topRight,
837-
child: Text(time,
838-
style: TextStyle(
839-
color: _kMessageTimestampColor,
840-
fontFamily: 'Source Sans 3',
841-
fontSize: 16,
842-
height: (18 / 16),
843-
fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')],
844-
).merge(weightVariableTextStyle(context)))),
849+
const SizedBox(width: 16),
845850
])));
846851
}
847852
}

0 commit comments

Comments
 (0)