Skip to content

Commit

Permalink
widget fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpengi committed Dec 1, 2023
1 parent ab95751 commit e9680e5
Showing 1 changed file with 44 additions and 37 deletions.
81 changes: 44 additions & 37 deletions lib/widgets/message_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -773,56 +773,63 @@ class MessageWithPossibleSender extends StatelessWidget {
final time = _kMessageTimestampFormat
.format(DateTime.fromMillisecondsSinceEpoch(1000 * message.timestamp));

final Widget senderWidget;
if (item.showSender) {
senderWidget = Row(mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
Flexible(
fit: FlexFit.loose,
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 6, 0, 0),
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),
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),
])))),
Padding(
padding: const EdgeInsets.only(right: 16),
child: Text(time,
style: TextStyle(
color: _kMessageTimestampColor,
fontFamily: 'Source Sans 3',
fontSize: 17,
height: (22 / 17),
fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')],
).merge(weightVariableTextStyle(context)))),
]);
} else {
senderWidget = const SizedBox.shrink();
}

return GestureDetector(
behavior: HitTestBehavior.translucent,
onLongPress: () => showMessageActionSheet(context: context, message: message),
// TODO clean up this layout, by less precisely imitating web
child: Column(
children: [
const SizedBox(height: 2),
if (item.showSender)
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
fit: FlexFit.loose,
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 6, 0, 0),
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),
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),
])))),
Padding(
padding: const EdgeInsets.only(right: 16),
child: Text(time,
style: TextStyle(
color: _kMessageTimestampColor,
fontFamily: 'Source Sans 3',
fontSize: 17,
height: (22 / 17),
fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')],
).merge(weightVariableTextStyle(context)))),
]),
senderWidget,
Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
const SizedBox(width: 16),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: MessageContent(message: message, content: item.content))),
padding: const EdgeInsets.symmetric(vertical: 4),
child: MessageContent(message: message, content: item.content))),
SizedBox(width: 16,
child: Column(
children: [
Expand Down

0 comments on commit e9680e5

Please sign in to comment.