Flutter UI Walkthrough — Cart

By Engineering Team•October 3, 2026•5 min read

What the shopper sees

Each cart line shows the product image, title, selected variant, and price — struck-through MRP beside the selling price with a “You save …” line whenever the item is discounted, the same price-breakdown treatment used on the product-detail and checkout screens. A quantity stepper and a remove action sit on each row, with a wishlist toggle alongside.

Below the cart lines, the screen keeps going into the same recommendation sections the Shop screen shows (Banner, Category, Top Products, New Items, Flash Sale, Most Popular, Just For You) — Cart is never a dead end, even when it’s empty. A sticky bottom bar shows Total Amount (with item count) and Total Savings, plus a Checkout button that’s disabled while the cart has no items.

An empty cart shows “Your cart is empty” in place of the cart lines, with every recommendation section still rendered underneath it.

What the shopper does here

  • Adjusts a line’s quantity via the stepper — applied optimistically (the total/savings update immediately), then confirmed against the backend; a rejection (e.g. past available stock) reverts the quantity and shows an error.
  • Removes a line — same optimistic-then-confirm pattern; removing a line that’s already gone is treated as a no-op, not an error.
  • Taps the wishlist icon on a line to toggle it, same optimistic shape.
  • Taps Checkout to move to the Checkout screen.
  • Scrolls past the cart lines into the same browsing sections available from the Shop screen.

How it’s built

The cart is real and Mongo-backed, not a client-local list. shop-service reads one carts document per (tenant_id, user_id), batch-hydrates every line’s price/stock from inventory-service and descriptive fields from product-catalog in one call each (not once per item), and returns it as the always-first section of the same getShopSections response every other screen reads — an unconditional backend prepend, so cart placement never competes with the tenant’s configured section ordering.

Quantity/remove/wishlist edits are plain REST, not GraphQL — PATCH/DELETE /cart/{product_id}/{sku_id} and a wishlist POST, each re-validated server-side against inventory-service’s live stock before anything is persisted. The quantity stepper itself carries no client-side upper bound (unlike the product-detail screen’s variant-scoped stepper), since this screen’s cart-item data has no availableQuantity field to bound it by — an over-limit tap is caught server-side and surfaces as the same revert-and-snackbar path as any other rejected edit.

Cart is a pushed route, not a bottom-nav tab’s nested content. Tapping the Cart icon pushes this screen onto the root navigator (with its own back button) rather than switching the bottom nav’s selected tab — the tab underneath stays visually selected both while Cart is open and after returning from it.

Cart screen — line items with quantity/remove/wishlist controls, recommendation sections below, and a sticky Total Amount/Total Savings/Checkout bar