wt1.1.2 new treeview, bar chart for muscle development

This commit is contained in:
Bossanyi Tibor
2020-09-27 18:42:28 +02:00
parent 4a193e085f
commit 89c06123d2
43 changed files with 2135 additions and 514 deletions
+6 -3
View File
@@ -21,12 +21,13 @@ class APIClient with Common {
'Content-Type': 'application/json',
'Authorization' : "Bearer " + authToken }
);
print(" ------------get response code: " + response.statusCode.toString());
if(response.statusCode == 200) {
return utf8.decode(response.bodyBytes);
} else if(response.statusCode == 404 ) {
throw NotFoundException(message: "Not Found");
} else {
throw Exception("Unable to perform HTTP request!");
throw Exception("Network Error, please try again later");
}
}
@@ -49,8 +50,9 @@ class APIClient with Common {
},
body: body,
);
String decodedResponse = utf8convert(response.body);
print(" ------------ response: " + decodedResponse);
print(" ------------post response code: " + response.statusCode.toString());
final String decodedResponse = utf8convert(response.body);
print(" ------------ response: $decodedResponse");
return decodedResponse;
}
@@ -59,6 +61,7 @@ class APIClient with Common {
try {
final body = '{"username":"$email", "password":"$password"}';
print("authentication with $email");
final response = await http.post(
uri,
headers: {
+4 -5
View File
@@ -1,4 +1,3 @@
import 'package:aitrainer_app/model/cache.dart';
import 'package:aitrainer_app/model/exercise_plan.dart';
import 'package:aitrainer_app/model/exercise_plan_detail.dart';
import 'package:aitrainer_app/util/not_found_exception.dart';
@@ -17,7 +16,7 @@ class ExercisePlanApi {
"exercise_plan",
body);
savedExercisePlan = ExercisePlan.fromJson(jsonDecode(responseBody));
Cache().setTraineeExercisePlan(savedExercisePlan);
} on Exception catch(e) {
throw new Exception(e.toString());
}
@@ -28,14 +27,14 @@ class ExercisePlanApi {
ExercisePlan exercisePlan,
int exercisePlanId) async {
String body = JsonEncoder().convert(exercisePlan.toJson());
print(" ===== saving exercisePlan $exercisePlan");
print(" ===== update exercisePlan $exercisePlan");
ExercisePlan updatedExercisePlan;
try {
final String responseBody = await _client.post(
"exercise_plan/" + exercisePlanId.toString(),
body);
updatedExercisePlan = ExercisePlan.fromJson(jsonDecode(responseBody));
Cache().setTraineeExercisePlan(updatedExercisePlan);
} on Exception catch(e) {
throw new Exception(e.toString());
}
@@ -44,7 +43,7 @@ class ExercisePlanApi {
Future<ExercisePlanDetail> saveExercisePlanDetail(ExercisePlanDetail exercisePlanDetail) async {
String body = JsonEncoder().convert(exercisePlanDetail.toJson());
print(" ===== update exercisePlanDetail $exercisePlanDetail");
print(" ===== save exercisePlanDetail $exercisePlanDetail");
ExercisePlanDetail savedExercisePlanDetail;
try {
final String responseBody = await _client.post(