Skip to content

Commit ae8d9f3

Browse files
committed
msglist [nfc]: Move senderRow to local
1 parent 1d3d41d commit ae8d9f3

File tree

1 file changed

+30
-27
lines changed

1 file changed

+30
-27
lines changed

lib/widgets/message_list.dart

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,35 @@ class MessageWithPossibleSender extends StatelessWidget {
855855
final time = _kMessageTimestampFormat
856856
.format(DateTime.fromMillisecondsSinceEpoch(1000 * message.timestamp));
857857

858+
final Widget? senderRow = item.showSender
859+
? Row(
860+
children: [
861+
GestureDetector(
862+
onTap: () => Navigator.push(context,
863+
ProfilePage.buildRoute(context: context,
864+
userId: message.senderId)),
865+
child: Row(
866+
children: [
867+
Avatar(size: 35, borderRadius: 4,
868+
userId: message.senderId),
869+
Text(message.senderFullName, // TODO get from user data
870+
style: const TextStyle(
871+
fontFamily: 'Source Sans 3',
872+
fontSize: 18,
873+
height: (22 / 18),
874+
).merge(weightVariableTextStyle(context, wght: 600,
875+
wghtIfPlatformRequestsBold: 900))),
876+
])),
877+
Text(time,
878+
style: TextStyle(
879+
color: _kMessageTimestampColor,
880+
fontFamily: 'Source Sans 3',
881+
fontSize: 16,
882+
height: (18 / 16),
883+
fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')],
884+
).merge(weightVariableTextStyle(context))),
885+
])
886+
: null;
858887
return GestureDetector(
859888
behavior: HitTestBehavior.translucent,
860889
onLongPress: () => showMessageActionSheet(context: context, message: message),
@@ -868,33 +897,7 @@ class MessageWithPossibleSender extends StatelessWidget {
868897
children: [
869898
if (item.showSender) ...[
870899
const SizedBox(height: 3),
871-
Row(
872-
children: [
873-
GestureDetector(
874-
onTap: () => Navigator.push(context,
875-
ProfilePage.buildRoute(context: context,
876-
userId: message.senderId)),
877-
child: Row(
878-
children: [
879-
Avatar(size: 35, borderRadius: 4,
880-
userId: message.senderId),
881-
Text(message.senderFullName, // TODO get from user data
882-
style: const TextStyle(
883-
fontFamily: 'Source Sans 3',
884-
fontSize: 18,
885-
height: (22 / 18),
886-
).merge(weightVariableTextStyle(context, wght: 600,
887-
wghtIfPlatformRequestsBold: 900))),
888-
])),
889-
Text(time,
890-
style: TextStyle(
891-
color: _kMessageTimestampColor,
892-
fontFamily: 'Source Sans 3',
893-
fontSize: 16,
894-
height: (18 / 16),
895-
fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')],
896-
).merge(weightVariableTextStyle(context))),
897-
]),
900+
if (senderRow != null) senderRow,
898901
const SizedBox(height: 4),
899902
],
900903
MessageContent(message: message, content: item.content),

0 commit comments

Comments
 (0)