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)), ); }