moveToNextSection method
Implementation
Future<void> moveToNextSection(SetSectionIndex sectionIndex) async {
if (sectionIndex.sectionType == SectionType.rest) {
// 休憩の開始
_logger.i('start index: ${sectionIndex.set} ${sectionIndex.section}');
_eventController.add(RehabilitationEvent.startRestSection(sectionIndex));
state = state.copyWith(
currentSetSectionIndex: sectionIndex,
exercise: null,
);
// 休憩のスタート 終了イベントを待つ
_timerManager.start();
} else if (sectionIndex.sectionType == SectionType.exercise) {
// 次のメッツを計算する
final mets = await _calcNextExerciseMets.exec(
lastMets: state.prescription!.exerciseIntensity,
prescription: state.prescription!,
);
// 運動の取得
final exercise = await _selectExerciseFromMets.exec(mets: mets);
state = state.copyWith(
currentSetSectionIndex: sectionIndex,
exercise: exercise,
);
// 運動の開始
_logger.i(
'start index: ${sectionIndex.set} ${sectionIndex.section} exercise: $exercise');
_eventController.add(
RehabilitationEvent.startExerciseSection(sectionIndex, exercise));
}
}