Skip to content

Commit a1e4aff

Browse files
Update message_list.dart
Add avatars to DM recipient headers. Display user avatars alongside names in DM recipient headers, making conversations more visually identifiable. This matches the RN app's behavior The changes: - Add Avatar widgets in DM recipient headers - Maintain consistent sizing and spacing (35px size, 8px right padding) - Handle overflow gracefully for both avatars and names Fixes #41
1 parent 347e19e commit a1e4aff

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

lib/widgets/message_list.dart

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,40 @@ class MessageListAppBarTitle extends StatelessWidget {
358358

359359
case DmNarrow(:var otherRecipientIds):
360360
final store = PerAccountStoreWidget.of(context);
361-
if (otherRecipientIds.isEmpty) {
362-
return const Text("DMs with yourself");
363-
} else {
364-
final names = otherRecipientIds.map((id) => store.users[id]?.fullName ?? '(unknown user)');
365-
return Text("DMs with ${names.join(", ")}"); // TODO show avatars
366-
}
361+
return Row(
362+
children: [
363+
if (otherRecipientIds.isEmpty)
364+
Padding(
365+
padding: const EdgeInsets.only(right: 8),
366+
child: Avatar(
367+
size: 35,
368+
borderRadius: 32 / 8,
369+
userId: store.selfUserId,
370+
),
371+
)
372+
else
373+
...otherRecipientIds.map(
374+
(id) => Padding(
375+
padding: const EdgeInsets.only(right: 8),
376+
child: Avatar(
377+
size: 35,
378+
borderRadius: 32 / 8,
379+
userId: id,
380+
),
381+
),
382+
),
383+
Expanded(
384+
child: Text(
385+
otherRecipientIds.isEmpty
386+
? store.users[store.selfUserId]?.fullName ?? '(unknown user)'
387+
: otherRecipientIds
388+
.map((id) => store.users[id]?.fullName ?? '(unknown user)')
389+
.join(", "),
390+
overflow: TextOverflow.ellipsis,
391+
),
392+
),
393+
],
394+
);
367395
}
368396
}
369397
}

0 commit comments

Comments
 (0)