Skip to main content

Workout Set State Data

Our WorkoutSetBloc maintains the WorkoutSetState which contains all the data you will need for basic workout settings or real-time workout set analytic results.

WorkoutSetState

class WorkoutSetState {
/// workoutItem, the workout set
final PoseItem? workoutItem;

/// totalSecondsAllowed, total seconds allowed for the workout set
final int? totalSecondsAllowed;

/// secondsLeft, seconds left for the workout set
final int? secondsLeft;

/// secondsUsed, seconds used for the workout set
/// getter to get the seconds used
int? get secondsUsed {
if (totalSecondsAllowed == null || secondsLeft == null) {
return null;
}
return totalSecondsAllowed! - (secondsLeft! < 0 ? 0 : secondsLeft!);
}

/// targetRepsToStart, target reps to start the workout set
final int? targetRepsToStart;

/// repsDone, reps done for the workout set
final int repsDone;

/// workoutSetStatus, the status of the workout set
final WorkoutSetStatus? workoutSetStatus;

/// readyCountDown, the ready count down for the workout set
final ReadyState? readyCountDown;

/// resumeCountDown, the ready count down for the workout set
final ResumeState? resumeCountDown;

/// repsLeft, reps left for the workout set
int? get repsLeft {
if (targetRepsToStart == null) {
return null;
}
return targetRepsToStart! - repsDone;
}

/// isShowDebugInfo, is show debug info for the workout set
final bool isShowDebugInfo;

/// autoStopSetWhenRepsFulfilled, is stop set after reps fulfilled for the workout set
/// if true, the workout set will stop after the reps fulfilled
/// if false, the workout set will stop after the time is up
/// default is false
final bool autoStopSetWhenRepsFulfilled;

/// isRepsFulfilled, is reps fulfilled for the workout set
final bool isRepsFulfilled;

/// Ready mode: in-frame ready or button ready
final ReadyMode readyMode;

....
}

PoseItem

only poseName is required when you pass the PoseItem in WorkoutSetSetup event.

class PoseItem {
final String poseName;
final String? imageUrl;

PoseItem({
required this.poseName,
this.imageUrl,
});