mirror of
https://github.com/block/buzz.git
synced 2026-11-24 18:21:59 +00:00
Fixes the welcome bees remaining visible when the QR scanner opens after #8853. Bees now share the foreground’s fade and scale progress, pause while hidden, and return on dismissal. Reduce Motion skips scaling. Validated scanner open/close in the iPhone simulator, normal/reduced-motion widget journeys, analysis, and the full mobile suite. Simulator camera hardware is unavailable; QR decoding was not exercised. Independent review found no blockers. https://github.com/user-attachments/assets/1ce046b2-63e3-4441-90e9-9d9ec048bdfa Signed-off-by: kenny lopez <klopez4212@gmail.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
83 lines
3.1 KiB
Dart
83 lines
3.1 KiB
Dart
part of '../pairing_page.dart';
|
||
|
||
// Colours and bee silhouette from https://buzz.xyz (2026-10-31).
|
||
// The bee layer uses the website’s flight model and remains decorative.
|
||
class _WebsiteWelcomeBackground extends HookWidget {
|
||
final Widget child;
|
||
final ValueListenable<double> scannerProgress;
|
||
|
||
const _WebsiteWelcomeBackground({
|
||
required this.child,
|
||
required this.scannerProgress,
|
||
});
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
final pointer = useRef<Offset?>(null);
|
||
final theme = AppTheme.light();
|
||
return MouseRegion(
|
||
onHover: (event) => pointer.value = event.localPosition,
|
||
onExit: (_) => pointer.value = null,
|
||
child: Listener(
|
||
onPointerDown: (event) => pointer.value = event.localPosition,
|
||
onPointerMove: (event) => pointer.value = event.localPosition,
|
||
onPointerUp: (_) => pointer.value = null,
|
||
onPointerCancel: (_) => pointer.value = null,
|
||
child: DecoratedBox(
|
||
key: const Key('pairing-website-welcome-background'),
|
||
decoration: const BoxDecoration(color: Color(0xFFD7D72E)),
|
||
child: Stack(
|
||
fit: StackFit.expand,
|
||
children: [
|
||
if (MediaQuery.textScalerOf(context).scale(16) <= 24)
|
||
Positioned.fill(
|
||
child: IgnorePointer(
|
||
child: ExcludeSemantics(
|
||
child: ValueListenableBuilder<double>(
|
||
valueListenable: scannerProgress,
|
||
builder: (context, progress, child) => Opacity(
|
||
key: const Key('scanner-bees-opacity'),
|
||
opacity: 1 - progress,
|
||
child: Transform.scale(
|
||
key: const Key('scanner-bees-scale'),
|
||
scale: MediaQuery.disableAnimationsOf(context)
|
||
? 1
|
||
: 1 - 0.04 * progress,
|
||
child: TickerMode(
|
||
enabled: progress < 1,
|
||
child: child!,
|
||
),
|
||
),
|
||
),
|
||
child: LayoutBuilder(
|
||
builder: (context, constraints) => RepaintBoundary(
|
||
child: _WebsiteBeeSwarm(
|
||
size: constraints.biggest,
|
||
pointer: pointer,
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
Theme(
|
||
data: theme.copyWith(
|
||
textButtonTheme: TextButtonThemeData(
|
||
style: theme.textButtonTheme.style?.copyWith(
|
||
backgroundColor: const WidgetStatePropertyAll(
|
||
Color(0xFFD7D72E),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
child: child,
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
}
|