Skip to content

Commit 3ef062c

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 51ad35b commit 3ef062c

File tree

1 file changed

+38
-32
lines changed

1 file changed

+38
-32
lines changed

lib/widgets/message_list.dart

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -789,26 +789,43 @@ class MessageWithPossibleSender extends StatelessWidget {
789789
senderWidget = Column(
790790
children: [
791791
const SizedBox(height: 3),
792-
GestureDetector(
793-
onTap: () => Navigator.push(context,
794-
ProfilePage.buildRoute(context: context,
795-
userId: message.senderId)),
796-
child: Row(
797-
children: [
798-
Avatar(size: 32, borderRadius: 3, userId: message.senderId),
799-
const SizedBox(width: 8),
800-
Flexible(
801-
fit: FlexFit.loose,
802-
child: Text(message.senderFullName, // TODO get from user data
803-
style: const TextStyle(
804-
fontFamily: 'Source Sans 3',
805-
fontSize: 18,
806-
height: (22 / 18),
807-
).merge(weightVariableTextStyle(context, wght: 600,
808-
wghtIfPlatformRequestsBold: 900)),
809-
overflow: TextOverflow.ellipsis),
810-
),
811-
])),
792+
Row(
793+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
794+
crossAxisAlignment: CrossAxisAlignment.baseline,
795+
textBaseline: TextBaseline.alphabetic,
796+
children: [
797+
Flexible(
798+
fit: FlexFit.loose,
799+
child: GestureDetector(
800+
onTap: () => Navigator.push(context,
801+
ProfilePage.buildRoute(context: context,
802+
userId: message.senderId)),
803+
child: Row(
804+
children: [
805+
Avatar(size: 32, borderRadius: 3, userId: message.senderId),
806+
const SizedBox(width: 8),
807+
Flexible(
808+
fit: FlexFit.loose,
809+
child: Text(message.senderFullName, // TODO get from user data
810+
style: const TextStyle(
811+
fontFamily: 'Source Sans 3',
812+
fontSize: 18,
813+
height: (22 / 18),
814+
).merge(weightVariableTextStyle(context, wght: 600,
815+
wghtIfPlatformRequestsBold: 900)),
816+
overflow: TextOverflow.ellipsis),
817+
),
818+
])),
819+
),
820+
Text(time,
821+
style: TextStyle(
822+
color: _kMessageTimestampColor,
823+
fontFamily: 'Source Sans 3',
824+
fontSize: 16,
825+
height: (18 / 16),
826+
fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')],
827+
).merge(weightVariableTextStyle(context))),
828+
]),
812829
const SizedBox(height: 4),
813830
],
814831
);
@@ -832,18 +849,7 @@ class MessageWithPossibleSender extends StatelessWidget {
832849
if ((message.reactions?.total ?? 0) > 0)
833850
ReactionChipsList(messageId: message.id, reactions: message.reactions!)
834851
])),
835-
Container(
836-
width: 80,
837-
padding: const EdgeInsets.only(top: 4, right: 16),
838-
alignment: Alignment.topRight,
839-
child: Text(time,
840-
style: TextStyle(
841-
color: _kMessageTimestampColor,
842-
fontFamily: 'Source Sans 3',
843-
fontSize: 16,
844-
height: (18 / 16),
845-
fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')],
846-
).merge(weightVariableTextStyle(context)))),
852+
const SizedBox(width: 16),
847853
])));
848854
}
849855
}

0 commit comments

Comments
 (0)