WT1.1.8+3 custom plan and training plan fixes

This commit is contained in:
bossanyit
2021-06-02 17:25:35 +02:00
parent 2b206fff49
commit d5deaf48a9
24 changed files with 1561 additions and 614 deletions
@@ -1,4 +1,5 @@
import 'dart:async';
import 'package:aitrainer_app/model/cache.dart';
import 'package:aitrainer_app/model/exercise_plan_detail.dart';
import 'package:aitrainer_app/model/model_change.dart';
import 'package:aitrainer_app/model/workout_menu_tree.dart';
@@ -29,6 +30,7 @@ class ExercisePlanBloc extends Bloc<ExercisePlanEvent, ExercisePlanState> {
menuTreeRepository.sortByMuscleType();
menuTreeRepository.sortedTree.forEach((key, value) {
print("menutree $key");
List<WorkoutMenuTree> listWorkoutTree = value;
listWorkoutTree.forEach((workoutTree) {
workoutTree.selected = false;
@@ -48,9 +50,13 @@ class ExercisePlanBloc extends Bloc<ExercisePlanEvent, ExercisePlanState> {
Stream<ExercisePlanState> mapEventToState(ExercisePlanEvent event) async* {
try {
if (event is ExercisePlanLoad) {
if (Cache().userLoggedIn == null || Cache().userLoggedIn!.customerId == null) {
throw Exception("Please log in");
}
yield ExercisePlanLoading();
Track().track(TrackingEvent.my_custom_exercise_plan);
customerId = Cache().userLoggedIn!.customerId!;
await this.getData();
Track().track(TrackingEvent.my_custom_exercise_plan);
yield ExercisePlanReady();
}