WT1.1.5 In-app-purchase

This commit is contained in:
bossanyit
2021-01-24 14:34:13 +01:00
parent d44fefe9af
commit 71efd3f349
52 changed files with 847 additions and 367 deletions
+26 -5
View File
@@ -31,11 +31,15 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> with Logg
double bmr = 0;
double goalBMI = 0;
double goalWeight = 0;
double goalMilestoneBMI = 0;
double goalMilestoneWeight = 0;
double bmiAngle = 0;
double bmiTop = 0;
double bmiLeft = 0;
double weight;
double height;
double bmrEnergy = 0;
int birthYear;
String fitnessLevel;
bool changedWeight = false;
bool changedSizes = false;
@@ -66,6 +70,7 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> with Logg
customerRepository.customer = Cache().userLoggedIn;
weight = customerRepository.customer.getProperty("Weight");
height = customerRepository.customer.getProperty("Height");
birthYear = customerRepository.customer.birthYear;
fitnessLevel = customerRepository.customer.fitnessLevel;
this.isMan = (customerRepository.customer.sex == "m");
}
@@ -315,6 +320,7 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> with Logg
changedWeight = true;
weight = event.value;
getBMI();
getGoalBMI();
getBMR();
yield ExerciseNewReady();
} else if (event is ExerciseNewFitnessLevelChange) {
@@ -324,12 +330,20 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> with Logg
changedWeight = true;
getBMR();
yield ExerciseNewReady();
} else if (event is ExerciseNewBirthyearChange) {
yield ExerciseNewLoading();
changedWeight = true;
customerRepository.setBirthYear(event.value.toInt());
birthYear = event.value;
getBMR();
yield ExerciseNewReady();
} else if (event is ExerciseNewHeightChange) {
yield ExerciseNewLoading();
customerRepository.setHeight(event.value.toInt());
changedWeight = true;
height = event.value;
getBMI();
getGoalBMI();
getBMR();
yield ExerciseNewReady();
} else if (event is ExerciseNewSaveWeight) {
@@ -390,6 +404,7 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> with Logg
//BMR = 655.1 + ( 9.563 × ömeg kg-ban ) + ( 1.85 × magasság cm-ben) ( 4.676 × életkor évben kifejezve )
bmr = 655.1 + (9.563 * weight) + (1.85 * height) - (4.676 * (year - customerRepository.customer.birthYear));
}
bmrEnergy = bmr;
if (customerRepository.customer.fitnessLevel == FitnessState.beginner) {
bmr *= 1.2;
@@ -424,32 +439,38 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> with Logg
this.bmiAngle = (bmi * 90 / 25) - 90;
if (bmi < 18.5) {
goalBMI = 19;
goalMilestoneBMI = 19;
goalBMI = 21.75;
this.bmiTop = 99 * distortionHeight;
this.bmiLeft = 77 * distortionWidth;
bmiAngle = -62;
} else if (bmi > 18.5 && bmi < 25) {
goalBMI = this.bmi;
goalBMI = 21.75;
goalMilestoneBMI = 21.75;
this.bmiTop = 48 * distortionHeight;
this.bmiLeft = 130 * distortionWidth;
bmiAngle = -23;
} else if (bmi < 30 && bmi > 24.9) {
goalBMI = 24;
goalMilestoneBMI = 24;
goalBMI = 21.75;
this.bmiTop = 40.0 * distortionHeight;
this.bmiLeft = 184.0 * distortionWidth;
bmiAngle = 7.2;
} else if (bmi < 34.9 && 29.9 < bmi) {
goalBMI = 29;
goalMilestoneBMI = 29;
goalBMI = 24;
bmiTop = 48 * distortionHeight;
bmiLeft = 211 * distortionWidth;
} else if (bmi > 35) {
goalBMI = 34;
goalMilestoneBMI = 34;
goalBMI = 24;
bmiTop = 94 * distortionHeight;
bmiLeft = 260 * distortionWidth;
bmiAngle = 59;
}
this.goalWeight = goalBMI * (height * height / 10000);
this.goalMilestoneWeight = goalMilestoneBMI * (height * height / 10000);
//print("Angle: " + bmiAngle.toStringAsFixed(1));
@@ -28,6 +28,13 @@ class ExerciseNewQuantityUnitChange extends ExerciseNewEvent {
List<Object> get props => [quantity];
}
class ExerciseNewBirthyearChange extends ExerciseNewEvent {
final int value;
const ExerciseNewBirthyearChange({this.value});
@override
List<Object> get props => [value];
}
class ExerciseNewWeightChange extends ExerciseNewEvent {
final double value;
const ExerciseNewWeightChange({this.value});