arch-atlas

Cart Screen

views/cart_screen.dart · ConsumerStatefulWidget

presentation

Overview

Renders the local cart: list of LocalCartItem rows with qty steppers, a per-row checkbox driven by CartSelectionController, a running total of selected items, and a 'Checkout' button that hands off to CheckoutScreen.

User Flow

  1. Watches cartControllerProvider and cartSelectionProvider for state.
  2. Empty state renders a centered illustration with a 'Continue shopping' CTA.
  3. Qty stepper calls CartController.updateQuantity; tap-to-remove calls removeItem.
  4. Promo code input is local-only here — the actual /store/carts/:id/promotions call happens after the backend cart is created in checkout.
  5. Tapping Checkout pushes the CheckoutScreen, passing only the selected variant IDs (not the full local list).

Cases & Edge Cases

  • PaymentModesData inline list (cash/Paytm/online) is a UI placeholder — the real payment provider list is fetched in CheckoutScreen via fetchPaymentProviders.
  • Screen implements TopBarClickListener for the shared top-bar callbacks — back, search, notification icons.
  • Hot-reload while the cart is empty re-runs fillData and resets paymentModeList — safe because the list is not user-mutated.

Code References

  • lib/src/features/shared/cart/views/cart_screen.dart:18 // CartScreen
  • lib/src/features/shared/cart/views/cart_screen.dart:60 // ref.watch(cartControllerProvider)

API Calls

Empty — fill this in later. Open the manifest and add content here.

Notes

The S.current.cashOnDeliveryLabel-style placeholder rows in fillData are remnants from a previous design where this screen also picked payment methods — keep until the new checkout is fully launched.