Skip to content

refactor(client): adopt UserAvatar at inline-CircleAvatar sites#1113

Open
NC1107 wants to merge 1 commit into
mainfrom
refactor/user-avatar-adoption
Open

refactor(client): adopt UserAvatar at inline-CircleAvatar sites#1113
NC1107 wants to merge 1 commit into
mainfrom
refactor/user-avatar-adoption

Conversation

@NC1107
Copy link
Copy Markdown
Owner

@NC1107 NC1107 commented May 22, 2026

Componentization sweep from the 2026-05-22 audit (#1099). Reviewed 11 inline CircleAvatar / Container(shape: circle) sites flagged as candidates for the canonical UserAvatar widget. Only one of the 11 actually represented a real user — the rest are static decoration, the user's own profile-editor card (with bespoke camera-button + accent-border overlay), or group/channel avatars.

Behind the scenes

  • widgets/chat_panel/empty_message_placeholder.dart:22 — migrated to UserAvatar(openProfileOnTap: false, bgColor: context.accent). Threaded the peer's userId and avatarUrl through ChatMessageList (already had conv + myUserId + memberAvatars in scope), so the empty 1:1 placeholder now shows the peer's real avatar when one is set instead of always falling back to an initial circle.

Skipped (with reason)

Each of these was flagged by the audit but is not a user-avatar surface or would lose features if force-fit through UserAvatar's API:

  • screens/settings/accessibility_section.dart:78 — static "Sam Patel" font-scale preview card. No real user.
  • screens/settings/account_section.dart:452 — the local user's own profile-card avatar. Has a hand-built stack: accent-coloured border ring, camera-button upload overlay, hard-coded EchoTheme.online dot, and a NetworkImage with custom Authorization headers. Migrating would either widen UserAvatar's API significantly (a one-off use case) or drop the upload/auth-header features.
  • screens/join/join_preview_scaffold.dart:286Icons.link_off_rounded error icon, not a user.
  • screens/join/join_preview_scaffold.dart:366, 373 — group/server preview avatar (uses iconUrl and group-name initials, not a user).
  • screens/onboarding_wizard.dart:543 — avatar picker during signup. Includes a camera/upload overlay, accent border, and the user has no profile to open yet.
  • widgets/global_search_overlay.dart:630 — group result tile (uses r.title, not a user).
  • screens/group_info_screen/parts/header_section.dart:151, 159 — group header avatar with upload affordance. Not a user.
  • widgets/channel_column.dart:329 — group column header (uses groupAvatarColor(conversation.id)). Not a user.

Per the task's guidance, I did not widen UserAvatar's API to force-fit the "own-profile card with upload affordance" cases — they are deliberately bespoke. A future componentization pass could introduce a separate EditableOwnAvatar widget shared between account_section, onboarding_wizard, and header_section (group upload variant), but that is outside the scope of this PR.

Refs #1099.

Test plan

  • flutter analyze --fatal-infos — clean.
  • flutter test test/widgets/chat_panel_test.dart test/widgets/chat_panel/ — 19/19 pass (includes the "empty placeholder renders with no messages" coverage).
  • Visual: open a 1:1 chat with no history and confirm the empty-state circle now shows the peer's avatar image when set (was always a one-letter circle before).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant