Aitrainer_app 1.1.1
test menu, customer modification, exercise save images, localization
This commit is contained in:
@@ -19,7 +19,7 @@ class CustomerChangingViewModel extends ChangeNotifier {
|
||||
}
|
||||
|
||||
Future<void> saveCustomer() async {
|
||||
this.customer = customer;
|
||||
//this.customer = customer;
|
||||
final Customer modelCustomer = customer.getCustomer();
|
||||
await CustomerApi().saveCustomer(modelCustomer);
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ class CustomerViewModel {
|
||||
return this.customer.sex == "m" ? "Man" : "Woman";
|
||||
}
|
||||
|
||||
int get age {
|
||||
return this.customer.age;
|
||||
int get birthYear {
|
||||
return this.birthYear;
|
||||
}
|
||||
|
||||
setName(String name) {
|
||||
@@ -29,18 +29,39 @@ class CustomerViewModel {
|
||||
this.customer.firstName = firstName;
|
||||
}
|
||||
|
||||
setPassword( String password ) {
|
||||
this.customer.password = password;
|
||||
}
|
||||
|
||||
setEmail(String email) {
|
||||
this.customer.email = email;
|
||||
}
|
||||
|
||||
setAge(int age) {
|
||||
this.customer.age = age;
|
||||
}
|
||||
|
||||
setSex(String sex) {
|
||||
this.customer.sex = sex;
|
||||
}
|
||||
|
||||
setWeight( int weight) {
|
||||
this.customer.weight = weight;
|
||||
}
|
||||
|
||||
setBirthYear( int birthYear ) {
|
||||
this.customer.birthYear = birthYear;
|
||||
}
|
||||
|
||||
setFitnessLevel( String level ) {
|
||||
this.customer.fitnessLevel = level;
|
||||
}
|
||||
|
||||
setGoal( String goal ) {
|
||||
this.customer.goal = goal;
|
||||
}
|
||||
|
||||
setBodyType(String bodyType) {
|
||||
this.customer.bodyType = bodyType;
|
||||
}
|
||||
|
||||
createNew() {
|
||||
this.customer = Customer();
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'exercise_view_model.dart';
|
||||
class ExerciseChangingViewModel with ChangeNotifier {
|
||||
Customer customer;
|
||||
ExerciseType exerciseType;
|
||||
List<ExerciseViewModel> exerciseList = List<ExerciseViewModel>();
|
||||
|
||||
ExerciseViewModel exerciseViewModel = ExerciseViewModel();
|
||||
|
||||
@@ -20,10 +21,12 @@ class ExerciseChangingViewModel with ChangeNotifier {
|
||||
|
||||
setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
setExerciseType( ExerciseType exerciseType) {
|
||||
this.exerciseType = exerciseType;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
setQuantity(int quantity) {
|
||||
@@ -31,7 +34,7 @@ class ExerciseChangingViewModel with ChangeNotifier {
|
||||
}
|
||||
|
||||
addExercise() async {
|
||||
this.exerciseViewModel = exerciseViewModel;
|
||||
// this.exerciseViewModel = exerciseViewModel;
|
||||
final Exercise modelExercise = exerciseViewModel.getExercise();
|
||||
modelExercise.customerId = this.customer.customerId;
|
||||
modelExercise.exerciseTypeId = this.exerciseType.exerciseTypeId;
|
||||
@@ -43,4 +46,11 @@ class ExerciseChangingViewModel with ChangeNotifier {
|
||||
exerciseViewModel.createNew();
|
||||
}
|
||||
|
||||
Future<List<ExerciseViewModel>> getExercisesByCustomer( int customerId ) async {
|
||||
final results = await ExerciseApi().getExercisesByCustomer(customerId);
|
||||
this.exerciseList = results.map((item) => ExerciseViewModel(exercise: item)).toList();
|
||||
notifyListeners();
|
||||
return this.exerciseList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,15 +6,23 @@ class ExerciseViewModel {
|
||||
|
||||
createNew() {
|
||||
this.exercise = Exercise();
|
||||
exercise.datetimeExercise = DateTime.now();
|
||||
exercise.dateAdd = DateTime.now();
|
||||
}
|
||||
|
||||
setQuantity(int quantity) {
|
||||
setQuantity(double quantity) {
|
||||
this.exercise.quantity = quantity;
|
||||
}
|
||||
|
||||
setUnitQuantity(double unitQuantity) {
|
||||
this.exercise.unitQuantity = unitQuantity;
|
||||
}
|
||||
|
||||
setUnit( String unit) {
|
||||
this.exercise.unit = unit;
|
||||
}
|
||||
|
||||
setDatetimeExercise(DateTime datetimeExercise) {
|
||||
this.exercise.datetimeExercise = datetimeExercise;
|
||||
this.exercise.dateAdd = datetimeExercise;
|
||||
}
|
||||
|
||||
Exercise getExercise() {
|
||||
|
||||
Reference in New Issue
Block a user