Skip to content

Commit 1b25513

Browse files
committed
msglist [nfc]: Move senderRow into a separate row
Moved widgets around such that the gutters to the left and right of message contents are ready for future decorative elements. Fixes-partly: #157
1 parent 3293ac5 commit 1b25513

File tree

1 file changed

+52
-52
lines changed

1 file changed

+52
-52
lines changed

lib/widgets/message_list.dart

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -854,65 +854,65 @@ class MessageWithPossibleSender extends StatelessWidget {
854854
final message = item.message;
855855

856856
final Widget? senderRow = item.showSender
857-
? Row(
858-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
859-
crossAxisAlignment: CrossAxisAlignment.baseline,
860-
textBaseline: TextBaseline.alphabetic,
861-
children: [
862-
Flexible(
863-
child: GestureDetector(
864-
onTap: () => Navigator.push(context,
865-
ProfilePage.buildRoute(context: context,
866-
userId: message.senderId)),
867-
child: Row(
868-
children: [
869-
Avatar(size: 32, borderRadius: 3,
870-
userId: message.senderId),
871-
const SizedBox(width: 8),
872-
Flexible(
873-
child: Text(message.senderFullName, // TODO get from user data
874-
style: const TextStyle(
875-
fontFamily: 'Source Sans 3',
876-
fontSize: 18,
877-
height: (22 / 18),
878-
).merge(weightVariableTextStyle(context, wght: 600,
879-
wghtIfPlatformRequestsBold: 900)),
880-
overflow: TextOverflow.ellipsis)),
881-
]))),
882-
Text(
883-
_kMessageTimestampFormat.format(
884-
DateTime.fromMillisecondsSinceEpoch(1000 * message.timestamp)),
885-
style: TextStyle(
886-
color: _kMessageTimestampColor,
887-
fontFamily: 'Source Sans 3',
888-
fontSize: 16,
889-
height: (18 / 16),
890-
fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')],
891-
).merge(weightVariableTextStyle(context))),
892-
])
857+
? Padding(
858+
padding: const EdgeInsets.only(top: 2, bottom: 4, left: 16, right: 16),
859+
child: Row(
860+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
861+
crossAxisAlignment: CrossAxisAlignment.baseline,
862+
textBaseline: TextBaseline.alphabetic,
863+
children: [
864+
Flexible(
865+
child: GestureDetector(
866+
onTap: () => Navigator.push(context,
867+
ProfilePage.buildRoute(context: context,
868+
userId: message.senderId)),
869+
child: Row(
870+
children: [
871+
Avatar(size: 32, borderRadius: 3,
872+
userId: message.senderId),
873+
const SizedBox(width: 8),
874+
Flexible(
875+
child: Text(message.senderFullName, // TODO get from user data
876+
style: const TextStyle(
877+
fontFamily: 'Source Sans 3',
878+
fontSize: 18,
879+
height: (22 / 18),
880+
).merge(weightVariableTextStyle(context, wght: 600,
881+
wghtIfPlatformRequestsBold: 900)),
882+
overflow: TextOverflow.ellipsis)),
883+
]))),
884+
Text(
885+
_kMessageTimestampFormat.format(
886+
DateTime.fromMillisecondsSinceEpoch(1000 * message.timestamp)),
887+
style: TextStyle(
888+
color: _kMessageTimestampColor,
889+
fontFamily: 'Source Sans 3',
890+
fontSize: 16,
891+
height: (18 / 16),
892+
fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')],
893+
).merge(weightVariableTextStyle(context))),
894+
]))
893895
: null;
894896

895897
return GestureDetector(
896898
behavior: HitTestBehavior.translucent,
897899
onLongPress: () => showMessageActionSheet(context: context, message: message),
898900
child: Padding(
899901
padding: const EdgeInsets.symmetric(vertical: 4),
900-
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
901-
const SizedBox(width: 16),
902-
Expanded(
903-
child: Column(
904-
crossAxisAlignment: CrossAxisAlignment.stretch,
905-
children: [
906-
if (senderRow != null) ...[
907-
const SizedBox(height: 2),
908-
senderRow,
909-
const SizedBox(height: 4),
910-
],
911-
MessageContent(message: message, content: item.content),
912-
if ((message.reactions?.total ?? 0) > 0)
913-
ReactionChipsList(messageId: message.id, reactions: message.reactions!)
914-
])),
915-
const SizedBox(width: 16),
902+
child: Column(children: [
903+
if (senderRow != null) senderRow,
904+
Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
905+
const SizedBox(width: 16),
906+
Expanded(
907+
child: Column(
908+
crossAxisAlignment: CrossAxisAlignment.stretch,
909+
children: [
910+
MessageContent(message: message, content: item.content),
911+
if ((message.reactions?.total ?? 0) > 0)
912+
ReactionChipsList(messageId: message.id, reactions: message.reactions!)
913+
])),
914+
const SizedBox(width: 16),
915+
]),
916916
])));
917917
}
918918
}

0 commit comments

Comments
 (0)