From a471bbe7c44730fab7c53945b201491ac77193f4 Mon Sep 17 00:00:00 2001 From: Mikkeli Date: Thu, 15 Oct 2026 20:27:08 +0900 Subject: [PATCH] Captures: tap an action to go straight to it; the menu button inside a checklist Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DDwfd6Ki8UfG4hK6W5YpJz --- lib/pages/checklist.dart | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/pages/checklist.dart b/lib/pages/checklist.dart index a006b51..dfb327e 100644 --- a/lib/pages/checklist.dart +++ b/lib/pages/checklist.dart @@ -171,6 +171,17 @@ class ChecklistRun { return out; } + /// Jump to action [a] of the current step (fog lamps without walking the list). + /// A span left running is marked aborted, as when leaving a step. + List selectAction(int a) { + if (a == action && !inSpan) return const []; + final out = inSpan ? _leave() : []; + action = a; + rep = 0; + spanStarted = null; + return out; + } + void _goto(int i) { step = i; action = 0; @@ -275,6 +286,9 @@ class _ChecklistPageState extends State { final steps = StepList(run: run, onSelect: (i) => _send(run.select(i))); return Scaffold( appBar: AppBar( + // The menu stays one tap away inside a checklist; back returns to the list. + leadingWidth: 104, + leading: const Row(children: [BackButton(), MenuButton()]), title: Text(widget.checklist.title), actions: [ Builder( @@ -384,10 +398,12 @@ class _ChecklistPageState extends State { final done = i < run.action; final now = i == run.action; final reps = a.repeat > 1 ? ' ×${a.repeat}' : ''; - return Chip( + // Tap to go straight to this action. + return ActionChip( avatar: Icon(done ? Icons.check : (a.point ? Icons.flag_outlined : Icons.timelapse), size: 18), label: Text('${a.label}$reps'), backgroundColor: now ? Theme.of(context).colorScheme.primaryContainer : null, + onPressed: run.finished && now ? null : () => _send(run.selectAction(i)), ); }