import '../../external/data/RoutineStep.dart'; import 'StepMode.dart'; /// One beat of a running routine — a single work set or the rest after it. /// The runner walks a flat list of these, so "set 2 of 4" and "rest" are the /// same kind of thing to the clock. class RoutinePhase { /// Index of the step this phase belongs to. final int stepIndex; final RoutineStep step; /// 1-based set number within the step. final int set; final bool rest; RoutinePhase({ required this.stepIndex, required this.step, this.set = 1, this.rest = false, }); /// Seconds the clock runs for. Zero means the phase waits for a tap. int get seconds { if (rest) { return step.restSeconds; } return step.mode == StepMode.Timed ? step.timerSeconds : 0; } bool get countsDown { return seconds > 0; } bool get lastSet { return set >= step.sets; } }