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:
parent
3942975dba
commit
7e92410728
6 changed files with 36 additions and 12 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:commons_core/commons_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
|
||||
import '../db/enums.dart';
|
||||
import '../i18n/strings.g.dart';
|
||||
|
|
@ -8,15 +9,15 @@ import 'seed_glyph.dart';
|
|||
import 'theme.dart';
|
||||
|
||||
/// Informal seed amounts, ascending: vibes → containers → seed/fruit forms.
|
||||
/// ([QuantityKind.handful] is intentionally omitted — it overlaps with spoon.)
|
||||
const seedScaleKinds = <QuantityKind>[
|
||||
QuantityKind.aFew,
|
||||
QuantityKind.handful,
|
||||
QuantityKind.teaspoon,
|
||||
QuantityKind.spoon,
|
||||
QuantityKind.packet,
|
||||
QuantityKind.cup,
|
||||
QuantityKind.jar,
|
||||
QuantityKind.sack,
|
||||
QuantityKind.packet,
|
||||
QuantityKind.cob,
|
||||
QuantityKind.pod,
|
||||
QuantityKind.ear,
|
||||
|
|
@ -61,7 +62,7 @@ class LotTypeSelector extends StatelessWidget {
|
|||
ButtonSegment(
|
||||
value: LotType.plant,
|
||||
label: Text(t.lotType.plant),
|
||||
icon: const Icon(Icons.local_florist_outlined, size: 18),
|
||||
icon: const Icon(Symbols.potted_plant, size: 18),
|
||||
),
|
||||
],
|
||||
selected: {value},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:commons_core/commons_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
|
||||
/// Renders a glyph from the bundled `seedks` icon font, whose characters `a`–`k`
|
||||
/// map to seed-themed pictograms (jar, packet, spoon…). See
|
||||
|
|
@ -63,7 +64,7 @@ IconData _materialIconForKind(QuantityKind kind) => switch (kind) {
|
|||
QuantityKind.cob || QuantityKind.ear => Icons.grass,
|
||||
QuantityKind.head || QuantityKind.seedHead => Icons.filter_vintage_outlined,
|
||||
QuantityKind.fruit => Icons.local_florist_outlined,
|
||||
QuantityKind.plant => Icons.local_florist_outlined,
|
||||
QuantityKind.plant => Symbols.potted_plant,
|
||||
QuantityKind.pot => Icons.yard_outlined,
|
||||
QuantityKind.tray => Icons.grid_on_outlined,
|
||||
QuantityKind.bulb ||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue