Flutter UI Walkthrough — Addresses

By Engineering Team•October 10, 2026•4 min read

What the shopper sees

A routed screen titled “Addresses” with an add button in the header. Each saved address renders as a card showing name, full address lines, phone, and tappable “Default Shipping”/“Default Billing” chips. An empty state appears when no address is saved yet.

What the shopper does here

  • Taps the header’s add button to open the address form sheet for a new address.
  • Taps an existing card to edit it in the same form sheet, prefilled.
  • Taps a “Default Shipping”/“Default Billing” chip to make that address the default for that purpose.
  • Swipes or taps delete on a card to remove that address.

How it’s built

AddressFormSheet(initial, onSave) is shared for both Add and Edit — Add passes no initial, Edit passes the tapped address. The form collects firstName/lastName/line1/line2/street/landmark/city/state/pincode/country/tag/phoneNumber; country defaults to 'India' for a new address. Client-side AddressValidator requires firstName/lastName/line1/city/state/country and validates phoneNumber and pincode (India-only 6-digit, first digit 1-9) — stricter than the backend, which validates only line1/city/firstName/lastName/phoneNumber and does not format-check the pincode at all (see TD-00020, TD-05).

AddressController reloads the full address list after addAddress/setDefaultShipping/setDefaultBilling, since any of those three can flip another address’s default flag on the server side — a partial local patch would drift from the real state. updateAddress and deleteAddress, by contrast, mutate the in-memory list directly: deleteAddress is optimistic with revert-on-failure, since removing one address never changes another’s flags.

The address body itself is never stored by user-preference-service directly — every field is pushed to pii-service as an encrypted attribute under entity_type="user_address", and hydrated back on every read. An address saved before firstName/lastName/phoneNumber were added to the stored shape resolves those fields to empty until re-saved — see TD-00020, TD-06.

This screen’s own Binding re-registers Get.lazyPut<ISettingRepository>(() => SettingRepository()) — a deliberate no-op once SettingBinding has already registered that type, ensuring Address shares the same in-memory repository instance as the landing screen and every other Settings sub-screen.

Addresses list, showing default shipping/billing chips

Address add/edit form sheet