feat(app): hint isolation distance when sowing a cross-pollinating crop
One passive line in the batch story after a 'sown today' tap — 'this species crosses, grow it ~400 m from others' — sourced from the bundled seed-saving guidance (family default + species override). Selfers get nothing: the trap is recording isolation religiously for beans where it never mattered. No input fields, no schema change.
This commit is contained in:
parent
f1aa8f8e66
commit
1a826477f2
8 changed files with 116 additions and 7 deletions
|
|
@ -737,7 +737,8 @@
|
|||
"ratedMixed": "It did so-so",
|
||||
"ratedPoor": "It did poorly",
|
||||
"outcomeTitle": "Season note",
|
||||
"outcomeYear": "Season {year}"
|
||||
"outcomeYear": "Season {year}",
|
||||
"isolationHint": "This species crosses with its neighbours — grow it about {meters} m away from others to keep it true"
|
||||
},
|
||||
"sale": {
|
||||
"title": "Sales",
|
||||
|
|
|
|||
|
|
@ -736,7 +736,8 @@
|
|||
"ratedMixed": "Se dio regular",
|
||||
"ratedPoor": "Se dio mal",
|
||||
"outcomeTitle": "Nota de temporada",
|
||||
"outcomeYear": "Temporada {year}"
|
||||
"outcomeYear": "Temporada {year}",
|
||||
"isolationHint": "Esta especie se cruza con sus vecinas — cultívala a unos {meters} m de otras para que se mantenga fiel"
|
||||
},
|
||||
"sale": {
|
||||
"title": "Ventas",
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
/// To regenerate, run: `dart run slang`
|
||||
///
|
||||
/// Locales: 7
|
||||
/// Strings: 3564 (509 per locale)
|
||||
/// Strings: 3566 (509 per locale)
|
||||
///
|
||||
/// Built on 2026-07-18 at 10:23 UTC
|
||||
/// Built on 2026-07-18 at 10:28 UTC
|
||||
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint, unused_import
|
||||
|
|
|
|||
|
|
@ -2103,6 +2103,9 @@ class Translations$history$en {
|
|||
|
||||
/// en: 'Season {year}'
|
||||
String outcomeYear({required Object year}) => 'Season ${year}';
|
||||
|
||||
/// en: 'This species crosses with its neighbours — grow it about {meters} m away from others to keep it true'
|
||||
String isolationHint({required Object meters}) => 'This species crosses with its neighbours — grow it about ${meters} m away from others to keep it true';
|
||||
}
|
||||
|
||||
// Path: sale
|
||||
|
|
@ -3359,6 +3362,7 @@ extension on Translations {
|
|||
'history.ratedPoor' => 'It did poorly',
|
||||
'history.outcomeTitle' => 'Season note',
|
||||
'history.outcomeYear' => ({required Object year}) => 'Season ${year}',
|
||||
'history.isolationHint' => ({required Object meters}) => 'This species crosses with its neighbours — grow it about ${meters} m away from others to keep it true',
|
||||
'sale.title' => 'Sales',
|
||||
'sale.help' => 'Record seed you sold or bought — money, Ğ1, or any currency. A separate model from a gift or a Plantare. No commission is ever taken on seeds.',
|
||||
'sale.add' => 'Record a sale',
|
||||
|
|
|
|||
|
|
@ -1074,6 +1074,7 @@ class _Translations$history$es extends Translations$history$en {
|
|||
@override String get ratedPoor => 'Se dio mal';
|
||||
@override String get outcomeTitle => 'Nota de temporada';
|
||||
@override String outcomeYear({required Object year}) => 'Temporada ${year}';
|
||||
@override String isolationHint({required Object meters}) => 'Esta especie se cruza con sus vecinas — cultívala a unos ${meters} m de otras para que se mantenga fiel';
|
||||
}
|
||||
|
||||
// Path: sale
|
||||
|
|
@ -2101,6 +2102,7 @@ extension on TranslationsEs {
|
|||
'history.ratedPoor' => 'Se dio mal',
|
||||
'history.outcomeTitle' => 'Nota de temporada',
|
||||
'history.outcomeYear' => ({required Object year}) => 'Temporada ${year}',
|
||||
'history.isolationHint' => ({required Object meters}) => 'Esta especie se cruza con sus vecinas — cultívala a unos ${meters} m de otras para que se mantenga fiel',
|
||||
'sale.title' => 'Ventas',
|
||||
'sale.help' => 'Registra semilla vendida o comprada — dinero, Ğ1 o cualquier moneda. Un modelo aparte del regalo y del Plantare. Nunca se cobra comisión por las semillas.',
|
||||
'sale.add' => 'Registrar venta',
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import 'package:intl/intl.dart';
|
|||
|
||||
import '../data/variety_repository.dart';
|
||||
import '../db/enums.dart';
|
||||
import '../domain/seed_saving.dart';
|
||||
import '../i18n/strings.g.dart';
|
||||
import 'quantity_kind_l10n.dart';
|
||||
|
||||
|
|
@ -14,20 +15,31 @@ Future<void> showLotHistorySheet(
|
|||
BuildContext context, {
|
||||
required VarietyRepository repository,
|
||||
required VarietyLot lot,
|
||||
SeedSavingGuide? guide,
|
||||
}) {
|
||||
return showModalBottomSheet<void>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
builder: (_) => _LotHistorySheet(repository: repository, lot: lot),
|
||||
builder: (_) =>
|
||||
_LotHistorySheet(repository: repository, lot: lot, guide: guide),
|
||||
);
|
||||
}
|
||||
|
||||
class _LotHistorySheet extends StatefulWidget {
|
||||
const _LotHistorySheet({required this.repository, required this.lot});
|
||||
const _LotHistorySheet({
|
||||
required this.repository,
|
||||
required this.lot,
|
||||
this.guide,
|
||||
});
|
||||
|
||||
final VarietyRepository repository;
|
||||
final VarietyLot lot;
|
||||
|
||||
/// Bundled species guidance, or null. Only read to drop the one-line
|
||||
/// isolation hint when a cross-pollinating crop is sown — selfers get
|
||||
/// nothing (the fields people record religiously where they don't matter).
|
||||
final SeedSavingGuide? guide;
|
||||
|
||||
@override
|
||||
State<_LotHistorySheet> createState() => _LotHistorySheetState();
|
||||
}
|
||||
|
|
@ -43,6 +55,10 @@ class _LotHistorySheetState extends State<_LotHistorySheet> {
|
|||
bool _askOutcome = false;
|
||||
final _outcomeNote = TextEditingController();
|
||||
|
||||
// One passive line after sowing a crosser ("this species crosses — isolate
|
||||
// ~400 m"). Never shown for selfers, never an input.
|
||||
bool _showSowingHint = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
|
@ -74,9 +90,14 @@ class _LotHistorySheetState extends State<_LotHistorySheet> {
|
|||
),
|
||||
),
|
||||
);
|
||||
final guide = widget.guide;
|
||||
setState(() {
|
||||
_saving = false;
|
||||
_askOutcome = type == MovementType.harvested;
|
||||
_showSowingHint =
|
||||
type == MovementType.sown &&
|
||||
guide?.pollination == Pollination.cross &&
|
||||
guide?.isolationMinM != null;
|
||||
_history = widget.repository.lotHistory(widget.lot.id);
|
||||
});
|
||||
}
|
||||
|
|
@ -146,6 +167,25 @@ class _LotHistorySheetState extends State<_LotHistorySheet> {
|
|||
),
|
||||
],
|
||||
),
|
||||
if (_showSowingHint)
|
||||
Padding(
|
||||
key: const Key('history.isolationHint'),
|
||||
padding: const EdgeInsetsDirectional.only(top: 8, start: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.lightbulb_outline, size: 16),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
context.t.history.isolationHint(
|
||||
meters: widget.guide!.isolationMinM!,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (_askOutcome) ...[
|
||||
const SizedBox(height: 8),
|
||||
_OutcomeQuestion(
|
||||
|
|
|
|||
|
|
@ -237,6 +237,10 @@ class _DetailView extends StatelessWidget {
|
|||
cubit: cubit,
|
||||
lot: lot,
|
||||
viabilityYears: detail.viabilityYears,
|
||||
guide: SeedSavingCatalog.guideFor(
|
||||
scientificName: detail.scientificName,
|
||||
family: detail.family ?? detail.category,
|
||||
),
|
||||
),
|
||||
_PlantaresSection(varietyId: detail.id),
|
||||
],
|
||||
|
|
@ -375,6 +379,7 @@ class _LotTile extends StatelessWidget {
|
|||
required this.cubit,
|
||||
required this.lot,
|
||||
required this.viabilityYears,
|
||||
this.guide,
|
||||
});
|
||||
|
||||
final VarietyDetailCubit cubit;
|
||||
|
|
@ -383,6 +388,10 @@ class _LotTile extends StatelessWidget {
|
|||
/// Typical seed longevity of the variety's species (years), or null.
|
||||
final int? viabilityYears;
|
||||
|
||||
/// Bundled seed-saving guidance for the species, or null — lets the history
|
||||
/// sheet drop a one-line isolation hint when a crosser is sown.
|
||||
final SeedSavingGuide? guide;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = context.t;
|
||||
|
|
@ -443,6 +452,7 @@ class _LotTile extends StatelessWidget {
|
|||
context,
|
||||
repository: context.read<VarietyRepository>(),
|
||||
lot: lot,
|
||||
guide: guide,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue