feat(inventory): informal quantity scale (number + unit) + seed/plant lots

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.
This commit is contained in:
vjrj 2026-07-08 10:51:02 +02:00
parent 48e9d15772
commit 3942975dba
26 changed files with 4220 additions and 315 deletions

View file

@ -48,7 +48,8 @@ class Translations with BaseTranslations<AppLocale, Translations> {
late final Translations$germination$en germination = Translations$germination$en.internal(_root);
late final Translations$editVariety$en editVariety = Translations$editVariety$en.internal(_root);
late final Translations$addLot$en addLot = Translations$addLot$en.internal(_root);
late final Translations$quantityKind$en quantityKind = Translations$quantityKind$en.internal(_root);
late final Translations$lotType$en lotType = Translations$lotType$en.internal(_root);
late final Translations$unit$en unit = Translations$unit$en.internal(_root);
}
// Path: app
@ -82,6 +83,9 @@ class Translations$common$en {
/// en: 'Edit'
String get edit => 'Edit';
/// en: 'Type'
String get type => 'Type';
}
// Path: inventory
@ -242,13 +246,31 @@ class Translations$addLot$en {
/// en: 'Harvest year'
String get year => 'Harvest year';
/// en: 'Quantity'
String get quantity => 'Quantity';
/// en: 'How much?'
String get quantity => 'How much?';
/// en: 'Amount'
String get amount => 'Amount';
}
// Path: quantityKind
class Translations$quantityKind$en {
Translations$quantityKind$en.internal(this._root);
// Path: lotType
class Translations$lotType$en {
Translations$lotType$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'Seeds'
String get seed => 'Seeds';
/// en: 'Plants'
String get plant => 'Plants';
}
// Path: unit
class Translations$unit$en {
Translations$unit$en.internal(this._root);
final Translations _root; // ignore: unused_field
@ -263,50 +285,345 @@ class Translations$quantityKind$en {
/// en: 'plenty'
String get plenty => 'plenty';
/// en: 'a handful'
String get handful => 'a handful';
/// en: 'a pinch'
String get pinch => 'a pinch';
/// en: 'a jar'
String get jar => 'a jar';
late final Translations$unit$handful$en handful = Translations$unit$handful$en.internal(_root);
late final Translations$unit$teaspoon$en teaspoon = Translations$unit$teaspoon$en.internal(_root);
late final Translations$unit$spoon$en spoon = Translations$unit$spoon$en.internal(_root);
late final Translations$unit$cup$en cup = Translations$unit$cup$en.internal(_root);
late final Translations$unit$jar$en jar = Translations$unit$jar$en.internal(_root);
late final Translations$unit$sack$en sack = Translations$unit$sack$en.internal(_root);
late final Translations$unit$packet$en packet = Translations$unit$packet$en.internal(_root);
late final Translations$unit$cob$en cob = Translations$unit$cob$en.internal(_root);
late final Translations$unit$pod$en pod = Translations$unit$pod$en.internal(_root);
late final Translations$unit$ear$en ear = Translations$unit$ear$en.internal(_root);
late final Translations$unit$head$en head = Translations$unit$head$en.internal(_root);
late final Translations$unit$fruit$en fruit = Translations$unit$fruit$en.internal(_root);
late final Translations$unit$bulb$en bulb = Translations$unit$bulb$en.internal(_root);
late final Translations$unit$tuber$en tuber = Translations$unit$tuber$en.internal(_root);
late final Translations$unit$seedHead$en seedHead = Translations$unit$seedHead$en.internal(_root);
late final Translations$unit$bunch$en bunch = Translations$unit$bunch$en.internal(_root);
late final Translations$unit$plant$en plant = Translations$unit$plant$en.internal(_root);
late final Translations$unit$pot$en pot = Translations$unit$pot$en.internal(_root);
late final Translations$unit$tray$en tray = Translations$unit$tray$en.internal(_root);
late final Translations$unit$grams$en grams = Translations$unit$grams$en.internal(_root);
late final Translations$unit$count$en count = Translations$unit$count$en.internal(_root);
}
/// en: 'a packet'
String get packet => 'a packet';
// Path: unit.handful
class Translations$unit$handful$en {
Translations$unit$handful$en.internal(this._root);
/// en: 'a cob'
String get cob => 'a cob';
final Translations _root; // ignore: unused_field
/// en: 'a head'
String get head => 'a head';
// Translations
/// en: 'a pod'
String get pod => 'a pod';
/// en: 'handful'
String get singular => 'handful';
/// en: 'an ear'
String get ear => 'an ear';
/// en: 'handfuls'
String get plural => 'handfuls';
}
/// en: 'a fruit'
String get fruit => 'a fruit';
// Path: unit.teaspoon
class Translations$unit$teaspoon$en {
Translations$unit$teaspoon$en.internal(this._root);
/// en: 'a bulb'
String get bulb => 'a bulb';
final Translations _root; // ignore: unused_field
/// en: 'a tuber'
String get tuber => 'a tuber';
// Translations
/// en: 'a seed head'
String get seedHead => 'a seed head';
/// en: 'teaspoon'
String get singular => 'teaspoon';
/// en: 'a bunch'
String get bunch => 'a bunch';
/// en: 'teaspoons'
String get plural => 'teaspoons';
}
// Path: unit.spoon
class Translations$unit$spoon$en {
Translations$unit$spoon$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'spoon'
String get singular => 'spoon';
/// en: 'spoons'
String get plural => 'spoons';
}
// Path: unit.cup
class Translations$unit$cup$en {
Translations$unit$cup$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'cup'
String get singular => 'cup';
/// en: 'cups'
String get plural => 'cups';
}
// Path: unit.jar
class Translations$unit$jar$en {
Translations$unit$jar$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'jar'
String get singular => 'jar';
/// en: 'jars'
String get plural => 'jars';
}
// Path: unit.sack
class Translations$unit$sack$en {
Translations$unit$sack$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'sack'
String get singular => 'sack';
/// en: 'sacks'
String get plural => 'sacks';
}
// Path: unit.packet
class Translations$unit$packet$en {
Translations$unit$packet$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'packet'
String get singular => 'packet';
/// en: 'packets'
String get plural => 'packets';
}
// Path: unit.cob
class Translations$unit$cob$en {
Translations$unit$cob$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'cob'
String get singular => 'cob';
/// en: 'cobs'
String get plural => 'cobs';
}
// Path: unit.pod
class Translations$unit$pod$en {
Translations$unit$pod$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'pod'
String get singular => 'pod';
/// en: 'pods'
String get plural => 'pods';
}
// Path: unit.ear
class Translations$unit$ear$en {
Translations$unit$ear$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'ear'
String get singular => 'ear';
/// en: 'ears'
String get plural => 'ears';
}
// Path: unit.head
class Translations$unit$head$en {
Translations$unit$head$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'head'
String get singular => 'head';
/// en: 'heads'
String get plural => 'heads';
}
// Path: unit.fruit
class Translations$unit$fruit$en {
Translations$unit$fruit$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'fruit'
String get singular => 'fruit';
/// en: 'fruits'
String get plural => 'fruits';
}
// Path: unit.bulb
class Translations$unit$bulb$en {
Translations$unit$bulb$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'bulb'
String get singular => 'bulb';
/// en: 'bulbs'
String get plural => 'bulbs';
}
// Path: unit.tuber
class Translations$unit$tuber$en {
Translations$unit$tuber$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'tuber'
String get singular => 'tuber';
/// en: 'tubers'
String get plural => 'tubers';
}
// Path: unit.seedHead
class Translations$unit$seedHead$en {
Translations$unit$seedHead$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'seed head'
String get singular => 'seed head';
/// en: 'seed heads'
String get plural => 'seed heads';
}
// Path: unit.bunch
class Translations$unit$bunch$en {
Translations$unit$bunch$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'bunch'
String get singular => 'bunch';
/// en: 'bunches'
String get plural => 'bunches';
}
// Path: unit.plant
class Translations$unit$plant$en {
Translations$unit$plant$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'plant'
String get singular => 'plant';
/// en: 'plants'
String get plural => 'plants';
}
// Path: unit.pot
class Translations$unit$pot$en {
Translations$unit$pot$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'pot'
String get singular => 'pot';
/// en: 'pots'
String get plural => 'pots';
}
// Path: unit.tray
class Translations$unit$tray$en {
Translations$unit$tray$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'tray'
String get singular => 'tray';
/// en: 'trays'
String get plural => 'trays';
}
// Path: unit.grams
class Translations$unit$grams$en {
Translations$unit$grams$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'gram'
String get singular => 'gram';
/// en: 'grams'
String get grams => 'grams';
String get plural => 'grams';
}
/// en: 'count'
String get count => 'count';
// Path: unit.count
class Translations$unit$count$en {
Translations$unit$count$en.internal(this._root);
final Translations _root; // ignore: unused_field
// Translations
/// en: 'seed'
String get singular => 'seed';
/// en: 'seeds'
String get plural => 'seeds';
}
/// The flat map containing all translations for locale <en>.
@ -322,6 +639,7 @@ extension on Translations {
'common.cancel' => 'Cancel',
'common.delete' => 'Delete',
'common.edit' => 'Edit',
'common.type' => 'Type',
'inventory.title' => 'Inventory',
'inventory.searchHint' => 'Search seeds',
'inventory.empty' => 'No seeds yet. Tap + to add your first.',
@ -357,25 +675,56 @@ extension on Translations {
'editVariety.speciesHint' => 'Search a species…',
'addLot.title' => 'Add lot',
'addLot.year' => 'Harvest year',
'addLot.quantity' => 'Quantity',
'quantityKind.aFew' => 'a few',
'quantityKind.some' => 'some',
'quantityKind.plenty' => 'plenty',
'quantityKind.handful' => 'a handful',
'quantityKind.pinch' => 'a pinch',
'quantityKind.jar' => 'a jar',
'quantityKind.packet' => 'a packet',
'quantityKind.cob' => 'a cob',
'quantityKind.head' => 'a head',
'quantityKind.pod' => 'a pod',
'quantityKind.ear' => 'an ear',
'quantityKind.fruit' => 'a fruit',
'quantityKind.bulb' => 'a bulb',
'quantityKind.tuber' => 'a tuber',
'quantityKind.seedHead' => 'a seed head',
'quantityKind.bunch' => 'a bunch',
'quantityKind.grams' => 'grams',
'quantityKind.count' => 'count',
'addLot.quantity' => 'How much?',
'addLot.amount' => 'Amount',
'lotType.seed' => 'Seeds',
'lotType.plant' => 'Plants',
'unit.aFew' => 'a few',
'unit.some' => 'some',
'unit.plenty' => 'plenty',
'unit.pinch' => 'a pinch',
'unit.handful.singular' => 'handful',
'unit.handful.plural' => 'handfuls',
'unit.teaspoon.singular' => 'teaspoon',
'unit.teaspoon.plural' => 'teaspoons',
'unit.spoon.singular' => 'spoon',
'unit.spoon.plural' => 'spoons',
'unit.cup.singular' => 'cup',
'unit.cup.plural' => 'cups',
'unit.jar.singular' => 'jar',
'unit.jar.plural' => 'jars',
'unit.sack.singular' => 'sack',
'unit.sack.plural' => 'sacks',
'unit.packet.singular' => 'packet',
'unit.packet.plural' => 'packets',
'unit.cob.singular' => 'cob',
'unit.cob.plural' => 'cobs',
'unit.pod.singular' => 'pod',
'unit.pod.plural' => 'pods',
'unit.ear.singular' => 'ear',
'unit.ear.plural' => 'ears',
'unit.head.singular' => 'head',
'unit.head.plural' => 'heads',
'unit.fruit.singular' => 'fruit',
'unit.fruit.plural' => 'fruits',
'unit.bulb.singular' => 'bulb',
'unit.bulb.plural' => 'bulbs',
'unit.tuber.singular' => 'tuber',
'unit.tuber.plural' => 'tubers',
'unit.seedHead.singular' => 'seed head',
'unit.seedHead.plural' => 'seed heads',
'unit.bunch.singular' => 'bunch',
'unit.bunch.plural' => 'bunches',
'unit.plant.singular' => 'plant',
'unit.plant.plural' => 'plants',
'unit.pot.singular' => 'pot',
'unit.pot.plural' => 'pots',
'unit.tray.singular' => 'tray',
'unit.tray.plural' => 'trays',
'unit.grams.singular' => 'gram',
'unit.grams.plural' => 'grams',
'unit.count.singular' => 'seed',
'unit.count.plural' => 'seeds',
_ => null,
};
}