arch-atlas

Checkout Screen

views/checkout_screen.dart

presentation

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

  1. On first build, calls initCheckout with the variantIds passed from CartScreen.
  2. Renders CheckoutProgressBar at the top reflecting the current step.
  3. CheckoutAddressSection drives updateShippingAddress on submit.
  4. CheckoutShippingOptions calls setShippingOption.
  5. CheckoutPaymentMethods calls setPaymentProvider.
  6. CheckoutBookingQuestions calls setQuestionAnswer per field.
  7. 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.