Stages 5.1, 5.3, 5.4 of the returning-user flow rework. All three §4 entry paths now require payment BEFORE pairing, matching the updated mermaid spec. * Spec (requirement/flow_customer.mermaid.md §4): payment block converges three call-sites (bestie-yang-udah-kenal-online, bestie-baru, offline-popup → cari bestie lain). PairRoute dispatches lama → targeted pair, baru/cari-lain → §3 blast. §3 retains its post-payment-shared contract. * Stage 5.1 (client_app): PaymentDraft carries targetedMitraId + topicSensitivity. bestie_history_list seeds the draft + pushes /payment/entry (was legacy /payment). searching_screen branches on draft.targetedMitraId for blast-vs-targeted dispatch. payment_entry uses resetExceptTarget(); bestie_choice_sheet + home _onCurhatBestieBaruPressed call explicit reset() before push so the keepAlive draft can't leak stale targeting into a blast. * Stage 5.3 (client_app): new BestieOfflineVariant.prePayReturning. Bestie-history-list _BestieRow splits tappable from dim so offline rows render dimmed but route taps into the popup. CTA "cari bestie lain" resets the draft + pushes /payment/entry. * Stage 5.4 (client_app): deleted legacy /payment route, payment_screen.dart, payment_notifier.dart(+.g.dart). router cleaned. * Tests (requirement/phase4-customer-flow.md + client_app/.maestro/): six Maestro flows TS-01..TS-06 covering every §4 branching point, all passing end-to-end. Shared onboarding prelude under .maestro/subflows/. New helper scripts: accept_latest_pending, force_mitra_offline, force_other_mitra_online, reset_all_mitras_online, mitra_accept_latest_internal. New backend _test endpoints to match. /reset-phone now cascade-deletes customer_transactions (FK was blocking). /force-pairing-timeout branches targeted (RETURNING_CHAT_TIMEOUT via expireTargetedPairingRequest, now exported) vs blast (PAIRING_FAILED). seed_history_session also outputs MITRA_NAME_RE (regex-escaped) for reliable selectors against display names containing regex specials. * mitra_app: dispose-during-deactivate guardrail for back-press on the mitra chat screen after the customer's goodbye message. Pending real emulator repro verification (carried over from 2026-05-15). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
146 lines
4.6 KiB
Dart
146 lines
4.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import '../../../core/theme/halo_tokens.dart';
|
|
import '../../../core/theme/widgets/widgets.dart';
|
|
import '../../payment/state/payment_draft_provider.dart';
|
|
|
|
/// Phase 4 Stage 8 — Bestie Choice Sheet.
|
|
///
|
|
/// Triggered from the home `Mulai Curhat` CTA when the user has at least one
|
|
/// prior session. Two cards: continue with a known bestie (→ history list)
|
|
/// vs. find a new bestie (→ soft-prompt + blast).
|
|
class BestieChoiceSheet extends ConsumerWidget {
|
|
const BestieChoiceSheet({super.key});
|
|
|
|
static Future<void> show(BuildContext context) {
|
|
return HaloBottomSheet.show<void>(
|
|
context,
|
|
child: const BestieChoiceSheet(),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
return Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
const Text(
|
|
'mau curhat sama siapa?',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontFamily: HaloTokens.fontDisplay,
|
|
fontSize: 22,
|
|
fontWeight: FontWeight.w700,
|
|
color: HaloTokens.ink,
|
|
),
|
|
),
|
|
const SizedBox(height: HaloSpacing.s8),
|
|
const Text(
|
|
'pilih lanjut sama bestie yang udah kenal, atau coba bestie baru.',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontFamily: HaloTokens.fontBody,
|
|
fontSize: 14,
|
|
color: HaloTokens.inkSoft,
|
|
),
|
|
),
|
|
const SizedBox(height: HaloSpacing.s24),
|
|
_ChoiceCard(
|
|
title: 'bestie yang udah kenal',
|
|
subtitle: 'lanjut cerita ke bestie yang pernah dengerin kamu.',
|
|
icon: Icons.favorite_outline,
|
|
onTap: () {
|
|
Navigator.of(context).pop();
|
|
context.push('/bestie/history');
|
|
},
|
|
),
|
|
const SizedBox(height: HaloSpacing.s12),
|
|
_ChoiceCard(
|
|
title: 'bestie baru',
|
|
subtitle: 'cari bestie baru yang siap dengerin sekarang.',
|
|
icon: Icons.auto_awesome_outlined,
|
|
onTap: () {
|
|
// explicit reset — this branch is blast-only, clear any stale targeted mitra
|
|
ref.read(paymentDraftNotifierProvider.notifier).reset();
|
|
Navigator.of(context).pop();
|
|
context.push('/payment/entry');
|
|
},
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
class _ChoiceCard extends StatelessWidget {
|
|
final String title;
|
|
final String subtitle;
|
|
final IconData icon;
|
|
final VoidCallback onTap;
|
|
|
|
const _ChoiceCard({
|
|
required this.title,
|
|
required this.subtitle,
|
|
required this.icon,
|
|
required this.onTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Material(
|
|
color: HaloTokens.brandSofter,
|
|
borderRadius: HaloRadius.lg,
|
|
child: InkWell(
|
|
onTap: onTap,
|
|
borderRadius: HaloRadius.lg,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(HaloSpacing.s16),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
width: 48,
|
|
height: 48,
|
|
decoration: const BoxDecoration(
|
|
color: HaloTokens.brandSoft,
|
|
shape: BoxShape.circle,
|
|
),
|
|
alignment: Alignment.center,
|
|
child: Icon(icon, color: HaloTokens.brandDark, size: 24),
|
|
),
|
|
const SizedBox(width: HaloSpacing.s12),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
title,
|
|
style: const TextStyle(
|
|
fontFamily: HaloTokens.fontDisplay,
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w700,
|
|
color: HaloTokens.ink,
|
|
),
|
|
),
|
|
const SizedBox(height: 2),
|
|
Text(
|
|
subtitle,
|
|
style: const TextStyle(
|
|
fontFamily: HaloTokens.fontBody,
|
|
fontSize: 13,
|
|
height: 18 / 13,
|
|
color: HaloTokens.inkSoft,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const Icon(Icons.chevron_right, color: HaloTokens.brandDark),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|