Skip to content

Commit

Permalink
msglist [nfc]: Move senderRow to local
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpengi committed Jan 24, 2024
1 parent 45e4ef4 commit b8c89d1
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions lib/widgets/message_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,21 @@ class MessageWithPossibleSender extends StatelessWidget {
final time = _kMessageTimestampFormat
.format(DateTime.fromMillisecondsSinceEpoch(1000 * message.timestamp));

Widget? senderRow;
if (item.showSender) {
senderRow = GestureDetector(
onTap: () => Navigator.push(context,
ProfilePage.buildRoute(context: context,
userId: message.senderId)),
child: 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))));
}

return GestureDetector(
behavior: HitTestBehavior.translucent,
onLongPress: () => showMessageActionSheet(context: context, message: message),
Expand All @@ -877,17 +892,7 @@ class MessageWithPossibleSender extends StatelessWidget {
children: [
if (item.showSender) ...[
const SizedBox(height: 3),
GestureDetector(
onTap: () => Navigator.push(context,
ProfilePage.buildRoute(context: context,
userId: message.senderId)),
child: 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)))),
senderRow!,
const SizedBox(height: 4),
],
MessageContent(message: message, content: item.content),
Expand Down

0 comments on commit b8c89d1

Please sign in to comment.