Skip to content

Commit

Permalink
msglist: Move message timestamp together with message sender
Browse files Browse the repository at this point in the history
An additional `Flexible` around the `GestureDetector` was
necessary to maintain the user name being able to overflow
properly.
  • Loading branch information
sirpengi committed Dec 8, 2023
1 parent b8144d1 commit 35a6ee7
Showing 1 changed file with 36 additions and 31 deletions.
67 changes: 36 additions & 31 deletions lib/widgets/message_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -788,25 +788,41 @@ class MessageWithPossibleSender extends StatelessWidget {
senderWidget = Column(
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),
),
])),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
Flexible(
child: 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),
),
])),
),
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(height: 4),
],
);
Expand All @@ -830,18 +846,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),
])));
}
}
Expand Down

0 comments on commit 35a6ee7

Please sign in to comment.