feat(plantare): surface product link + dates; spec the bilateral record

The Plantaré screen stored madeOn/dueBy/varietyId but showed none of them,
so it felt half-built. Surface what's already there (no schema change):

- watchPlantareViews() joins each commitment with its variety label
- tile shows the made-on date, a "Return by {date}" line (amber + "overdue"
  when an open promise is past due, via new seedWarning colour), the variety
  name, and taps through to /variety/:id
- add sheet gains an optional return-by date picker (createPlantare already
  took dueBy)
- variety detail shows a read-only commitments section (hidden when empty,
  no add button — honours the single hand-over door)
- i18n en/es/pt/ast; tests for the join, dueBy round-trip, tile, and section

Also specs the deferred two-sided record in docs/design/plantare-bilateral.md
(Nostr pubkey counterparty, PlantareTransport propose->accept->counter-sign,
deferred key/signature/movement columns, provenance DAG, reputation anchor),
with a faithful transcription of the paper Plantaré v0.4 (BAH-Semillero 2009,
CC-BY-SA). Cross-linked from data-model §2.7 and sharing-model §6.
This commit is contained in:
vjrj 2026-07-13 18:06:33 +02:00
parent e57763d0a2
commit adf396d49d
21 changed files with 687 additions and 27 deletions

View file

@ -34,6 +34,7 @@ class _PlantareSheetState extends State<_PlantareSheet> {
final _counterparty = TextEditingController();
final _owed = TextEditingController();
final _note = TextEditingController();
DateTime? _dueBy;
bool _saving = false;
@override
@ -46,6 +47,17 @@ class _PlantareSheetState extends State<_PlantareSheet> {
String? _nullIfBlank(String s) => s.trim().isEmpty ? null : s.trim();
Future<void> _pickDueBy() async {
final now = DateTime.now();
final picked = await showDatePicker(
context: context,
initialDate: _dueBy ?? DateTime(now.year + 1, now.month, now.day),
firstDate: DateTime(now.year - 1),
lastDate: DateTime(now.year + 10),
);
if (picked != null) setState(() => _dueBy = picked);
}
Future<void> _save() async {
setState(() => _saving = true);
await widget.repository.createPlantare(
@ -53,6 +65,7 @@ class _PlantareSheetState extends State<_PlantareSheet> {
varietyId: widget.varietyId,
counterparty: _nullIfBlank(_counterparty.text),
owedDescription: _nullIfBlank(_owed.text),
dueBy: _dueBy?.millisecondsSinceEpoch,
note: _nullIfBlank(_note.text),
);
if (mounted) Navigator.of(context).pop();
@ -121,6 +134,43 @@ class _PlantareSheetState extends State<_PlantareSheet> {
),
),
const SizedBox(height: 12),
// Optional return-by date a gentle reminder, never enforced.
InputDecorator(
decoration: InputDecoration(
labelText: t.plantare.dueByLabel,
helperText: t.plantare.dueByHint,
border: const OutlineInputBorder(),
),
child: Row(
children: [
Expanded(
child: Text(
_dueBy == null
? t.plantare.pickDate
: MaterialLocalizations.of(context)
.formatShortDate(_dueBy!),
style: TextStyle(
color: _dueBy == null ? seedMuted : seedOnSurface,
),
),
),
if (_dueBy != null)
IconButton(
key: const Key('plantare.dueBy.clear'),
icon: const Icon(Icons.clear, size: 20),
tooltip: t.plantare.clearDate,
onPressed: () => setState(() => _dueBy = null),
),
IconButton(
key: const Key('plantare.dueBy.pick'),
icon: const Icon(Icons.event_outlined),
tooltip: t.plantare.pickDate,
onPressed: _pickDueBy,
),
],
),
),
const SizedBox(height: 12),
TextField(
key: const Key('plantare.note'),
controller: _note,