refine(quantity): drop handful, reorder scale, potted-plant icon, year dropdown

Feedback from the running app:
- Remove "handful" from the scale (redundant with spoon); keep the enum value.
- Reorder so "packet" (sobre) follows "spoon" (cuchara).
- Use the Material Symbols potted-plant for the plant lot type and plant unit
  (adds material_symbols_icons).
- Harvest year is now a dropdown of recent years instead of free text.

38 tests green; Linux build runs with the new icon font bundled.
This commit is contained in:
vjrj 2026-07-08 11:03:57 +02:00
parent 3942975dba
commit 7e92410728
6 changed files with 36 additions and 12 deletions

View file

@ -477,7 +477,11 @@ class _EditVarietySheetState extends State<_EditVarietySheet> {
Future<void> _showAddLotSheet(BuildContext context, VarietyDetailCubit cubit) {
final t = context.t;
final yearController = TextEditingController();
final currentYear = DateTime.now().year;
// Harvest years: current year down through the last four decades. Newest
// first because a freshly harvested lot is the common case.
final years = [for (var y = currentYear; y >= currentYear - 40; y--) y];
var selectedYear = currentYear;
var selectedType = LotType.seed;
Quantity? selectedQuantity;
return showModalBottomSheet<void>(
@ -508,14 +512,20 @@ Future<void> _showAddLotSheet(BuildContext context, VarietyDetailCubit cubit) {
}),
),
const SizedBox(height: 12),
TextField(
DropdownButtonFormField<int>(
key: const Key('addLot.year'),
controller: yearController,
keyboardType: TextInputType.number,
initialValue: selectedYear,
decoration: InputDecoration(
labelText: t.addLot.year,
border: const OutlineInputBorder(),
),
items: [
for (final y in years)
DropdownMenuItem(value: y, child: Text('$y')),
],
onChanged: (value) {
if (value != null) setState(() => selectedYear = value);
},
),
const SizedBox(height: 16),
Text(
@ -541,7 +551,7 @@ Future<void> _showAddLotSheet(BuildContext context, VarietyDetailCubit cubit) {
onPressed: () {
cubit.addLot(
type: selectedType,
year: int.tryParse(yearController.text.trim()),
year: selectedYear,
quantity: selectedQuantity,
);
Navigator.of(sheetContext).pop();