Flutter UI Walkthrough — Track Shipment
Where this flow starts
Reached three ways: tapping Track on a card in My Orders, tapping Track Order Status on Order Details, or tapping Track Order Status on Order Confirmation right after a successful checkout. All three land on the same screen, titled Track Shipment.
What the shopper sees
A Delivery Address card, a Shipment Overview card (Shipment ID with a copy icon, Estimated Arrival, Courier Partner), a Shipment Milestones vertical stepper, a Scan Details list of individual courier scan events shown newest-first, and a Back to Order button.
What the shopper does here
- Taps the copy icon next to the Shipment ID to copy it to the clipboard.
- Reads the Shipment Milestones stepper and Scan Details list as shipment updates arrive live.
- Taps Back to Order to return to whichever screen opened this one.
How it’s built
Two data sources feed this screen: one fetch, one live stream. OrderTrackingController.onInit() fires both _loadOrderDetail() (a one-shot GraphQL OrderDetail($orderId) fetch, used only for the delivery address and basic order status) and _watchShipmentTracking() (a Server-Sent-Events subscription via ShipmentTrackingStreamService, wrapping shipment-service’s GET /shipment/api/v1/order/:id/stream) — a different stream from the order-level SSE connection the Razorpay payment flow and Order Confirmation use. The OrderDetail query carries no shipment/courier fields at all, so Shipment ID and Courier Partner start out as literal placeholders (“Pending Assignment” / “Calculating delivery estimate”) until the first shipment-tracking event arrives over SSE.
The milestones stepper is server-driven, not a fixed three-step list. Every SSE event carries its own pre-computed milestones array straight from shipment-service — the app never decides for itself which of Picked/In Transit/Delivered should be marked done, current, or still pending; it just renders whatever list the server sends. Scan Details is a separate field in that same event payload (the full scan history on the first event, a single newly-appended scan on each later push) — the stepper and the scan list come from the same stream, just two independently-shaped fields the server sends side by side, not one derived from the other client-side. Scan Details renders newest-first, matching how the server already orders that field; the stepper renders chronologically.
The copy icon is a plain clipboard copy. Tapping it calls Clipboard.setData with the Shipment ID and shows a confirmation snackbar — only the Shipment ID row is copyable; Estimated Arrival and Courier Partner aren’t.
Back to Order is a plain back-navigation, not a named route. It calls Get.back(), returning to whichever screen pushed this one (My Orders, Order Details, or Order Confirmation) rather than navigating to a fixed destination.
Two known rough edges worth flagging honestly. If the SSE connection drops, the subscription is cancelled and nothing retries it automatically — the screen just stops receiving live updates and sits on its last-known state until the shopper leaves and re-enters. And the initial OrderDetail fetch has no error handling of its own, so a failed fetch has no dedicated error state on this screen today.

Related Documents
- BRD-030 — My Orders, Order Details & Shipment Tracking
- SR-031 — My Orders, Order Details & Shipment Tracking: System Requirements
- ADR-00047 — Order Query and Tracking Channel Strategy for My Orders
- Architecture-00026 — My Orders, Order Details & Track Shipment Component Topology and Data Flow
- Technical Debt — My Orders, Order Details & Track Shipment Gaps — TD-35 (no SSE auto-reconnect), TD-36 (single-instance broker)
- SR-014 — Checkout Completion: Payment Capture & Fulfillment Handoff System Requirements — real-time progress stream (FR-09) this screen builds on
- shipment-service
- order-service
- See also: My Orders, Order Details, Order Confirmation
- Previous: Order Details