Skip to content

Commit 7db16fb

Browse files
committed
msglist: 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 30dbcc5 commit 7db16fb

File tree

1 file changed

+52
-52
lines changed

1 file changed

+52
-52
lines changed

lib/widgets/message_list.dart

+52-52
Original file line numberDiff line numberDiff line change
@@ -854,64 +854,64 @@ 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
return GestureDetector(
895897
behavior: HitTestBehavior.translucent,
896898
onLongPress: () => showMessageActionSheet(context: context, message: message),
897899
child: Padding(
898900
padding: const EdgeInsets.symmetric(vertical: 4),
899-
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
900-
const SizedBox(width: 16),
901-
Expanded(
902-
child: Column(
903-
crossAxisAlignment: CrossAxisAlignment.stretch,
904-
children: [
905-
if (senderRow != null) ...[
906-
const SizedBox(height: 2),
907-
senderRow,
908-
const SizedBox(height: 4),
909-
],
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),
901+
child: Column(children: [
902+
if (senderRow != null) senderRow,
903+
Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
904+
const SizedBox(width: 16),
905+
Expanded(
906+
child: Column(
907+
crossAxisAlignment: CrossAxisAlignment.stretch,
908+
children: [
909+
MessageContent(message: message, content: item.content),
910+
if ((message.reactions?.total ?? 0) > 0)
911+
ReactionChipsList(messageId: message.id, reactions: message.reactions!)
912+
])),
913+
const SizedBox(width: 16),
914+
]),
915915
])));
916916
}
917917
}

0 commit comments

Comments
 (0)