Merge ssh://git.aitrainer.app:6622/bossanyit/aitrainer_app
This commit is contained in:
@@ -8,6 +8,7 @@ import 'package:aitrainer_app/repository/customer_repository.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flurry/flurry.dart';
|
||||
import 'package:flutter/animation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
||||
@@ -266,6 +267,8 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
|
||||
customerRepository.saveCustomer();
|
||||
changedWeight = false;
|
||||
this.changedSizes = false;
|
||||
Cache().initBadges();
|
||||
Flurry.logEvent("Sizes");
|
||||
yield ExerciseNewReady();
|
||||
} else if (event is ExerciseNewSizeChange) {
|
||||
yield ExerciseNewLoading();
|
||||
@@ -277,6 +280,8 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
|
||||
yield ExerciseNewLoading();
|
||||
await exerciseRepository.addExercise();
|
||||
menuBloc.add(MenuTreeDown(parent: 0));
|
||||
Cache().initBadges();
|
||||
Flurry.logEvent("newExercise");
|
||||
yield ExerciseNewReady();
|
||||
} else if (event is ExerciseNewBMIAnimate) {
|
||||
yield ExerciseNewLoading();
|
||||
@@ -288,7 +293,7 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
|
||||
}
|
||||
|
||||
double getBMI() {
|
||||
if (height == 0) {
|
||||
if (height == 0 || weight == 0) {
|
||||
this.bmi = 0;
|
||||
return 0;
|
||||
}
|
||||
@@ -299,6 +304,10 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
|
||||
|
||||
double getBMR() {
|
||||
var date = DateTime.now();
|
||||
if (height == 0 || weight == 0) {
|
||||
this.bmi = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int year = int.parse(DateFormat(DateFormat.YEAR).format(date));
|
||||
|
||||
@@ -334,14 +343,15 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
|
||||
this.bmiLeft = 72;
|
||||
bmiAngle = -62;
|
||||
} else if (bmi < 25 && 18.5 < bmi) {
|
||||
goalBMI = bmi;
|
||||
goalBMI = 27;
|
||||
this.bmiTop = 46;
|
||||
this.bmiLeft = 130;
|
||||
bmiAngle = -21;
|
||||
bmiAngle = -23;
|
||||
} else if (bmi < 30 && 24.9 < bmi) {
|
||||
goalBMI = 24;
|
||||
this.bmiTop = 38.0;
|
||||
this.bmiLeft = 186.0;
|
||||
bmiAngle = 7.2;
|
||||
} else if (bmi < 34.9 && 29.9 < bmi) {
|
||||
goalBMI = 29;
|
||||
bmiTop = 48;
|
||||
|
||||
Reference in New Issue
Block a user