Files
buzz/mobile/lib/shared/widgets/avatar_editor_options.dart
klopez4212 cb69ad9e4f Adapt iPhone Duo layouts, rail navigation, and native sheets (#8568)
Duo keeps conversations and Settings details open across closed, book
and flat postures. Book mode splits at the fold; flattening restores the
sidebar. Native rail controls, full-width navigation backdrops and
sheet-local safe areas keep content aligned. Ordinary iPhones remain
single-pane in portrait and landscape; tablet and Duo split layouts
remain enabled.

Includes the recovered preview's matching pane widths, Buzz empty-pane
mark, stable Settings chevrons, Bestie pane routing and Duo-only upward
New menu attachment. Current main's Activity redesign, Search content
fade and unread-navigation button are retained. Menu selection checks
sit beside their labels.

Shared mobile changes remain in scope: the native iOS status editor,
Appearance preview layout, avatar crop preservation, onboarding footer
layout, profile/invite sheet geometry and nested conversation
navigation. This PR is not exclusively Duo-gated. Nested navigator
observers preserve recording cancellation and navigation callbacks; crop
resizing preserves the selected image region. iOS 27.1 APIs remain
compile-time and runtime gated.

Validation on the reconciled source: Flutter analysis, Activity/Home
journeys, the full mobile test suite, file-size checks and Swift package
tests. The iPhone single-pane fix was also exercised on an iPhone 18 Pro
simulator before reconciliation. Fresh hosted CI and physical-device
confirmation of the reconciled build are separate and remain pending.

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Tom Brow <tomb@block.xyz>
Co-authored-by: Tom Brow <tomb@squareup.com>
2026-11-12 19:00:58 +00:00

106 lines
3.4 KiB
Dart

import 'package:duo_kit/duo_kit.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import '../theme/theme.dart';
import 'avatar_editor_options_scope.dart';
import 'duo_toolbar.dart';
import 'ios_navigation_bar.dart';
/// Keeps phone options horizontal and projects Edit Photo options into Duo's rail.
class AvatarEditorOptions extends HookWidget {
const AvatarEditorOptions({
required this.options,
this.centered = true,
this.dividerBefore,
super.key,
});
final List<Widget> options;
final bool centered;
final int? dividerBefore;
@override
Widget build(BuildContext context) {
final scope = AvatarEditorOptionsScope.maybeOf(context);
final toolbar = DuoToolbarScope.maybeOf(context);
final strip = toolbar?.strip ?? FoldGeometry.of(context).strip;
final inRail =
scope != null &&
strip != null &&
defaultTargetPlatform == TargetPlatform.iOS;
final portal = useMemoized(() => OverlayPortalController()..show());
if (!inRail) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (centered) const Spacer(),
for (var i = 0; i < options.length; i++) ...[
if (i > 0) const SizedBox(width: Grid.half),
if (i == dividerBefore) ...[
Container(
width: 1,
height: 64,
color: context.colors.outlineVariant,
),
const SizedBox(width: Grid.half),
],
Expanded(child: options[i]),
],
if (centered) const Spacer(),
],
);
}
final active =
(ModalRoute.of(context)?.isCurrent ?? true) &&
(toolbar?.active ?? true);
final window = MediaQueryData.fromView(View.of(context));
final topClearance =
strip.isClearanceEstimated && window.size.shortestSide >= 600
? duoInnerDisplayEstimatedRailClearance
: strip.topClearance;
return OverlayPortal(
overlayLocation: OverlayChildLocation.rootOverlay,
controller: portal,
overlayChildBuilder: (context) => Positioned(
left:
IosNavigationMetrics.of(
context,
).railCenter(window.size, strip.rect.center.dx) -
strip.width / 2,
width: strip.width,
top: strip.rect.top + topClearance + 120,
bottom: window.viewPadding.bottom + Grid.xxs,
child: Offstage(
offstage: !active,
child: IgnorePointer(
ignoring: !scope.interactive,
child: MediaQuery.removePadding(
context: context,
removeTop: true,
removeBottom: true,
child: Align(
alignment: Alignment.bottomCenter,
child: SingleChildScrollView(
child: Column(
key: const ValueKey('avatar-editor-side-options'),
mainAxisSize: MainAxisSize.min,
children: [
for (var i = 0; i < options.length; i++) ...[
if (i > 0) const SizedBox(height: Grid.xxs),
options[i],
],
],
),
),
),
),
),
),
),
child: const SizedBox.shrink(),
);
}
}