Aitrainer_app 1.1.1
test menu, customer modification, exercise save images, localization
This commit is contained in:
+17
-2
@@ -1,5 +1,7 @@
|
||||
import 'package:aitrainer_app/model/customer.dart';
|
||||
import 'package:aitrainer_app/service/exercisetype_service.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:aitrainer_app/model/exercise_type.dart';
|
||||
|
||||
enum SharePrefsChange {
|
||||
login,
|
||||
@@ -40,6 +42,7 @@ class Auth {
|
||||
String authToken = "";
|
||||
Customer userLoggedIn;
|
||||
bool firstLoad = true;
|
||||
List<ExerciseType> _exerciseTypes;
|
||||
|
||||
factory Auth() {
|
||||
return _singleton;
|
||||
@@ -79,6 +82,7 @@ class Auth {
|
||||
//firstLoad = true;
|
||||
Future<SharedPreferences> prefs = SharedPreferences.getInstance();
|
||||
setPreferences(prefs, SharePrefsChange.logout, 0);
|
||||
|
||||
}
|
||||
|
||||
setPreferences(Future<SharedPreferences> prefs,
|
||||
@@ -93,13 +97,24 @@ class Auth {
|
||||
sharedPreferences.setInt(Auth.customerIdKey, customerId);
|
||||
sharedPreferences.setBool(Auth.isRegisteredKey, true);
|
||||
sharedPreferences.setBool(Auth.isLoggedInKey, true);
|
||||
await ExerciseTypeApi().getExerciseTypes("");
|
||||
} else if ( type == SharePrefsChange.login ) {
|
||||
|
||||
sharedPreferences.setInt(Auth.customerIdKey, customerId);
|
||||
sharedPreferences.setBool(Auth.isLoggedInKey, true);
|
||||
} else if ( type == SharePrefsChange.login ) {
|
||||
await ExerciseTypeApi().getExerciseTypes("");
|
||||
} else if ( type == SharePrefsChange.logout ) {
|
||||
sharedPreferences.setBool(Auth.isLoggedInKey, false);
|
||||
sharedPreferences.setInt(Auth.customerIdKey, 0);
|
||||
//sharedPreferences.setInt(Auth.customerIdKey, 0);
|
||||
sharedPreferences.setString(authTokenKey, "");
|
||||
}
|
||||
}
|
||||
|
||||
void setExerciseTypes( List<ExerciseType> exerciseTypes) {
|
||||
this._exerciseTypes = exerciseTypes;
|
||||
}
|
||||
|
||||
List<ExerciseType> getExerciseTypes() {
|
||||
return this._exerciseTypes;
|
||||
}
|
||||
}
|
||||
+38
-3
@@ -7,18 +7,46 @@ class Customer {
|
||||
String active;
|
||||
int customerId;
|
||||
String password;
|
||||
int birthYear;
|
||||
int weight;
|
||||
String goal;
|
||||
String fitnessLevel;
|
||||
String bodyType;
|
||||
int admin;
|
||||
int dataPolicyAllowed;
|
||||
|
||||
|
||||
Customer({this.customerId, this.name, this.firstName, this.email, this.sex, this.age, this.active, this.password});
|
||||
Customer({this.customerId,
|
||||
this.name,
|
||||
this.firstName,
|
||||
this.email,
|
||||
this.sex,
|
||||
this.age,
|
||||
this.active,
|
||||
this.password,
|
||||
this.birthYear,
|
||||
this.bodyType,
|
||||
this.fitnessLevel,
|
||||
this.goal,
|
||||
this.weight,
|
||||
this.admin,
|
||||
this.dataPolicyAllowed
|
||||
});
|
||||
|
||||
Customer.fromJson(Map json) {
|
||||
this.customerId = json['customer_id'];
|
||||
this.customerId = json['customerId'];
|
||||
this.name = json['name'];
|
||||
this.firstName = json['firstname'];
|
||||
this.email = json['email'];
|
||||
this.sex = json['sex'];
|
||||
this.age = json['age'];
|
||||
this.active = json['active'];
|
||||
this.birthYear = json['birthYear'];
|
||||
this.bodyType = json['bodyType'];
|
||||
this.fitnessLevel = json['fitnessLevel'];
|
||||
this.goal = json['goal'];
|
||||
this.weight = json['weight'];
|
||||
this.admin = json['admin'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() =>
|
||||
@@ -30,5 +58,12 @@ class Customer {
|
||||
"sex": sex,
|
||||
"active": 'Y',
|
||||
"password": password,
|
||||
"birthYear": birthYear,
|
||||
"bodyType": bodyType,
|
||||
"fitnessLevel": fitnessLevel,
|
||||
"goal": goal,
|
||||
"weight": weight,
|
||||
"admin": admin,
|
||||
"dataPolicyAllowed": dataPolicyAllowed,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+11
-6
@@ -4,18 +4,22 @@ class Exercise {
|
||||
int exerciseId;
|
||||
int exerciseTypeId;
|
||||
int customerId;
|
||||
int quantity;
|
||||
DateTime datetimeExercise;
|
||||
double quantity;
|
||||
String unit;
|
||||
double unitQuantity;
|
||||
DateTime dateAdd;
|
||||
|
||||
|
||||
|
||||
Exercise({this.exerciseTypeId, this.customerId, this.quantity, this.datetimeExercise});
|
||||
Exercise({this.exerciseTypeId, this.customerId, this.quantity, this.dateAdd});
|
||||
|
||||
Exercise.fromJson(Map json) {
|
||||
this.exerciseTypeId = json['exerciseTypeId'];
|
||||
this.customerId = json['customerId'];
|
||||
this.quantity = json['quantity'];
|
||||
this.datetimeExercise = json['datetimeExercise'];
|
||||
this.unit = json['unit'];
|
||||
this.unitQuantity = json['unitQuantity'];
|
||||
this.dateAdd = DateTime.parse( json['dateAdd'] );
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() =>
|
||||
@@ -23,7 +27,8 @@ class Exercise {
|
||||
"exerciseTypeId": exerciseTypeId,
|
||||
"customerId": customerId,
|
||||
"quantity": quantity,
|
||||
|
||||
"datetimeExercise": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.datetimeExercise),
|
||||
"unit": unit,
|
||||
"unitQuantity": unitQuantity,
|
||||
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd),
|
||||
};
|
||||
}
|
||||
@@ -5,6 +5,9 @@ class ExerciseType {
|
||||
String name;
|
||||
String description;
|
||||
BinaryCodec video;
|
||||
String unit;
|
||||
String unitQuantity;
|
||||
String unitQuantityUnit;
|
||||
|
||||
ExerciseType({this.name, this.description});
|
||||
|
||||
@@ -12,11 +15,17 @@ class ExerciseType {
|
||||
this.exerciseTypeId = json['exerciseTypeId'];
|
||||
this.name = json['name'];
|
||||
this.description = json['description'];
|
||||
this.unit = json['unit'];
|
||||
this.unitQuantity = json['unitQuantity'];
|
||||
this.unitQuantityUnit = json['unitQuantityUnit'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() =>
|
||||
{
|
||||
"name": name,
|
||||
"description": description,
|
||||
"unit": unit,
|
||||
"unitQuantity": unitQuantity,
|
||||
"unitQuantityUnit": unitQuantityUnit
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import 'dart:collection';
|
||||
import 'dart:ui';
|
||||
|
||||
class WorkoutTree {
|
||||
int id;
|
||||
int parent;
|
||||
String name; // is also the key
|
||||
String imageName;
|
||||
Color color;
|
||||
double fontSize;
|
||||
bool child;
|
||||
int exercise_type_id;
|
||||
|
||||
WorkoutTree(this.id, this.parent, this.name, this.imageName, this.color, this.fontSize, this.child, this.exercise_type_id);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user