WT1.1.2g Sizes

This commit is contained in:
bossanyit
2020-11-17 17:51:54 +01:00
parent e28f1edf50
commit b71544ba13
7 changed files with 230 additions and 246 deletions
+62 -49
View File
@@ -38,8 +38,11 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
final List<Property> womanSizes = List();
final List<Property> manSizes = List();
final double baseWidth = 312;
final double baseHeight = 675.2;
double mediaWidth = 0;
double mediaHeight = 0;
bool isMan = true;
@override
ExerciseNewBloc({this.exerciseRepository, this.menuBloc, this.customerRepository, ExerciseType exerciseType})
@@ -52,6 +55,8 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
weight = customerRepository.customer.getProperty("Weight");
height = customerRepository.customer.getProperty("Height");
fitnessLevel = customerRepository.customer.fitnessLevel;
this.isMan = (customerRepository.customer.sex == "m");
print("Sex Man? " + isMan.toString() + " " + customerRepository.customer.sex);
}
}
@@ -63,66 +68,72 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
void addSizes(String sex) {
List<Property> properties = Cache().getProperties();
if (sex == "Man") {
if (properties == null) {
return;
}
final double distortionWidth = mediaWidth / baseWidth;
final double distortionHeight = mediaHeight / baseHeight;
print("distiortionW " + distortionWidth.toString() + " dH " + distortionHeight.toString());
if (isMan) {
properties.forEach((element) {
if (element.propertyName == "Shoulder") {
element.top = (mediaHeight * 0.131).toInt();
element.left = (mediaWidth * 0.23).toInt();
element.top = (122 * distortionHeight).toInt();
element.left = (130 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Shoulder");
manSizes.add(element);
} else if (element.propertyName == "Neck") {
element.top = (mediaHeight * 0.069).toInt();
element.left = (mediaWidth * 0.23).toInt();
element.top = (68 * distortionHeight).toInt();
element.left = (130 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Neck");
manSizes.add(element);
} else if (element.propertyName == "Biceps") {
element.top = (mediaHeight * 0.199).toInt();
element.left = (mediaWidth * 0.44).toInt();
element.top = (178 * distortionHeight).toInt();
element.left = (208 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Biceps");
manSizes.add(element);
} else if (element.propertyName == "Chest") {
element.top = (mediaHeight * 0.171).toInt();
element.left = (mediaWidth * 0.23).toInt();
element.top = (154 * distortionHeight).toInt();
element.left = (130 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Chest");
manSizes.add(element);
} else if (element.propertyName == "Belly") {
element.top = (mediaHeight * 0.275).toInt();
element.left = (mediaWidth * 0.23).toInt();
element.top = (244 * distortionHeight).toInt();
element.left = (130 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Belly");
manSizes.add(element);
} else if (element.propertyName == "Hip") {
element.top = (mediaHeight * 0.355).toInt();
element.left = (mediaWidth * 0.23).toInt();
element.top = (308 * distortionHeight).toInt();
element.left = (130 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Hip");
manSizes.add(element);
} else if (element.propertyName == "Thigh Top") {
element.top = (mediaHeight * 0.38).toInt();
element.left = (mediaWidth * 0.32).toInt();
element.top = (332 * distortionHeight).toInt();
element.left = (165 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Thigh Top");
manSizes.add(element);
} else if (element.propertyName == "Thigh Middle") {
element.top = (mediaHeight * 0.438).toInt();
element.left = (mediaWidth * 0.14).toInt();
element.top = (382 * distortionHeight).toInt();
element.left = (100 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Thigh Middle");
manSizes.add(element);
} else if (element.propertyName == "Knee") {
element.top = (mediaHeight * 0.535).toInt();
element.left = (mediaWidth * 0.14).toInt();
element.top = (464 * distortionHeight).toInt();
element.left = (97 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Knee");
manSizes.add(element);
} else if (element.propertyName == "Calf") {
element.top = (mediaHeight * 0.60).toInt();
element.left = (mediaWidth * 0.14).toInt();
element.top = (520 * distortionHeight).toInt();
element.left = (97 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Calf");
manSizes.add(element);
} else if (element.propertyName == "Ankle") {
element.top = (mediaHeight * 0.72).toInt();
element.left = (mediaWidth * 0.28).toInt();
element.top = (620 * distortionHeight).toInt();
element.left = (150 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Ankle");
manSizes.add(element);
} else if (element.propertyName == "Weight") {
element.top = (mediaHeight * 0.44).toInt();
element.left = (mediaWidth * 0.54).toInt();
element.top = (402 * distortionHeight).toInt();
element.left = (240 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Weight");
manSizes.add(element);
}
@@ -130,63 +141,65 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
} else {
properties.forEach((element) {
if (element.propertyName == "Shoulder") {
element.top = (mediaHeight * 0.131).toInt();
element.left = (mediaWidth * 0.195).toInt();
element.top = (122 * distortionHeight).toInt();
element.left = (151 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Shoulder");
print("CHEST top: " + element.top.toString() + " left " + element.left.toString());
manSizes.add(element);
} else if (element.propertyName == "Neck") {
element.top = (mediaHeight * 0.081).toInt();
element.left = (mediaWidth * 0.195).toInt();
element.top = (78 * distortionHeight).toInt();
element.left = (151 * distortionWidth).toInt();
print("Neck top: " + element.top.toString() + " left " + element.left.toString());
element.value = customerRepository.customer.getProperty("Neck");
manSizes.add(element);
} else if (element.propertyName == "Biceps") {
element.top = (mediaHeight * 0.199).toInt();
element.left = (mediaWidth * 0.36).toInt();
element.top = (178 * distortionHeight).toInt();
element.left = (212 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Biceps");
manSizes.add(element);
} else if (element.propertyName == "Chest") {
element.top = (mediaHeight * 0.168).toInt();
element.left = (mediaWidth * 0.195).toInt();
element.top = (154 * distortionHeight).toInt();
element.left = (151 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Chest");
manSizes.add(element);
} else if (element.propertyName == "Belly") {
element.top = (mediaHeight * 0.26).toInt();
element.left = (mediaWidth * 0.195).toInt();
element.top = (230 * distortionHeight).toInt();
element.left = (151 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Belly");
manSizes.add(element);
} else if (element.propertyName == "Hip") {
element.top = (mediaHeight * 0.335).toInt();
element.left = (mediaWidth * 0.195).toInt();
element.top = (294 * distortionHeight).toInt();
element.left = (151 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Hip");
manSizes.add(element);
} else if (element.propertyName == "Thigh Top") {
element.top = (mediaHeight * 0.385).toInt();
element.left = (mediaWidth * 0.28).toInt();
element.top = (335 * distortionHeight).toInt();
element.left = (185 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Thigh Top");
manSizes.add(element);
} else if (element.propertyName == "Thigh Middle") {
element.top = (mediaHeight * 0.433).toInt();
element.left = (mediaWidth * 0.12).toInt();
element.top = (377 * distortionHeight).toInt();
element.left = (125 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Thigh Middle");
manSizes.add(element);
} else if (element.propertyName == "Knee") {
element.top = (mediaHeight * 0.543).toInt();
element.left = (mediaWidth * 0.14).toInt();
element.top = (468 * distortionHeight).toInt();
element.left = (129 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Knee");
manSizes.add(element);
} else if (element.propertyName == "Calf") {
element.top = (mediaHeight * 0.608).toInt();
element.left = (mediaWidth * 0.14).toInt();
element.top = (525 * distortionHeight).toInt();
element.left = (129 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Calf");
manSizes.add(element);
} else if (element.propertyName == "Ankle") {
element.top = (mediaHeight * 0.725).toInt();
element.left = (mediaWidth * 0.23).toInt();
element.top = (620 * distortionHeight).toInt();
element.left = (162 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Ankle");
manSizes.add(element);
} else if (element.propertyName == "Weight") {
element.top = (mediaHeight * 0.44).toInt();
element.left = (mediaWidth * 0.54).toInt();
element.top = (402 * distortionHeight).toInt();
element.left = (240 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Weight");
manSizes.add(element);
}