wt1.1.2 new treeview, bar chart for muscle development
This commit is contained in:
+54
-46
@@ -4,7 +4,7 @@ import 'package:aitrainer_app/model/exercise_plan.dart';
|
||||
import 'package:aitrainer_app/model/exercise_plan_detail.dart';
|
||||
import 'package:aitrainer_app/model/exercise_tree.dart';
|
||||
import 'package:aitrainer_app/model/exercise.dart';
|
||||
import 'package:aitrainer_app/model/workout_tree.dart';
|
||||
import 'package:aitrainer_app/model/workout_menu_tree.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/service/exercise_tree_service.dart';
|
||||
import 'package:aitrainer_app/service/exercisetype_service.dart';
|
||||
@@ -59,9 +59,10 @@ class Cache {
|
||||
|
||||
List<Exercise> _exercises;
|
||||
ExercisePlan _myExercisePlan;
|
||||
List<ExercisePlanDetail> _myExercisesPlanDetail;
|
||||
|
||||
LinkedHashMap _tree = LinkedHashMap<String, WorkoutTree>();
|
||||
LinkedHashMap<int, ExercisePlanDetail> _myExercisesPlanDetails = LinkedHashMap<int, ExercisePlanDetail>();
|
||||
|
||||
LinkedHashMap _tree = LinkedHashMap<String, WorkoutMenuTree>();
|
||||
double _percentExercises = -1;
|
||||
|
||||
Customer _trainee;
|
||||
@@ -178,56 +179,63 @@ class Cache {
|
||||
this._exercisesTrainee = exercises;
|
||||
}
|
||||
|
||||
void setWorkoutTree( LinkedHashMap<String, WorkoutTree> tree) {
|
||||
void setWorkoutMenuTree( LinkedHashMap<String, WorkoutMenuTree> tree) {
|
||||
this._tree = tree;
|
||||
}
|
||||
|
||||
List<ExerciseType> getExerciseTypes() {
|
||||
return this._exerciseTypes;
|
||||
List<ExerciseType> getExerciseTypes() => this._exerciseTypes;
|
||||
|
||||
List<ExerciseTree> getExerciseTree() => this._exerciseTree;
|
||||
|
||||
List<Exercise> getExercises() => this._exercises;
|
||||
|
||||
List<Exercise> getExercisesTrainee() => this._exercisesTrainee;
|
||||
|
||||
LinkedHashMap<String, WorkoutMenuTree> getWorkoutMenuTree() => this._tree;
|
||||
|
||||
void setPercentExercises(double percent) => this._percentExercises = percent;
|
||||
|
||||
double getPercentExercises() => this._percentExercises;
|
||||
|
||||
void addExercise(Exercise exercise) => _exercises.add(exercise);
|
||||
|
||||
void addExerciseTrainee(Exercise exercise) => _exercisesTrainee.add(exercise);
|
||||
|
||||
Customer getTrainee() => this._trainee;
|
||||
|
||||
void setTrainee(Customer trainee) => _trainee = trainee;
|
||||
|
||||
void setTraineeExercisePlan(ExercisePlan exercisePlan) => this._traineeExercisePlan = exercisePlan;
|
||||
|
||||
ExercisePlan getTraineesExercisePlan() => this._traineeExercisePlan;
|
||||
|
||||
void setMyExercisePlan(ExercisePlan exercisePlan) => _myExercisePlan = exercisePlan;
|
||||
|
||||
ExercisePlan getMyExercisePlan() => _myExercisePlan;
|
||||
|
||||
void setMyExercisePlanDetails(LinkedHashMap<int, ExercisePlanDetail> listExercisePlanDetail)
|
||||
=> _myExercisesPlanDetails = listExercisePlanDetail;
|
||||
|
||||
void addToMyExercisePlanDetails(ExercisePlanDetail detail) => _myExercisesPlanDetails[detail.exerciseTypeId] = detail;
|
||||
|
||||
LinkedHashMap<int, ExercisePlanDetail> getMyExercisePlanDetails() => _myExercisesPlanDetails;
|
||||
|
||||
void resetMyExercisePlanDetails() => _myExercisesPlanDetails = LinkedHashMap<int, ExercisePlanDetail>();
|
||||
|
||||
void updateMyExercisePlanDetail(ExercisePlanDetail detail) {
|
||||
this.addToMyExercisePlanDetails(detail);
|
||||
}
|
||||
|
||||
List<ExerciseTree> getExerciseTree() {
|
||||
return this._exerciseTree;
|
||||
void deleteMyExercisePlanDetail(ExercisePlanDetail detail)
|
||||
=> this.deleteMyExercisePlanDetailByExerciseTypeId(detail.exerciseTypeId);
|
||||
|
||||
void deletedMyExercisePlanDetail(ExercisePlanDetail detail)
|
||||
=> this._myExercisesPlanDetails[detail.exerciseTypeId].change = ExercisePlanDetailChange.deleted;
|
||||
|
||||
void deleteMyExercisePlanDetailByExerciseTypeId(int exerciseTypeId) {
|
||||
this._myExercisesPlanDetails[exerciseTypeId].change = ExercisePlanDetailChange.delete;
|
||||
}
|
||||
|
||||
List<Exercise> getExercises() {
|
||||
return this._exercises;
|
||||
}
|
||||
|
||||
List<Exercise> getExercisesTrainee() {
|
||||
return this._exercisesTrainee;
|
||||
}
|
||||
|
||||
LinkedHashMap<String, WorkoutTree> getWorkoutTree() {
|
||||
return this._tree;
|
||||
}
|
||||
|
||||
void setPercentExercises(double percent) {
|
||||
this._percentExercises = percent;
|
||||
}
|
||||
|
||||
double getPercentExercises() {
|
||||
return this._percentExercises;
|
||||
}
|
||||
|
||||
void addExercise(Exercise exercise) {
|
||||
_exercises.add(exercise);
|
||||
}
|
||||
|
||||
void addExerciseTrainee(Exercise exercise) {
|
||||
_exercisesTrainee.add(exercise);
|
||||
}
|
||||
|
||||
Customer getTrainee() {
|
||||
return this._trainee;
|
||||
}
|
||||
|
||||
void setTrainee(Customer trainee) {
|
||||
this._trainee = trainee;
|
||||
}
|
||||
|
||||
void setTraineeExercisePlan(ExercisePlan exercisePlan) {
|
||||
this._traineeExercisePlan = exercisePlan;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:aitrainer_app/util/common.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class Exercise {
|
||||
@@ -10,6 +11,8 @@ class Exercise {
|
||||
DateTime dateAdd;
|
||||
int exercisePlanDetailId;
|
||||
|
||||
String datePart;
|
||||
|
||||
|
||||
|
||||
Exercise({this.exerciseTypeId, this.customerId, this.quantity, this.dateAdd});
|
||||
@@ -21,6 +24,7 @@ class Exercise {
|
||||
this.unit = json['unit'];
|
||||
this.unitQuantity = json['unitQuantity'];
|
||||
this.dateAdd = DateTime.parse( json['dateAdd'] );
|
||||
this.datePart = DateFormat('yyyy-MM-dd').format(this.dateAdd);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() =>
|
||||
@@ -33,4 +37,16 @@ class Exercise {
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd),
|
||||
"exercisePlanDetailId": exercisePlanDetailId,
|
||||
};
|
||||
|
||||
Exercise copy() {
|
||||
Exercise newExercise = Exercise();
|
||||
newExercise.exerciseTypeId = this.exerciseTypeId;
|
||||
newExercise.customerId = this.customerId;
|
||||
newExercise.quantity = this.quantity;
|
||||
newExercise.unit = this.unit;
|
||||
newExercise.unitQuantity = this.unitQuantity;
|
||||
newExercise.dateAdd = this.dateAdd;
|
||||
newExercise.exercisePlanDetailId = this.exercisePlanDetailId;
|
||||
return newExercise;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
import 'package:aitrainer_app/model/exercise_plan.dart';
|
||||
|
||||
import 'exercise_type.dart';
|
||||
|
||||
class ExercisePlanDetailChange {
|
||||
static const String add = "add";
|
||||
static const String delete = "delete";
|
||||
static const String update = "update";
|
||||
static const String deleted = "deleted";
|
||||
}
|
||||
|
||||
class ExercisePlanDetail {
|
||||
int exercisePlanDetailId;
|
||||
int exercisePlanId;
|
||||
@@ -11,6 +16,7 @@ class ExercisePlanDetail {
|
||||
String weightEquation;
|
||||
|
||||
ExerciseType exerciseType;
|
||||
String change; // 1: update -1:delete 0: new
|
||||
|
||||
ExercisePlanDetail(int exerciseTypeId) {
|
||||
this.exerciseTypeId = exerciseTypeId;
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'dart:ui';
|
||||
|
||||
import 'exercise_type.dart';
|
||||
|
||||
class WorkoutTree {
|
||||
class WorkoutMenuTree {
|
||||
int id;
|
||||
int parent;
|
||||
String name;
|
||||
@@ -20,7 +20,7 @@ class WorkoutTree {
|
||||
String exerciseDetail;
|
||||
String nameEnglish;
|
||||
|
||||
WorkoutTree(this.id, this.parent, this.name, this.imageName, this.color, this.fontSize, this.child,
|
||||
WorkoutMenuTree(this.id, this.parent, this.name, this.imageName, this.color, this.fontSize, this.child,
|
||||
this.exerciseTypeId, this.exerciseType, this.base, this.is1RM, this.nameEnglish);
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
Reference in New Issue
Block a user