mirror of
https://github.com/block/buzz.git
synced 2026-11-14 13:21:02 +00:00
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>
152 lines
4.4 KiB
Dart
152 lines
4.4 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
import 'package:buzz/shared/theme/buzz_icons.dart';
|
|
|
|
import '../../shared/theme/theme.dart';
|
|
import '../../shared/widgets/modal_presentation.dart';
|
|
import '../../shared/widgets/duo_toolbar.dart';
|
|
import '../../shared/widgets/adaptive_conversation_pane.dart';
|
|
|
|
const appearanceModeOptions = <({ThemeMode mode, String label, IconData icon})>[
|
|
(mode: ThemeMode.light, label: 'Light', icon: BuzzIcons.sun),
|
|
(mode: ThemeMode.dark, label: 'Dark', icon: BuzzIcons.moon),
|
|
(mode: ThemeMode.system, label: 'System', icon: BuzzIcons.sunMoon),
|
|
];
|
|
|
|
String appearanceModeLabel(ThemeMode mode) =>
|
|
appearanceModeOptions.firstWhere((option) => option.mode == mode).label;
|
|
|
|
Future<void> showAccentColorPickerSheet({
|
|
required BuildContext context,
|
|
required ColorScheme colorScheme,
|
|
required int selectedIndex,
|
|
required ValueChanged<int> onSelected,
|
|
}) => showBuzzModalBottomSheet<void>(
|
|
context: context,
|
|
title: 'Chat color',
|
|
showDragHandle: true,
|
|
builder: (_) => _AccentColorPicker(
|
|
compact:
|
|
DuoToolbarScope.maybeOf(context)?.strip != null &&
|
|
usesConversationPanes(context),
|
|
colorScheme: colorScheme,
|
|
initialIndex: selectedIndex,
|
|
onSelected: onSelected,
|
|
),
|
|
);
|
|
|
|
class _AccentColorPicker extends HookWidget {
|
|
const _AccentColorPicker({
|
|
required this.colorScheme,
|
|
required this.compact,
|
|
required this.initialIndex,
|
|
required this.onSelected,
|
|
});
|
|
|
|
final ColorScheme colorScheme;
|
|
final bool compact;
|
|
final int initialIndex;
|
|
final ValueChanged<int> onSelected;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final selected = useState(initialIndex);
|
|
return SafeArea(
|
|
top: false,
|
|
child: Padding(
|
|
padding: const EdgeInsets.fromLTRB(
|
|
Grid.gutter,
|
|
Grid.xxs,
|
|
Grid.gutter,
|
|
Grid.xs,
|
|
),
|
|
child: Align(
|
|
heightFactor: 1,
|
|
child: ConstrainedBox(
|
|
constraints: BoxConstraints(
|
|
maxWidth: compact ? 320 : double.infinity,
|
|
),
|
|
child: GridView.builder(
|
|
key: const ValueKey('accent-selection-grid'),
|
|
shrinkWrap: true,
|
|
primary: false,
|
|
padding: EdgeInsets.zero,
|
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
crossAxisCount: 4,
|
|
crossAxisSpacing: Grid.xxs,
|
|
mainAxisSpacing: Grid.xs,
|
|
),
|
|
itemCount: chatColorChoices.length,
|
|
itemBuilder: (context, index) => _AccentSheetOption(
|
|
index: index,
|
|
color: chatColorForScheme(colorScheme, index),
|
|
selected: selected.value == index,
|
|
onTap: () {
|
|
unawaited(HapticFeedback.selectionClick());
|
|
selected.value = index;
|
|
onSelected(index);
|
|
},
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _AccentSheetOption extends StatelessWidget {
|
|
const _AccentSheetOption({
|
|
required this.index,
|
|
required this.color,
|
|
required this.selected,
|
|
required this.onTap,
|
|
});
|
|
|
|
final int index;
|
|
final Color color;
|
|
final bool selected;
|
|
final VoidCallback onTap;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Semantics(
|
|
label: '${chatColorChoices[index].name} chat color',
|
|
button: true,
|
|
selected: selected,
|
|
child: InkResponse(
|
|
key: ValueKey('accent-option-$index'),
|
|
onTap: onTap,
|
|
radius: 36,
|
|
child: Center(
|
|
child: Container(
|
|
key: ValueKey('accent-swatch-$index'),
|
|
width: 64,
|
|
height: 64,
|
|
padding: const EdgeInsets.all(5),
|
|
decoration: BoxDecoration(
|
|
color: color,
|
|
shape: BoxShape.circle,
|
|
border: Border.all(color: context.colors.outlineVariant),
|
|
),
|
|
child: selected
|
|
? DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
border: Border.all(
|
|
color: color.computeLuminance() > 0.55
|
|
? const Color(0xFF111111)
|
|
: Colors.white,
|
|
width: 3,
|
|
),
|
|
),
|
|
)
|
|
: null,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|