Files
buzz/mobile/lib/features/channels/small_avatar.dart
Arjun Mahanti bc006f6708 feat: render agent avatars as squircles (#7106)
## Summary

- render every agent/AI identity as a 30% squircle across desktop and
mobile while keeping human avatars circular
- propagate agent identity through message, thread, profile, reaction,
member, DM, search, workflow, project, huddle, forum, pulse, and
agent-management surfaces
- preserve squircle geometry for fallbacks, focus/status treatments,
add-agent controls, and overlapping avatar outlines (`calc(30% + 2px)`
for the outer background)

### Related issue

None found. This change was requested and visually reviewed in the
originating Buzz thread.

### Testing

- `just desktop-test` — 5,799 passed
- `just mobile-test` — 2,008 passed
- pre-push gates passed at `0d59d77b120dcb90aac2f918e422c11c9fa5353b`:
desktop check, TypeScript typecheck, desktop full test suite, mobile
format/analyze and full test suite, Rust tests, Tauri checks, and
differential file-size gate
- deterministic desktop visual sweep covered channel messages/thread
summaries; thread, subthread, and sub-subthread depths; reactions and
reactor popovers; hover/full profiles; added-to-channel activity;
channel members/settings; agent library/team overlaps; agent creation;
mention autocomplete; and DM header/sidebar/settings

### UI evidence

The complete labeled visual matrix is available in the originating Buzz
review thread. GitHub-hosted copies will be added in a follow-up PR
comment using the repository screenshot script.

---------

Signed-off-by: Fizz <dae5f6af70b8695a8b83c8deae555f63be41630ec2b8cd493e41a439c9527dd8@buzz.block.builderlab.xyz>
Co-authored-by: Fizz <dae5f6af70b8695a8b83c8deae555f63be41630ec2b8cd493e41a439c9527dd8@buzz.block.builderlab.xyz>
2026-08-31 13:31:33 -04:00

53 lines
1.5 KiB
Dart

import 'package:flutter/material.dart';
import '../../shared/theme/theme.dart';
import '../../shared/widgets/avatar_image.dart';
import '../../shared/profile/user_profile.dart';
/// 20px avatar used in thread summary rows and other compact lists.
class SmallAvatar extends StatelessWidget {
final String pubkey;
final Map<String, UserProfile> userCache;
final double size;
const SmallAvatar({
super.key,
required this.pubkey,
required this.userCache,
this.size = 20,
});
@override
Widget build(BuildContext context) {
final profile = userCache[pubkey.toLowerCase()];
final avatarUrl = profile?.avatarUrl;
final initial =
profile?.initial ?? (pubkey.isNotEmpty ? pubkey[0].toUpperCase() : '?');
final isAgent = profile?.ownerPubkey != null;
return Container(
width: size,
height: size,
decoration: BoxDecoration(
shape: isAgent ? BoxShape.rectangle : BoxShape.circle,
borderRadius: isAgent ? BorderRadius.circular(size * 0.3) : null,
border: Border.all(color: context.colors.surface, width: 1.5),
),
child: AvatarImage(
imageUrl: avatarUrl,
radius: (size - 2) / 2,
backgroundColor: context.colors.primaryContainer,
fallback: Text(
initial,
style: TextStyle(
fontSize: size * 0.4,
fontWeight: FontWeight.w600,
color: context.colors.onPrimaryContainer,
),
),
isAgent: isAgent,
),
);
}
}