Files
buzz/mobile/lib/features/pairing/add_community_page.dart
klopez4212 e922dc08ff Unify mobile onboarding and community entry screens (#8687)
## Summary

Use consistent fullscreen screens for identity setup, community
selection, joining, and Add Community. Restore all memberships and open
the selected community; share the community grid with the switcher.

Add QR-first choices, animated link entry with 12px keyboard clearance,
a two-finger double-tap pairing toggle, and the centered reversing bee
loader. Preserve cancellation, Back, and reduced-motion behavior.

Add intentionally omits community creation and Builderlab sign-in: this
route follows sign-in and the existing-community picker.

### Related issue

Related: #8628 (native profile setup). No duplicate fullscreen
onboarding PR found.

### Testing

- Full standard and hosted-authentication mobile suites, static
analysis, and required push checks passed.
- iPhone preview iterated with Kenny; final simulator walkthrough below
uses synthetic data and does not authenticate or save account changes.
- Independent review completed; regressions cover cancellation during
loading, Add recovery after failed/conflicting memberships, retrying
skipped communities, and explicit picker stages.

Walkthrough recorded before the copy and recovery followups:


https://github.com/user-attachments/assets/bfea3ad3-1dde-40c4-8748-44c84226c292

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
2026-10-29 16:12:31 +00:00

107 lines
3.4 KiB
Dart

import 'package:flutter/gestures.dart';
import 'community_link_focus.dart';
import '../../shared/widgets/ios_community_link_input.dart';
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import '../../shared/deeplink/community_link_input.dart';
import '../../shared/theme/theme.dart';
import '../../shared/widgets/onboarding_step_page.dart';
part 'add_community_page/add_community_form.dart';
part 'add_community_page/add_community_connection.dart';
part 'add_community_page/pairing_reveal_surface.dart';
/// Fullscreen Add Community presentation; connection operations belong to callers.
class AddCommunityPage extends StatelessWidget {
const AddCommunityPage({
super.key,
required this.onBack,
required this.onCommunityLink,
required this.onPairing,
required this.onScan,
required this.onOpenCommunity,
required this.onSubmitPairing,
this.enteringCommunityLink = false,
this.existingUser = false,
this.scannerProgress = 0,
this.busy = false,
this.canSubmit = true,
this.errorMessage,
this.accountStatus,
this.onInputChanged,
});
final VoidCallback onBack;
final VoidCallback? onCommunityLink;
final VoidCallback? onPairing;
final VoidCallback? onScan;
final ValueChanged<Uri> onOpenCommunity;
final ValueChanged<String> onSubmitPairing;
final bool enteringCommunityLink;
final bool existingUser;
final double scannerProgress;
final bool busy;
final bool canSubmit;
final String? errorMessage;
final String? accountStatus;
final VoidCallback? onInputChanged;
@override
Widget build(BuildContext context) {
final step = enteringCommunityLink
? 'link'
: existingUser
? 'pair'
: 'options';
final page = step == 'options' || step == 'link'
? _AddCommunityConnection(
key: const ValueKey('add-community-connection'),
enteringLink: enteringCommunityLink,
scannerProgress: scannerProgress,
accountStatus: accountStatus,
onBack: onBack,
onCommunityLink: onCommunityLink,
onPairing: onPairing,
onScan: onScan,
onOpenCommunity: onOpenCommunity,
busy: busy,
canSubmit: canSubmit,
errorMessage: errorMessage,
onInputChanged: onInputChanged,
)
: _AddCommunityForm(
key: ValueKey(step),
onBack: onBack,
onSubmitPairing: onSubmitPairing,
busy: busy,
canSubmit: canSubmit,
errorMessage: errorMessage,
onInputChanged: onInputChanged,
);
return AnimatedSwitcher(
duration: MediaQuery.disableAnimationsOf(context)
? Duration.zero
: const Duration(milliseconds: 250),
layoutBuilder: (current, previous) => Stack(
fit: StackFit.expand,
children: [
for (final child in previous)
ExcludeFocus(
child: ExcludeSemantics(child: IgnorePointer(child: child)),
),
?current,
],
),
transitionBuilder: (child, animation) => SlideTransition(
position: Tween(begin: const Offset(1, 0), end: Offset.zero).animate(
CurvedAnimation(parent: animation, curve: Curves.easeOutCubic),
),
child: child,
),
child: page,
);
}
}