Files
buzz/mobile/lib/features/agents/agent_avatar_editor_page.dart
klopez4212 962b3fdd88 Add avatar color backdrop to mobile agent creation (#9184)
Adds a blurred, saturated backdrop to mobile’s **Choose avatar** screen
that crossfades with the selected avatar or emoji color. Enlarged
artwork keeps the effect abstract; the upper fade leaves the bottom
controls clear. Supports reduced motion and high contrast.

Validated with analysis, the full mobile suite (4,518 passed),
light/dark widget previews, and an iPhone Air install with the existing
account preserved.

### Snapshots

Flutter widget captures:

| | Before | After |
|---|---|---|
| Light | ![Light
before](https://github.com/user-attachments/assets/2293d06f-8744-4949-bb6c-10e3d9975c4b)
| ![Light
after](https://github.com/user-attachments/assets/cfe75783-d2fe-4672-a2bb-c4426ed59b4f)
|
| Dark | ![Dark
before](https://github.com/user-attachments/assets/1b09e33a-1cdd-4054-8def-dd1bac0bc691)
| ![Dark
after](https://github.com/user-attachments/assets/6c903577-5cfd-4a87-9974-cbe8c9aeae60)
|

buzz-review-completed

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
2026-11-06 07:21:28 -08:00

102 lines
3.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import '../../shared/theme/theme.dart';
import '../../shared/widgets/frosted_app_bar.dart';
import '../../shared/widgets/frosted_scaffold.dart';
import 'agent_avatar_choices.dart';
import 'agent_avatar_backdrop.dart';
import 'agent_avatar_geometry.dart';
import 'agent_avatar_picker.dart';
/// Edits an avatar locally; Cancel leaves the creation draft unchanged.
class AgentAvatarEditorPage extends HookWidget {
const AgentAvatarEditorPage({
super.key,
required this.initialSelection,
this.heroTag,
});
final AgentAvatarSelection initialSelection;
final Object? heroTag;
@override
Widget build(BuildContext context) {
final selection = useState(initialSelection);
final busy = useState(false);
void done() => Navigator.of(context).pop(selection.value);
void cancel() => Navigator.of(context).pop();
return PopScope(
canPop: !busy.value,
child: FrostedScaffold(
appBar: FrostedAppBar(
nativeTitle: 'Choose avatar',
title: const Text('Choose avatar'),
automaticallyImplyLeading: false,
nativeLeading: IosNavigationAction(
label: 'Cancel',
symbol: 'xmark',
onPressed: busy.value ? null : cancel,
),
nativeActions: [
IosNavigationAction(
label: 'Done',
symbol: 'checkmark',
onPressed: busy.value ? null : done,
),
],
leading: IconButton(
tooltip: 'Cancel',
onPressed: busy.value ? null : cancel,
icon: const Icon(Icons.close),
),
actions: [
IconButton(
tooltip: 'Done',
onPressed: busy.value ? null : done,
icon: const Icon(Icons.check),
),
],
),
body: Stack(
children: [
Positioned.fill(
child: AgentAvatarBackdrop(selection: selection.value),
),
SafeArea(
top: false,
minimum: const EdgeInsets.only(bottom: Grid.gutter),
child: Padding(
padding: EdgeInsets.fromLTRB(
Grid.gutter,
frostedAppBarHeight(context) + Grid.xxs,
Grid.gutter,
Grid.sm,
),
child: LayoutBuilder(
builder: (context, constraints) => SingleChildScrollView(
clipBehavior: Clip.none,
child: AgentAvatarPicker(
// Fill the available height so the tray shares the page gutters.
controlsHeight:
(constraints.maxHeight -
agentAvatarChoicesHeight(context) -
Grid.sm -
agentAvatarPreviewSpace)
.clamp(180, double.infinity),
selection: selection.value,
heroTag: heroTag,
onChanged: (value) => selection.value = value,
disabled: false,
onBusyChanged: (value) => busy.value = value,
),
),
),
),
),
],
),
),
);
}
}