feat(inventory): month/year harvest date picker (schema v3)

Replace the free-text harvest year with a themed month/year picker:
a tappable field opens a green-styled dialog with month and year grids
(navigable, paginated years), month optional. Lots now read e.g.
"September 2021" or just "Year 2021".

- schema v3: add nullable Lot.harvest_month (1..12) + migration + tests
- repo/cubit propagate harvestMonth; localized month names (en/es) via slang
This commit is contained in:
vjrj 2026-07-08 12:09:38 +02:00
parent 9e5c82184b
commit 5d4053157f
17 changed files with 3799 additions and 57 deletions

View file

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:typed_data';
import 'package:commons_core/commons_core.dart';
import 'package:equatable/equatable.dart';
@ -54,11 +55,13 @@ class VarietyDetailCubit extends Cubit<VarietyDetailState> {
Future<void> addLot({
LotType type = LotType.seed,
int? year,
int? month,
Quantity? quantity,
}) => _repo.addLot(
varietyId: varietyId,
type: type,
harvestYear: year,
harvestMonth: month,
quantity: quantity,
);
@ -66,11 +69,13 @@ class VarietyDetailCubit extends Cubit<VarietyDetailState> {
required String lotId,
required LotType type,
int? year,
int? month,
Quantity? quantity,
}) => _repo.updateLot(
lotId: lotId,
type: type,
harvestYear: year,
harvestMonth: month,
quantity: quantity,
);
@ -82,6 +87,11 @@ class VarietyDetailCubit extends Cubit<VarietyDetailState> {
Future<void> removeVernacularName(String nameId) =>
_repo.removeVernacularName(nameId);
Future<void> addPhoto(Uint8List bytes) => _repo.addPhoto(varietyId, bytes);
Future<void> removePhoto(String attachmentId) =>
_repo.removePhoto(attachmentId);
Future<void> linkSpecies(String speciesId) =>
_repo.linkSpecies(varietyId, speciesId);