Skip to content

Commit 25a4b6c

Browse files
author
DeveloperMahak
committed
Adding a you indicator
1 parent 760b87f commit 25a4b6c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/widgets/message_list.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,9 @@ class MessageWithPossibleSender extends StatelessWidget {
13181318
if (item.showSender) {
13191319
final time = _kMessageTimestampFormat
13201320
.format(DateTime.fromMillisecondsSinceEpoch(1000 * message.timestamp));
1321+
1322+
final isCurrentUser = store.account.userId == message.senderId;
1323+
13211324
senderRow = Row(
13221325
mainAxisAlignment: MainAxisAlignment.spaceBetween,
13231326
crossAxisAlignment: CrossAxisAlignment.baseline,
@@ -1334,13 +1337,15 @@ class MessageWithPossibleSender extends StatelessWidget {
13341337
userId: message.senderId),
13351338
const SizedBox(width: 8),
13361339
Flexible(
1337-
child: Text(message.senderFullName, // TODO get from user data
1340+
child: Text(isCurrentUser ? '${message.senderFullName} (you)' : message.senderFullName, // TODO get from user data
13381341
style: TextStyle(
13391342
fontSize: 18,
13401343
height: (22 / 18),
13411344
color: messageListTheme.senderName,
13421345
).merge(weightVariableTextStyle(context, wght: 600)),
1343-
overflow: TextOverflow.ellipsis)),
1346+
overflow: TextOverflow.ellipsis
1347+
)
1348+
),
13441349
if (sender?.isBot ?? false) ...[
13451350
const SizedBox(width: 5),
13461351
Icon(
@@ -1349,7 +1354,8 @@ class MessageWithPossibleSender extends StatelessWidget {
13491354
color: messageListTheme.senderBotIcon,
13501355
),
13511356
],
1352-
]))),
1357+
]
1358+
))),
13531359
const SizedBox(width: 4),
13541360
Text(time,
13551361
style: TextStyle(

0 commit comments

Comments
 (0)