mirror of
https://github.com/block/buzz.git
synced 2026-11-16 06:11:34 +00:00
Replace the signed-in mobile welcome screen with **Add a community**: QR scan first, then grey secondary actions for community links, finding saved communities, and creation. Hide **Find my communities** when none are known; refresh on entry/resume and every 30 seconds while active, retaining results on transient failure. Community switcher → Add keeps its two-action flow and uses the same grey secondary link button. Validation: Flutter analysis, full mobile suite (4,014 tests), Builderlab-enabled full suite (4,036 tests), widget interactions, and independent agent review. Draft pending native sign-in and human testing. Snapshots render the production Flutter widgets; native navigation/status bars are omitted. | Communities available | No communities | Switcher → Add | |---|---|---| |  |  |  | --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
110 lines
3.4 KiB
Dart
110 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 '../../shared/widgets/onboarding_route.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.onboarding = false,
|
|
this.onFindCommunities,
|
|
this.onCreateCommunity,
|
|
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 onboarding;
|
|
final VoidCallback? onFindCommunities;
|
|
final VoidCallback? onCreateCommunity;
|
|
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,
|
|
onboarding: onboarding,
|
|
onFindCommunities: onFindCommunities,
|
|
onCreateCommunity: onCreateCommunity,
|
|
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 PopScope(
|
|
canPop: false,
|
|
onPopInvokedWithResult: (didPop, _) {
|
|
if (!didPop) onBack();
|
|
},
|
|
child: Navigator(
|
|
onDidRemovePage: (_) {},
|
|
pages: [
|
|
OnboardingPage<void>(
|
|
key: ValueKey(step == 'pair' ? 'pair' : 'connection'),
|
|
child: page,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|