arch-atlas

Create Product Form State

products/providers/create_product_provider.dart · ProductOptionEntry + ProductVariantEntry + CreateProductState

domain

Overview

The dynamic options/variants matrix that powers the create wizard. ProductOptionEntry holds title + values (e.g. Size → S,M,L). ProductVariantEntry holds the cross-product (S/Rouge, S/Bleu, …) with per-variant price/sku/stock.

User Flow

  1. User adds an Option row → ProductOptionEntry.values builds incrementally.
  2. Each new option or value rebuilds the variant matrix (cross-product of all option values).
  3. Per-variant fields (price, sku, stockQuantity) are filled inline in step 2.
  4. isValid getter on ProductOptionEntry gates the Continue button.

Cases & Edge Cases

  • Adding a third option doubles+triples the variant count quickly — UI throttles input + scrolls horizontally.
  • Variant title is composed as 'value1 / value2 / value3' — separator is hard-coded ' / '.
  • Empty values silently drop out of the matrix; an option with 0 valid values forces an isValid=false.

Code References

  • lib/src/features/seller/products/providers/create_product_provider.dart:17 // ProductOptionEntry
  • lib/src/features/seller/products/providers/create_product_provider.dart:42 // ProductVariantEntry
  • lib/src/features/seller/products/providers/create_product_provider.dart:74 // CreateProductState

API Calls

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

Notes

Mirrors the provision-side wizard but kept separate — physical products may have inventory tracking, provisions do not.