mirror of
https://github.com/block/buzz.git
synced 2026-11-25 18:52:52 +00:00
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 |  |  | | Dark |  |  | buzz-review-completed Signed-off-by: kenny lopez <klopez4212@gmail.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
102 lines
3.4 KiB
Dart
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,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|