wt1.1.2e NumberPicker
This commit is contained in:
@@ -30,7 +30,8 @@ class ExercisePlanBloc extends Bloc<ExercisePlanEvent, ExercisePlanState> {
|
||||
listWorkoutTree.forEach((workoutTree) {
|
||||
workoutTree.selected = false;
|
||||
if (exercisePlanRepository.getExercisePlanDetailSize() > 0) {
|
||||
if (exercisePlanRepository.getExercisePlanDetailByExerciseId(workoutTree.exerciseTypeId) != null) {
|
||||
ExercisePlanDetail planDetail = exercisePlanRepository.getExercisePlanDetailByExerciseId(workoutTree.exerciseTypeId);
|
||||
if (planDetail != null && planDetail.change != ExercisePlanDetailChange.deleted) {
|
||||
workoutTree.selected = true;
|
||||
}
|
||||
}
|
||||
@@ -66,23 +67,22 @@ class ExercisePlanBloc extends Bloc<ExercisePlanEvent, ExercisePlanState> {
|
||||
ExercisePlanDetail planDetail = event.exercisePlanDetail;
|
||||
exercisePlanRepository.actualPlanDetail = planDetail;
|
||||
|
||||
/*if ( exercisePlanRepository.exercisePlanDetails[planDetail.exerciseTypeId] == null ) {
|
||||
print("Add plan detail " + planDetail.toJson().toString());
|
||||
exercisePlanRepository.actualPlanDetail.change = ExercisePlanDetailChange.add;
|
||||
} else {
|
||||
print("Update plan detail " + planDetail.toJson().toString());
|
||||
exercisePlanRepository.actualPlanDetail.change = ExercisePlanDetailChange.update;
|
||||
}
|
||||
exercisePlanRepository.addDetailToPlan();*/
|
||||
|
||||
if (exercisePlanRepository.getExercisePlanDetailSize() != 0) {
|
||||
await exercisePlanRepository.saveExercisePlan();
|
||||
}
|
||||
|
||||
this.menuTreeRepository.sortedTree.forEach((key, value) {
|
||||
List<WorkoutMenuTree> listTreeItem = value;
|
||||
listTreeItem.forEach((element) {
|
||||
if ( element.exerciseType.exerciseTypeId == planDetail.exerciseTypeId) {
|
||||
element.selected = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
yield ExercisePlanReady();
|
||||
}
|
||||
|
||||
|
||||
else if (event is ExercisePlanRemoveExercise) {
|
||||
yield ExercisePlanLoading();
|
||||
ExercisePlanDetail planDetail = event.exercisePlanDetail;
|
||||
@@ -101,6 +101,7 @@ class ExercisePlanBloc extends Bloc<ExercisePlanEvent, ExercisePlanState> {
|
||||
exercisePlanRepository.saveExercisePlan();
|
||||
}
|
||||
|
||||
|
||||
yield ExercisePlanReady();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user