Rework quantities the way seeds are actually described — a number of an informal
unit — and let a lot hold seeds or plants (plantel).
Quantity model (commons_core):
- Quantity is now { kind, count?, label } — "3 cobs", "2 packets", "a few".
Count is optional; uncountable vibes (a few, some, pinch) carry no number.
- QuantityKind reorganised into an ascending scale: vibes → containers
(teaspoon/spoon/cup/jar/sack) → seed & fruit forms → plant units, each tagged
countable/not. Stored by name; count reuses the existing numeric column.
Lot type (schema v2):
- Lots gain a `type` (seed | plant); germination stays meaningful for seeds.
schemaVersion 2 with a from1To2 migration (adds the column), drift_schema_v2
exported, migration test covers v1→v2.
UI:
- New QuantityPicker: a horizontal scale of large seed-glyph icons + a number
stepper (shown only for countable units), plus a seed/plant SegmentedButton.
Used in quick-add and add-lot. Lot lines render "3 cobs" / "a few".
- i18n: unit singular/plural (ES/EN, Weblate-friendly), lot-type labels.
Build: slang moved to its CLI (disabled in build_runner to avoid a multi-file
collision); CI runs `dart run slang` before build_runner. 38 tests green,
Linux migrates the existing v1 DB and runs.
31 lines
1 KiB
Dart
31 lines
1 KiB
Dart
// Domain enums stored by **name** (never by index) via Drift `textEnum`, so
|
|
// the stored keys are stable across migrations. Per data-model §5.2, values
|
|
// may only be appended, never renumbered or reused; when sync arrives, readers
|
|
// must tolerate unknown values (map to a safe default). No sync yet in Block 1.
|
|
|
|
/// Whether a lot holds seeds or living plants/seedlings (plantel). Germination
|
|
/// tests apply only to seed lots.
|
|
enum LotType { seed, plant }
|
|
|
|
/// Per-lot visibility (data-model §2.3). Used by the future sharing layer.
|
|
enum OfferStatus { private, shared, exchange, sell }
|
|
|
|
/// Append-only event kinds on a Lot (data-model §2.4).
|
|
enum MovementType {
|
|
received,
|
|
given,
|
|
sown,
|
|
harvested,
|
|
germinationTest,
|
|
split,
|
|
discarded,
|
|
}
|
|
|
|
/// A counterparty is a person or a collective (data-model §2.5).
|
|
enum PartyKind { person, collective }
|
|
|
|
/// Attachment media kind (data-model §2.1).
|
|
enum AttachmentKind { photo, doc }
|
|
|
|
/// Polymorphic parent of an Attachment / ExternalLink.
|
|
enum ParentType { variety, lot, movement }
|