Checkout Screen
views/checkout_screen.dart
Overview
Wizard-like ConsumerStatefulWidget that consumes checkoutControllerProvider and composes the address, shipping, payment-method, booking-questions and policy widgets into a scrollable column. The 'Pay' button calls confirmStripePayment.
User Flow
- On first build, calls initCheckout with the variantIds passed from CartScreen.
- Renders CheckoutProgressBar at the top reflecting the current step.
- CheckoutAddressSection drives updateShippingAddress on submit.
- CheckoutShippingOptions calls setShippingOption.
- CheckoutPaymentMethods calls setPaymentProvider.
- CheckoutBookingQuestions calls setQuestionAnswer per field.
- Pay button → confirmStripePayment(context, onSuccess) → on success closes to /orders.
Cases & Edge Cases
- CheckoutExitDialog confirms before back-navigation when state.checkoutCartId != null (data loss warning).
- If state.error is non-null, the screen renders an inline banner with retry buttons.
- Re-entry from order history or notifications must NOT reuse stale state — the screen relies on Riverpod auto-disposing the notifier when removed from the tree (which it currently does NOT — see provider note).
Code References
- lib/src/features/shared/checkout/views/checkout_screen.dart
- lib/src/features/shared/checkout/views/widgets/checkout_progress_bar.dart
- lib/src/features/shared/checkout/views/widgets/checkout_exit_dialog.dart
API Calls
Empty — fill this in later. Open the manifest and add content here.
Notes
checkoutControllerProvider is a NotifierProvider (not autoDispose) — state survives screen pops. If you change this, the resume-after-back flow needs to be re-tested end-to-end.