WT1.1.2h getProperty fix
This commit is contained in:
@@ -15,7 +15,7 @@ class Antagonist {
|
||||
static String biceps = "Biceps";
|
||||
static int bicepsNr = 2;
|
||||
static String triceps = "Triceps";
|
||||
static int tricepsNr =3;
|
||||
static int tricepsNr = 3;
|
||||
static String back = "Back";
|
||||
static int backNr = 4;
|
||||
static String shoulder = "Shoulders";
|
||||
@@ -44,30 +44,29 @@ class WorkoutTreeRepository {
|
||||
Antagonist.calf: Antagonist.calfNr
|
||||
};
|
||||
|
||||
|
||||
Future<void> createTree() async {
|
||||
|
||||
isEnglish = AppLanguage().appLocal == Locale('en');
|
||||
print("** Start creating tree on lang: " + AppLanguage().appLocal.languageCode);
|
||||
|
||||
List<ExerciseTree> exerciseTree = Cache().getExerciseTree();
|
||||
if ( exerciseTree == null || exerciseTree.length == 0) {
|
||||
if (exerciseTree == null || exerciseTree.length == 0) {
|
||||
await ExerciseTreeApi().getExerciseTree();
|
||||
}
|
||||
|
||||
exerciseTree.forEach( (treeItem) async {
|
||||
exerciseTree.forEach((treeItem) async {
|
||||
String treeName = isEnglish ? treeItem.name : treeItem.nameTranslation;
|
||||
String assetImage = 'asset/menu/' + treeItem.imageUrl.substring(7);
|
||||
bool is1RM = treeItem.name == 'One Rep Max' ? true : false;
|
||||
if ( is1RM == false && treeItem.parentId != 0) {
|
||||
if (is1RM == false && treeItem.parentId != 0) {
|
||||
is1RM = isParent1RM(treeItem.parentId);
|
||||
}
|
||||
this.tree[treeItem.name] = WorkoutMenuTree(
|
||||
treeItem.treeId,
|
||||
treeItem.parentId,
|
||||
treeName,
|
||||
assetImage, Colors.white,
|
||||
24,
|
||||
assetImage,
|
||||
Colors.white,
|
||||
20,
|
||||
false,
|
||||
0,
|
||||
null,
|
||||
@@ -78,30 +77,17 @@ class WorkoutTreeRepository {
|
||||
});
|
||||
|
||||
List<ExerciseType> exerciseTypes = Cache().getExerciseTypes();
|
||||
if ( exerciseTypes == null || exerciseTypes.length == 0) {
|
||||
if (exerciseTypes == null || exerciseTypes.length == 0) {
|
||||
await ExerciseTypeApi().getExerciseTypes();
|
||||
}
|
||||
|
||||
exerciseTypes.forEach( (exerciseType) {
|
||||
String exerciseTypeName = isEnglish ?
|
||||
exerciseType.name : exerciseType.nameTranslation;
|
||||
exerciseTypes.forEach((exerciseType) {
|
||||
String exerciseTypeName = isEnglish ? exerciseType.name : exerciseType.nameTranslation;
|
||||
String assetImage = 'asset/menu/' + exerciseType.imageUrl.substring(7);
|
||||
bool is1RM = this.isParent1RM(exerciseType.treeId);
|
||||
exerciseType.is1RM = is1RM;
|
||||
this.tree[exerciseType.name] = WorkoutMenuTree(
|
||||
exerciseType.exerciseTypeId,
|
||||
exerciseType.treeId,
|
||||
exerciseTypeName,
|
||||
assetImage,
|
||||
Colors.white,
|
||||
16,
|
||||
true,
|
||||
exerciseType.exerciseTypeId,
|
||||
exerciseType,
|
||||
exerciseType.base,
|
||||
is1RM,
|
||||
exerciseType.name
|
||||
);
|
||||
this.tree[exerciseType.name] = WorkoutMenuTree(exerciseType.exerciseTypeId, exerciseType.treeId, exerciseTypeName, assetImage,
|
||||
Colors.white, 16, true, exerciseType.exerciseTypeId, exerciseType, exerciseType.base, is1RM, exerciseType.name);
|
||||
});
|
||||
|
||||
Cache().setWorkoutMenuTree(tree);
|
||||
@@ -114,11 +100,10 @@ class WorkoutTreeRepository {
|
||||
|
||||
this.tree.forEach((key, value) {
|
||||
WorkoutMenuTree treeItem = value as WorkoutMenuTree;
|
||||
if ( treeItem.id == treeId ) {
|
||||
if (treeItem.id == treeId) {
|
||||
isTreeItem1RM = treeItem.is1RM;
|
||||
//print (treeItem.name + " 1RM " + treeItem.is1RM.toString() );
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return isTreeItem1RM;
|
||||
@@ -128,7 +113,7 @@ class WorkoutTreeRepository {
|
||||
LinkedHashMap branch = LinkedHashMap<String, WorkoutMenuTree>();
|
||||
tree.forEach((key, value) {
|
||||
WorkoutMenuTree workoutTree = value as WorkoutMenuTree;
|
||||
if ( parent == workoutTree.parent) {
|
||||
if (parent == workoutTree.parent) {
|
||||
branch[key] = value;
|
||||
}
|
||||
});
|
||||
@@ -139,7 +124,7 @@ class WorkoutTreeRepository {
|
||||
List branch = List<WorkoutMenuTree>();
|
||||
tree.forEach((key, value) {
|
||||
WorkoutMenuTree workoutTree = value as WorkoutMenuTree;
|
||||
if ( parent == workoutTree.parent) {
|
||||
if (parent == workoutTree.parent) {
|
||||
branch.add(workoutTree);
|
||||
}
|
||||
});
|
||||
@@ -150,7 +135,7 @@ class WorkoutTreeRepository {
|
||||
WorkoutMenuTree parentItem;
|
||||
tree.forEach((key, value) {
|
||||
WorkoutMenuTree workoutTree = value as WorkoutMenuTree;
|
||||
if ( parent == workoutTree.id) {
|
||||
if (parent == workoutTree.id) {
|
||||
parentItem = workoutTree;
|
||||
}
|
||||
});
|
||||
@@ -161,7 +146,7 @@ class WorkoutTreeRepository {
|
||||
sortedTree = SplayTreeMap<String, List<WorkoutMenuTree>>();
|
||||
tree.forEach((key, value) {
|
||||
WorkoutMenuTree workoutTree = value as WorkoutMenuTree;
|
||||
if ( workoutTree.nameEnglish != 'One Rep Max' && workoutTree.is1RM && workoutTree.exerciseTypeId == 0) {
|
||||
if (workoutTree.nameEnglish != 'One Rep Max' && workoutTree.is1RM && workoutTree.exerciseTypeId == 0) {
|
||||
String treeName = _antagonist[workoutTree.nameEnglish].toString() + ". " + workoutTree.name;
|
||||
sortedTree[treeName] = this.getBranchList(workoutTree.id);
|
||||
}
|
||||
@@ -174,11 +159,10 @@ class WorkoutTreeRepository {
|
||||
int missingId = 0;
|
||||
tree.forEach((key, value) {
|
||||
WorkoutMenuTree item = value as WorkoutMenuTree;
|
||||
if ( item.name == name || name == item.nameEnglish ) {
|
||||
if (item.name == name || name == item.nameEnglish) {
|
||||
missingId = item.id;
|
||||
}
|
||||
});
|
||||
return missingId;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user