feat(seed-saving): per-crop 'how to save this seed' guidance

A bundled, curated knowledge layer — the differentiator of a serious
seed app. For a variety's crop it shows how the plant reproduces and what
it takes to keep the variety true: life cycle, pollination (self/cross +
insect/wind), isolation distance, how many plants to save from, dry/wet
processing, a difficulty pill, and a short tip — all in human words.

- assets/catalog/seed_saving.json: curated public-domain data (Seed to
  Seed / Seed Savers), keyed by botanical FAMILY (defaults) with
  per-species/genus OVERRIDES that win — so e.g. Vicia faba is correctly
  insect-cross-pollinated despite the selfing Fabaceae default, and maize
  is wind-pollinated with a large population. Notes are locale-keyed
  (es/en), extensible to any language — a starter set, not a ceiling.
- domain/seed_saving.dart (pure): enums + SeedSavingGuide (merge, note
  fallback) + SeedSavingData.guideFor (species → genus → family).
- data/seed_saving_catalog.dart: loads the asset once into an in-memory
  singleton (no DB table, no migration); injector loads it at startup.
- VarietyDetail gains  (from the linked species — the reliable
  key, vs the editable category); detail screen shows a _SeedSavingView
  when a guide resolves.
- i18n seedSaving block (labels + enum values + params) in en/es/pt/ast.
- Tests: domain lookup/merge, the real asset's key corrections, and the
  detail section shows/hides. 314 suite tests green; analyze clean.
This commit is contained in:
vjrj 2026-07-11 07:17:12 +02:00
parent 4ebfdca2fd
commit 4bb94db3e0
19 changed files with 954 additions and 2 deletions

View file

@ -39,6 +39,7 @@ class TranslationsAst extends Translations with BaseTranslations<AppLocale, Tran
TranslationsAst $copyWith({TranslationMetadata<AppLocale, Translations>? meta}) => TranslationsAst(meta: meta ?? this.$meta);
// Translations
@override late final _Translations$seedSaving$ast seedSaving = _Translations$seedSaving$ast._(_root);
@override late final _Translations$calendar$ast calendar = _Translations$calendar$ast._(_root);
@override late final _Translations$app$ast app = _Translations$app$ast._(_root);
@override late final _Translations$bootstrap$ast bootstrap = _Translations$bootstrap$ast._(_root);
@ -82,6 +83,39 @@ class TranslationsAst extends Translations with BaseTranslations<AppLocale, Tran
@override late final _Translations$sale$ast sale = _Translations$sale$ast._(_root);
}
// Path: seedSaving
class _Translations$seedSaving$ast extends Translations$seedSaving$en {
_Translations$seedSaving$ast._(TranslationsAst root) : this._root = root, super.internal(root);
final TranslationsAst _root; // ignore: unused_field
// Translations
@override String get title => 'Guardar la so semiente';
@override String get subtitle => 'Lo que fai falta pa caltener la variedá fiel';
@override String get lifeCycle => 'Ciclu';
@override String get cycleAnnual => 'Añal';
@override String get cycleBiennial => 'Bienal — da semiente el 2.u añu';
@override String get cyclePerennial => 'Perenne';
@override String get pollination => 'Polinización';
@override String get pollSelf => 'Autopolinízase';
@override String get pollCross => 'Crúciase con otres';
@override String get pollMixed => 'Autopolinízase, pero crúciase dacuando';
@override String get byInsect => 'por inseutos';
@override String get byWind => 'col vientu';
@override String get isolation => 'Xébrala';
@override String isolationRange({required Object min, required Object max}) => '${min}${max} m d\'otres variedaes';
@override String isolationSingle({required Object min}) => '${min} m d\'otres variedaes';
@override String get plants => 'Guarda de delles plantes';
@override String plantsValue({required Object n}) => 'D\'a lo menos ${n} plantes';
@override String get processing => 'Cómo llimpiala';
@override String get procDry => 'Semiente seca (mayar)';
@override String get procWet => 'Semiente húmeda (fermentar y llavar)';
@override String get difficulty => 'Dificultá';
@override String get diffEasy => 'Fácil';
@override String get diffMedium => 'Media';
@override String get diffHard => 'Difícil';
}
// Path: calendar
class _Translations$calendar$ast extends Translations$calendar$en {
_Translations$calendar$ast._(TranslationsAst root) : this._root = root, super.internal(root);
@ -1226,6 +1260,30 @@ class _Translations$intro$slides$plantare$ast extends Translations$intro$slides$
extension on TranslationsAst {
dynamic _flatMapFunction(String path) {
return switch (path) {
'seedSaving.title' => 'Guardar la so semiente',
'seedSaving.subtitle' => 'Lo que fai falta pa caltener la variedá fiel',
'seedSaving.lifeCycle' => 'Ciclu',
'seedSaving.cycleAnnual' => 'Añal',
'seedSaving.cycleBiennial' => 'Bienal — da semiente el 2.u añu',
'seedSaving.cyclePerennial' => 'Perenne',
'seedSaving.pollination' => 'Polinización',
'seedSaving.pollSelf' => 'Autopolinízase',
'seedSaving.pollCross' => 'Crúciase con otres',
'seedSaving.pollMixed' => 'Autopolinízase, pero crúciase dacuando',
'seedSaving.byInsect' => 'por inseutos',
'seedSaving.byWind' => 'col vientu',
'seedSaving.isolation' => 'Xébrala',
'seedSaving.isolationRange' => ({required Object min, required Object max}) => '${min}${max} m d\'otres variedaes',
'seedSaving.isolationSingle' => ({required Object min}) => '${min} m d\'otres variedaes',
'seedSaving.plants' => 'Guarda de delles plantes',
'seedSaving.plantsValue' => ({required Object n}) => 'D\'a lo menos ${n} plantes',
'seedSaving.processing' => 'Cómo llimpiala',
'seedSaving.procDry' => 'Semiente seca (mayar)',
'seedSaving.procWet' => 'Semiente húmeda (fermentar y llavar)',
'seedSaving.difficulty' => 'Dificultá',
'seedSaving.diffEasy' => 'Fácil',
'seedSaving.diffMedium' => 'Media',
'seedSaving.diffHard' => 'Difícil',
'calendar.title' => 'Esti mes',
'calendar.filterChip' => 'Esti mes',
'calendar.nothing' => ({required Object month}) => 'Nada anotao pa ${month}.',