Show real photos for people instead of scene art

Your avatar is your photo, picked from the device by tapping it on Home or
from a new Profile photo row in Settings, shrunk to 256 px and kept on the
phone (there is no upload endpoint yet). Group members show the photo the
server sends in a new `photo` field, everywhere avatars appear. Without a
photo, an initial on a neutral disc. Mock mode bundles free Unsplash
portraits for the sample people.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KhQh614DMeYoQEH9SoMRUw
This commit is contained in:
alvocool
2026-11-09 08:22:41 +03:00
parent 72786701a9
commit 1b5d105400
33 changed files with 406 additions and 168 deletions

View File

@@ -98,6 +98,16 @@ class GroupChatState extends State<GroupChat> implements ConnectGroupChat {
_onSend(reply);
}
/// A message author's photo, looked up among the group's members.
String _photoOf(String authorId) {
for (final member in widget.group.members) {
if (member.id == authorId) {
return member.photo;
}
}
return "";
}
// ── Views ─────────────────────────────────────────────────────────────────
Widget _mobileView(BoxConstraints constraints) {
@@ -145,8 +155,7 @@ class GroupChatState extends State<GroupChat> implements ConnectGroupChat {
return Container(
decoration: BoxDecoration(
borderRadius:
const BorderRadius.vertical(bottom: Radius.circular(20)),
borderRadius: const BorderRadius.vertical(bottom: Radius.circular(20)),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
@@ -188,7 +197,10 @@ class GroupChatState extends State<GroupChat> implements ConnectGroupChat {
const SizedBox(width: 10),
avatarStack(
widget.group.members.map((member) => member.name).toList(), 30,
max: 3, border: colorNight),
photos:
widget.group.members.map((member) => member.photo).toList(),
max: 3,
border: colorNight),
],
),
);
@@ -275,7 +287,8 @@ class GroupChatState extends State<GroupChat> implements ConnectGroupChat {
children: [
grouped
? const SizedBox(width: 34)
: memberAvatar(message.authorName, 34),
: memberAvatar(message.authorName, 34,
photo: _photoOf(message.authorId)),
const SizedBox(width: 8),
Flexible(
child: Container(
@@ -328,7 +341,8 @@ class GroupChatState extends State<GroupChat> implements ConnectGroupChat {
),
child: Row(
children: [
memberAvatar(message.authorName, 34),
memberAvatar(message.authorName, 34,
photo: _photoOf(message.authorId)),
const SizedBox(width: 12),
Expanded(
child: Column(