Captures: tap an action to go straight to it; the menu button inside a checklist
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DDwfd6Ki8UfG4hK6W5YpJz
This commit is contained in:
@@ -171,6 +171,17 @@ class ChecklistRun {
|
|||||||
return out;
|
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<String> selectAction(int a) {
|
||||||
|
if (a == action && !inSpan) return const [];
|
||||||
|
final out = inSpan ? _leave() : <String>[];
|
||||||
|
action = a;
|
||||||
|
rep = 0;
|
||||||
|
spanStarted = null;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
void _goto(int i) {
|
void _goto(int i) {
|
||||||
step = i;
|
step = i;
|
||||||
action = 0;
|
action = 0;
|
||||||
@@ -275,6 +286,9 @@ class _ChecklistPageState extends State<ChecklistPage> {
|
|||||||
final steps = StepList(run: run, onSelect: (i) => _send(run.select(i)));
|
final steps = StepList(run: run, onSelect: (i) => _send(run.select(i)));
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
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),
|
title: Text(widget.checklist.title),
|
||||||
actions: [
|
actions: [
|
||||||
Builder(
|
Builder(
|
||||||
@@ -384,10 +398,12 @@ class _ChecklistPageState extends State<ChecklistPage> {
|
|||||||
final done = i < run.action;
|
final done = i < run.action;
|
||||||
final now = i == run.action;
|
final now = i == run.action;
|
||||||
final reps = a.repeat > 1 ? ' ×${a.repeat}' : '';
|
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),
|
avatar: Icon(done ? Icons.check : (a.point ? Icons.flag_outlined : Icons.timelapse), size: 18),
|
||||||
label: Text('${a.label}$reps'),
|
label: Text('${a.label}$reps'),
|
||||||
backgroundColor: now ? Theme.of(context).colorScheme.primaryContainer : null,
|
backgroundColor: now ? Theme.of(context).colorScheme.primaryContainer : null,
|
||||||
|
onPressed: run.finished && now ? null : () => _send(run.selectAction(i)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user