mirror of
https://github.com/block/buzz.git
synced 2026-11-02 07:22:55 +00:00
Replace the mobile Agents sheet with a full-page directory of verified owned agents. Add dedicated creation and avatar pages with catalog-backed model selection, reuse the profile emoji/photo/camera controls, and expose Builderbot model settings while labeling desktop agents “Manage on desktop.” Share one account-scoped model catalog across editable cards and retries. Choose Bestie from the agent profile using the shared encrypted main-agent record (text-only action, filled star once selected), and move confirmed deletion to a top-left trash control with native iOS glass. Include uploaded avatars in owner registrations so desktop can display them. Validation: mobile analysis and all 3,958 hosted-enabled app tests passed; default-build tests run by the push hook. Earlier iPhone build installed and iterated with the user; the current iOS build succeeds, but final changes still need a device pass. Independent review found no new blockers. Actual camera capture and live Bestie sync remain unconfirmed; the existing shared `main-agent` wire format and Bestie terminology are retained. ### Snapshots Widget-harness captures with test data (not native iOS chrome). | Agents directory | Image avatar editor | | --- | --- | |  |  | --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
86 lines
2.7 KiB
Dart
86 lines
2.7 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
import '../emoji/emoji_avatar.dart';
|
|
import '../theme/theme.dart';
|
|
|
|
/// Vertical preview shift shared by background editors.
|
|
const avatarBackgroundPreviewShift = 136.0;
|
|
|
|
/// The shared background-color grid used by emoji and animated avatars.
|
|
class AvatarBackgroundGrid extends StatelessWidget {
|
|
/// Creates a fixed grid of avatar background colors.
|
|
const AvatarBackgroundGrid({
|
|
super.key,
|
|
required this.selectedColor,
|
|
required this.onColorSelected,
|
|
this.colorKeyPrefix = 'avatar-background-color',
|
|
});
|
|
|
|
/// The ARGB value of the currently selected background color.
|
|
final int selectedColor;
|
|
|
|
/// Called with the selected ARGB value when the user taps a color.
|
|
final ValueChanged<int> onColorSelected;
|
|
|
|
/// Prefix used for each color option's test key.
|
|
final String colorKeyPrefix;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => GridView.builder(
|
|
shrinkWrap: true,
|
|
primary: false,
|
|
padding: EdgeInsets.zero,
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
crossAxisCount: 6,
|
|
crossAxisSpacing: Grid.xxs,
|
|
mainAxisSpacing: Grid.xs,
|
|
),
|
|
itemCount: emojiAvatarColors.length,
|
|
itemBuilder: (context, index) {
|
|
final color = emojiAvatarColors[index];
|
|
final isSelected = color == selectedColor;
|
|
return Center(
|
|
child: Semantics(
|
|
selected: isSelected,
|
|
label: 'Avatar color ${index + 1}',
|
|
child: InkWell(
|
|
key: ValueKey('$colorKeyPrefix-$index'),
|
|
borderRadius: BorderRadius.circular(Radii.full),
|
|
onTap: () {
|
|
unawaited(HapticFeedback.selectionClick());
|
|
onColorSelected(color);
|
|
},
|
|
child: Container(
|
|
width: 52,
|
|
height: 52,
|
|
padding: const EdgeInsets.all(5),
|
|
decoration: BoxDecoration(
|
|
color: Color(color),
|
|
shape: BoxShape.circle,
|
|
border: Border.all(color: context.colors.outlineVariant),
|
|
),
|
|
child: isSelected
|
|
? DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
border: Border.all(
|
|
color: _selectionColor(Color(color)),
|
|
width: 3,
|
|
),
|
|
),
|
|
)
|
|
: null,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
Color _selectionColor(Color color) =>
|
|
color.computeLuminance() > 0.55 ? const Color(0xFF111111) : Colors.white;
|