Skip to content

Commit b8c89d1

Browse files
committed
msglist [nfc]: Move senderRow to local
1 parent 45e4ef4 commit b8c89d1

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

lib/widgets/message_list.dart

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

858+
Widget? senderRow;
859+
if (item.showSender) {
860+
senderRow = GestureDetector(
861+
onTap: () => Navigator.push(context,
862+
ProfilePage.buildRoute(context: context,
863+
userId: message.senderId)),
864+
child: Text(message.senderFullName, // TODO get from user data
865+
style: const TextStyle(
866+
fontFamily: 'Source Sans 3',
867+
fontSize: 18,
868+
height: (22 / 18),
869+
).merge(weightVariableTextStyle(context, wght: 600,
870+
wghtIfPlatformRequestsBold: 900))));
871+
}
872+
858873
return GestureDetector(
859874
behavior: HitTestBehavior.translucent,
860875
onLongPress: () => showMessageActionSheet(context: context, message: message),
@@ -877,17 +892,7 @@ class MessageWithPossibleSender extends StatelessWidget {
877892
children: [
878893
if (item.showSender) ...[
879894
const SizedBox(height: 3),
880-
GestureDetector(
881-
onTap: () => Navigator.push(context,
882-
ProfilePage.buildRoute(context: context,
883-
userId: message.senderId)),
884-
child: Text(message.senderFullName, // TODO get from user data
885-
style: const TextStyle(
886-
fontFamily: 'Source Sans 3',
887-
fontSize: 18,
888-
height: (22 / 18),
889-
).merge(weightVariableTextStyle(context, wght: 600,
890-
wghtIfPlatformRequestsBold: 900)))),
895+
senderRow!,
891896
const SizedBox(height: 4),
892897
],
893898
MessageContent(message: message, content: item.content),

0 commit comments

Comments
 (0)