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:
parent
48e9d15772
commit
3942975dba
26 changed files with 4220 additions and 315 deletions
|
|
@ -47,7 +47,8 @@ class TranslationsEs extends Translations with BaseTranslations<AppLocale, Trans
|
|||
@override late final _Translations$germination$es germination = _Translations$germination$es._(_root);
|
||||
@override late final _Translations$editVariety$es editVariety = _Translations$editVariety$es._(_root);
|
||||
@override late final _Translations$addLot$es addLot = _Translations$addLot$es._(_root);
|
||||
@override late final _Translations$quantityKind$es quantityKind = _Translations$quantityKind$es._(_root);
|
||||
@override late final _Translations$lotType$es lotType = _Translations$lotType$es._(_root);
|
||||
@override late final _Translations$unit$es unit = _Translations$unit$es._(_root);
|
||||
}
|
||||
|
||||
// Path: app
|
||||
|
|
@ -71,6 +72,7 @@ class _Translations$common$es extends Translations$common$en {
|
|||
@override String get cancel => 'Cancelar';
|
||||
@override String get delete => 'Eliminar';
|
||||
@override String get edit => 'Editar';
|
||||
@override String get type => 'Tipo';
|
||||
}
|
||||
|
||||
// Path: inventory
|
||||
|
|
@ -160,12 +162,24 @@ class _Translations$addLot$es extends Translations$addLot$en {
|
|||
// Translations
|
||||
@override String get title => 'Añadir lote';
|
||||
@override String get year => 'Año de cosecha';
|
||||
@override String get quantity => 'Cantidad';
|
||||
@override String get quantity => '¿Cuánta?';
|
||||
@override String get amount => 'Cantidad';
|
||||
}
|
||||
|
||||
// Path: quantityKind
|
||||
class _Translations$quantityKind$es extends Translations$quantityKind$en {
|
||||
_Translations$quantityKind$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
// Path: lotType
|
||||
class _Translations$lotType$es extends Translations$lotType$en {
|
||||
_Translations$lotType$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get seed => 'Semillas';
|
||||
@override String get plant => 'Plantel';
|
||||
}
|
||||
|
||||
// Path: unit
|
||||
class _Translations$unit$es extends Translations$unit$en {
|
||||
_Translations$unit$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
|
|
@ -173,21 +187,259 @@ class _Translations$quantityKind$es extends Translations$quantityKind$en {
|
|||
@override String get aFew => 'unas pocas';
|
||||
@override String get some => 'algunas';
|
||||
@override String get plenty => 'muchas';
|
||||
@override String get handful => 'un puñado';
|
||||
@override String get pinch => 'una pizca';
|
||||
@override String get jar => 'un tarro';
|
||||
@override String get packet => 'un sobre';
|
||||
@override String get cob => 'una mazorca';
|
||||
@override String get head => 'una cabezuela';
|
||||
@override String get pod => 'una vaina';
|
||||
@override String get ear => 'una espiga';
|
||||
@override String get fruit => 'un fruto';
|
||||
@override String get bulb => 'un bulbo';
|
||||
@override String get tuber => 'un tubérculo';
|
||||
@override String get seedHead => 'una cabeza de semillas';
|
||||
@override String get bunch => 'un manojo';
|
||||
@override String get grams => 'gramos';
|
||||
@override String get count => 'unidades';
|
||||
@override late final _Translations$unit$handful$es handful = _Translations$unit$handful$es._(_root);
|
||||
@override late final _Translations$unit$teaspoon$es teaspoon = _Translations$unit$teaspoon$es._(_root);
|
||||
@override late final _Translations$unit$spoon$es spoon = _Translations$unit$spoon$es._(_root);
|
||||
@override late final _Translations$unit$cup$es cup = _Translations$unit$cup$es._(_root);
|
||||
@override late final _Translations$unit$jar$es jar = _Translations$unit$jar$es._(_root);
|
||||
@override late final _Translations$unit$sack$es sack = _Translations$unit$sack$es._(_root);
|
||||
@override late final _Translations$unit$packet$es packet = _Translations$unit$packet$es._(_root);
|
||||
@override late final _Translations$unit$cob$es cob = _Translations$unit$cob$es._(_root);
|
||||
@override late final _Translations$unit$pod$es pod = _Translations$unit$pod$es._(_root);
|
||||
@override late final _Translations$unit$ear$es ear = _Translations$unit$ear$es._(_root);
|
||||
@override late final _Translations$unit$head$es head = _Translations$unit$head$es._(_root);
|
||||
@override late final _Translations$unit$fruit$es fruit = _Translations$unit$fruit$es._(_root);
|
||||
@override late final _Translations$unit$bulb$es bulb = _Translations$unit$bulb$es._(_root);
|
||||
@override late final _Translations$unit$tuber$es tuber = _Translations$unit$tuber$es._(_root);
|
||||
@override late final _Translations$unit$seedHead$es seedHead = _Translations$unit$seedHead$es._(_root);
|
||||
@override late final _Translations$unit$bunch$es bunch = _Translations$unit$bunch$es._(_root);
|
||||
@override late final _Translations$unit$plant$es plant = _Translations$unit$plant$es._(_root);
|
||||
@override late final _Translations$unit$pot$es pot = _Translations$unit$pot$es._(_root);
|
||||
@override late final _Translations$unit$tray$es tray = _Translations$unit$tray$es._(_root);
|
||||
@override late final _Translations$unit$grams$es grams = _Translations$unit$grams$es._(_root);
|
||||
@override late final _Translations$unit$count$es count = _Translations$unit$count$es._(_root);
|
||||
}
|
||||
|
||||
// Path: unit.handful
|
||||
class _Translations$unit$handful$es extends Translations$unit$handful$en {
|
||||
_Translations$unit$handful$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'puñado';
|
||||
@override String get plural => 'puñados';
|
||||
}
|
||||
|
||||
// Path: unit.teaspoon
|
||||
class _Translations$unit$teaspoon$es extends Translations$unit$teaspoon$en {
|
||||
_Translations$unit$teaspoon$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'cucharadita';
|
||||
@override String get plural => 'cucharaditas';
|
||||
}
|
||||
|
||||
// Path: unit.spoon
|
||||
class _Translations$unit$spoon$es extends Translations$unit$spoon$en {
|
||||
_Translations$unit$spoon$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'cuchara';
|
||||
@override String get plural => 'cucharas';
|
||||
}
|
||||
|
||||
// Path: unit.cup
|
||||
class _Translations$unit$cup$es extends Translations$unit$cup$en {
|
||||
_Translations$unit$cup$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'taza';
|
||||
@override String get plural => 'tazas';
|
||||
}
|
||||
|
||||
// Path: unit.jar
|
||||
class _Translations$unit$jar$es extends Translations$unit$jar$en {
|
||||
_Translations$unit$jar$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'bote';
|
||||
@override String get plural => 'botes';
|
||||
}
|
||||
|
||||
// Path: unit.sack
|
||||
class _Translations$unit$sack$es extends Translations$unit$sack$en {
|
||||
_Translations$unit$sack$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'saco';
|
||||
@override String get plural => 'sacos';
|
||||
}
|
||||
|
||||
// Path: unit.packet
|
||||
class _Translations$unit$packet$es extends Translations$unit$packet$en {
|
||||
_Translations$unit$packet$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'sobre';
|
||||
@override String get plural => 'sobres';
|
||||
}
|
||||
|
||||
// Path: unit.cob
|
||||
class _Translations$unit$cob$es extends Translations$unit$cob$en {
|
||||
_Translations$unit$cob$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'mazorca';
|
||||
@override String get plural => 'mazorcas';
|
||||
}
|
||||
|
||||
// Path: unit.pod
|
||||
class _Translations$unit$pod$es extends Translations$unit$pod$en {
|
||||
_Translations$unit$pod$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'vaina';
|
||||
@override String get plural => 'vainas';
|
||||
}
|
||||
|
||||
// Path: unit.ear
|
||||
class _Translations$unit$ear$es extends Translations$unit$ear$en {
|
||||
_Translations$unit$ear$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'espiga';
|
||||
@override String get plural => 'espigas';
|
||||
}
|
||||
|
||||
// Path: unit.head
|
||||
class _Translations$unit$head$es extends Translations$unit$head$en {
|
||||
_Translations$unit$head$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'cabezuela';
|
||||
@override String get plural => 'cabezuelas';
|
||||
}
|
||||
|
||||
// Path: unit.fruit
|
||||
class _Translations$unit$fruit$es extends Translations$unit$fruit$en {
|
||||
_Translations$unit$fruit$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'fruto';
|
||||
@override String get plural => 'frutos';
|
||||
}
|
||||
|
||||
// Path: unit.bulb
|
||||
class _Translations$unit$bulb$es extends Translations$unit$bulb$en {
|
||||
_Translations$unit$bulb$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'bulbo';
|
||||
@override String get plural => 'bulbos';
|
||||
}
|
||||
|
||||
// Path: unit.tuber
|
||||
class _Translations$unit$tuber$es extends Translations$unit$tuber$en {
|
||||
_Translations$unit$tuber$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'tubérculo';
|
||||
@override String get plural => 'tubérculos';
|
||||
}
|
||||
|
||||
// Path: unit.seedHead
|
||||
class _Translations$unit$seedHead$es extends Translations$unit$seedHead$en {
|
||||
_Translations$unit$seedHead$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'cabeza de semillas';
|
||||
@override String get plural => 'cabezas de semillas';
|
||||
}
|
||||
|
||||
// Path: unit.bunch
|
||||
class _Translations$unit$bunch$es extends Translations$unit$bunch$en {
|
||||
_Translations$unit$bunch$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'manojo';
|
||||
@override String get plural => 'manojos';
|
||||
}
|
||||
|
||||
// Path: unit.plant
|
||||
class _Translations$unit$plant$es extends Translations$unit$plant$en {
|
||||
_Translations$unit$plant$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'planta';
|
||||
@override String get plural => 'plantas';
|
||||
}
|
||||
|
||||
// Path: unit.pot
|
||||
class _Translations$unit$pot$es extends Translations$unit$pot$en {
|
||||
_Translations$unit$pot$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'maceta';
|
||||
@override String get plural => 'macetas';
|
||||
}
|
||||
|
||||
// Path: unit.tray
|
||||
class _Translations$unit$tray$es extends Translations$unit$tray$en {
|
||||
_Translations$unit$tray$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'bandeja';
|
||||
@override String get plural => 'bandejas';
|
||||
}
|
||||
|
||||
// Path: unit.grams
|
||||
class _Translations$unit$grams$es extends Translations$unit$grams$en {
|
||||
_Translations$unit$grams$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'gramo';
|
||||
@override String get plural => 'gramos';
|
||||
}
|
||||
|
||||
// Path: unit.count
|
||||
class _Translations$unit$count$es extends Translations$unit$count$en {
|
||||
_Translations$unit$count$es._(TranslationsEs root) : this._root = root, super.internal(root);
|
||||
|
||||
final TranslationsEs _root; // ignore: unused_field
|
||||
|
||||
// Translations
|
||||
@override String get singular => 'semilla';
|
||||
@override String get plural => 'semillas';
|
||||
}
|
||||
|
||||
/// The flat map containing all translations for locale <es>.
|
||||
|
|
@ -203,6 +455,7 @@ extension on TranslationsEs {
|
|||
'common.cancel' => 'Cancelar',
|
||||
'common.delete' => 'Eliminar',
|
||||
'common.edit' => 'Editar',
|
||||
'common.type' => 'Tipo',
|
||||
'inventory.title' => 'Inventario',
|
||||
'inventory.searchHint' => 'Buscar semillas',
|
||||
'inventory.empty' => 'Aún no hay semillas. Toca + para añadir la primera.',
|
||||
|
|
@ -238,25 +491,56 @@ extension on TranslationsEs {
|
|||
'editVariety.speciesHint' => 'Buscar una especie…',
|
||||
'addLot.title' => 'Añadir lote',
|
||||
'addLot.year' => 'Año de cosecha',
|
||||
'addLot.quantity' => 'Cantidad',
|
||||
'quantityKind.aFew' => 'unas pocas',
|
||||
'quantityKind.some' => 'algunas',
|
||||
'quantityKind.plenty' => 'muchas',
|
||||
'quantityKind.handful' => 'un puñado',
|
||||
'quantityKind.pinch' => 'una pizca',
|
||||
'quantityKind.jar' => 'un tarro',
|
||||
'quantityKind.packet' => 'un sobre',
|
||||
'quantityKind.cob' => 'una mazorca',
|
||||
'quantityKind.head' => 'una cabezuela',
|
||||
'quantityKind.pod' => 'una vaina',
|
||||
'quantityKind.ear' => 'una espiga',
|
||||
'quantityKind.fruit' => 'un fruto',
|
||||
'quantityKind.bulb' => 'un bulbo',
|
||||
'quantityKind.tuber' => 'un tubérculo',
|
||||
'quantityKind.seedHead' => 'una cabeza de semillas',
|
||||
'quantityKind.bunch' => 'un manojo',
|
||||
'quantityKind.grams' => 'gramos',
|
||||
'quantityKind.count' => 'unidades',
|
||||
'addLot.quantity' => '¿Cuánta?',
|
||||
'addLot.amount' => 'Cantidad',
|
||||
'lotType.seed' => 'Semillas',
|
||||
'lotType.plant' => 'Plantel',
|
||||
'unit.aFew' => 'unas pocas',
|
||||
'unit.some' => 'algunas',
|
||||
'unit.plenty' => 'muchas',
|
||||
'unit.pinch' => 'una pizca',
|
||||
'unit.handful.singular' => 'puñado',
|
||||
'unit.handful.plural' => 'puñados',
|
||||
'unit.teaspoon.singular' => 'cucharadita',
|
||||
'unit.teaspoon.plural' => 'cucharaditas',
|
||||
'unit.spoon.singular' => 'cuchara',
|
||||
'unit.spoon.plural' => 'cucharas',
|
||||
'unit.cup.singular' => 'taza',
|
||||
'unit.cup.plural' => 'tazas',
|
||||
'unit.jar.singular' => 'bote',
|
||||
'unit.jar.plural' => 'botes',
|
||||
'unit.sack.singular' => 'saco',
|
||||
'unit.sack.plural' => 'sacos',
|
||||
'unit.packet.singular' => 'sobre',
|
||||
'unit.packet.plural' => 'sobres',
|
||||
'unit.cob.singular' => 'mazorca',
|
||||
'unit.cob.plural' => 'mazorcas',
|
||||
'unit.pod.singular' => 'vaina',
|
||||
'unit.pod.plural' => 'vainas',
|
||||
'unit.ear.singular' => 'espiga',
|
||||
'unit.ear.plural' => 'espigas',
|
||||
'unit.head.singular' => 'cabezuela',
|
||||
'unit.head.plural' => 'cabezuelas',
|
||||
'unit.fruit.singular' => 'fruto',
|
||||
'unit.fruit.plural' => 'frutos',
|
||||
'unit.bulb.singular' => 'bulbo',
|
||||
'unit.bulb.plural' => 'bulbos',
|
||||
'unit.tuber.singular' => 'tubérculo',
|
||||
'unit.tuber.plural' => 'tubérculos',
|
||||
'unit.seedHead.singular' => 'cabeza de semillas',
|
||||
'unit.seedHead.plural' => 'cabezas de semillas',
|
||||
'unit.bunch.singular' => 'manojo',
|
||||
'unit.bunch.plural' => 'manojos',
|
||||
'unit.plant.singular' => 'planta',
|
||||
'unit.plant.plural' => 'plantas',
|
||||
'unit.pot.singular' => 'maceta',
|
||||
'unit.pot.plural' => 'macetas',
|
||||
'unit.tray.singular' => 'bandeja',
|
||||
'unit.tray.plural' => 'bandejas',
|
||||
'unit.grams.singular' => 'gramo',
|
||||
'unit.grams.plural' => 'gramos',
|
||||
'unit.count.singular' => 'semilla',
|
||||
'unit.count.plural' => 'semillas',
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue