feat(inventory): editable vernacular (common) names

The "also known as" names were read-only; now they can be added and removed:
- Repository: addVernacularName + removeVernacularName (soft delete);
  VarietyDetail.vernacularNames carries ids (new VernacularName model).
- Cubit: addVernacularName / removeVernacularName.
- Detail: deletable name chips + an "Add name" chip opening a small dialog;
  the section is always visible so names can be added when empty.

Tests: repo add/remove + widget add/remove. 44 green.
This commit is contained in:
vjrj 2026-07-08 11:20:36 +02:00
parent f8d4d9a778
commit 9e5c82184b
10 changed files with 256 additions and 83 deletions

View file

@ -171,4 +171,17 @@ void main() {
expect((await repo.watchVariety(id).first)!.lots, isEmpty);
});
test('add and remove vernacular names', () async {
final id = await repo.addQuickVariety(label: 'Maize');
final nameId = await repo.addVernacularName(id, 'Maíz');
expect(
(await repo.watchVariety(id).first)!.vernacularNames.map((n) => n.name),
['Maíz'],
);
await repo.removeVernacularName(nameId);
expect((await repo.watchVariety(id).first)!.vernacularNames, isEmpty);
});
}