feat(plantare): tie the propose form to a real seed

The propose sheet used a free-text seed name, unlinked from the
inventory. Now the seed is picked from your catalogued varieties so the
Plantaré is always tied to a real Variety (tap-through to its detail, and
it shows in that seed's commitments):

- Seed field is an Autocomplete over the inventory; on send the typed name
  resolves to the matching Variety, or creates a quick one if it's new —
  so varietyId is never null. Sheet takes the VarietyRepository; chat
  passes it.
- New repo one-shot `varietyLabels()` (id + label, no joins) feeds the
  picker. Deliberately a Future, not `watchInventory()` — a transient
  sheet must not hold a live Drift subscription (that hung the widget test
  ~36 min). Tests use it too and now run in ~2s with bounded pumps + a
  tall surface, no pumpAndSettle.

Tests: a new name creates & links a Variety; a matching name links the
existing one without duplicating. ui/services/data plantare suites green.
This commit is contained in:
vjrj 2026-07-15 01:24:50 +02:00
parent 4ab146b157
commit 7a82505a4e
4 changed files with 185 additions and 41 deletions

View file

@ -6,6 +6,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:url_launcher/url_launcher.dart';
import '../data/variety_repository.dart';
import '../di/injector.dart';
import '../domain/chat_timeline.dart';
import '../domain/message_rules.dart';
@ -214,6 +215,7 @@ class _ChatScreenState extends State<ChatScreen> {
final sent = await showProposePlantareSheet(
context,
service: getIt<PlantareService>(),
repository: getIt<VarietyRepository>(),
peerPubkey: widget.peerPubkey,
peerName: _peerName,
);