Merge ssh://git.aitrainer.app:6622/bossanyit/aitrainer_app
merge ios related
This commit is contained in:
commit
ccda4c83f3
@ -114,5 +114,8 @@
|
|||||||
"Check":"Check",
|
"Check":"Check",
|
||||||
"1st Control Exercise:": "1st Control Exercise:",
|
"1st Control Exercise:": "1st Control Exercise:",
|
||||||
"2nd Control Exercise:": "2nd Control Exercise:",
|
"2nd Control Exercise:": "2nd Control Exercise:",
|
||||||
"3rd Control Exercise:": "3rd Control Exercise:"
|
"3rd Control Exercise:": "3rd Control Exercise:",
|
||||||
|
|
||||||
|
"My Development":"My Development",
|
||||||
|
"My Training Plan":"My Training Plan"
|
||||||
}
|
}
|
@ -113,5 +113,8 @@
|
|||||||
"Check":"Ellenőrzés",
|
"Check":"Ellenőrzés",
|
||||||
"1st Control Exercise:": "1. kontrollgyakorlat:",
|
"1st Control Exercise:": "1. kontrollgyakorlat:",
|
||||||
"2nd Control Exercise:": "2. kontrollgyakorlat:",
|
"2nd Control Exercise:": "2. kontrollgyakorlat:",
|
||||||
"3rd Control Exercise:": "3. kontrollgyakorlat:"
|
"3rd Control Exercise:": "3. kontrollgyakorlat:",
|
||||||
|
|
||||||
|
"My Development":"Fejlődésem",
|
||||||
|
"My Training Plan":"Edzéstervem"
|
||||||
}
|
}
|
@ -1,4 +1,3 @@
|
|||||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ class ExerciseControlFormBloc extends FormBloc<String, String> {
|
|||||||
final ExerciseRepository exerciseRepository;
|
final ExerciseRepository exerciseRepository;
|
||||||
int step = 1;
|
int step = 1;
|
||||||
final double percentToCalculate;
|
final double percentToCalculate;
|
||||||
|
final bool readonly;
|
||||||
|
|
||||||
final initialRMField = TextFieldBloc(
|
final initialRMField = TextFieldBloc(
|
||||||
);
|
);
|
||||||
@ -30,7 +31,7 @@ class ExerciseControlFormBloc extends FormBloc<String, String> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ExerciseControlFormBloc({this.exerciseRepository, this.percentToCalculate}) {
|
ExerciseControlFormBloc({this.exerciseRepository, this.percentToCalculate, this.readonly}) {
|
||||||
addFieldBlocs(fieldBlocs: [
|
addFieldBlocs(fieldBlocs: [
|
||||||
initialRMField,
|
initialRMField,
|
||||||
quantity1Field,
|
quantity1Field,
|
||||||
@ -49,25 +50,19 @@ class ExerciseControlFormBloc extends FormBloc<String, String> {
|
|||||||
|
|
||||||
quantity1Field.onValueChanges(onData: (previous, current) async* {
|
quantity1Field.onValueChanges(onData: (previous, current) async* {
|
||||||
exerciseRepository.setQuantity(current.valueToDouble);
|
exerciseRepository.setQuantity(current.valueToDouble);
|
||||||
|
exerciseRepository.setUnitQuantity(unitQuantity1Field.valueToDouble);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitQuantity1Field.onValueChanges(onData: (previous, current) async* {
|
|
||||||
exerciseRepository.setUnitQuantity(current.valueToDouble);
|
|
||||||
});
|
|
||||||
quantity2Field.onValueChanges(onData: (previous, current) async* {
|
quantity2Field.onValueChanges(onData: (previous, current) async* {
|
||||||
exerciseRepository.setQuantity(current.valueToDouble);
|
exerciseRepository.setQuantity(current.valueToDouble);
|
||||||
|
exerciseRepository.setUnitQuantity(unitQuantity2Field.valueToDouble);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitQuantity2Field.onValueChanges(onData: (previous, current) async* {
|
|
||||||
exerciseRepository.setUnitQuantity(current.valueToDouble);
|
|
||||||
});
|
|
||||||
quantity3Field.onValueChanges(onData: (previous, current) async* {
|
quantity3Field.onValueChanges(onData: (previous, current) async* {
|
||||||
exerciseRepository.setQuantity(current.valueToDouble);
|
exerciseRepository.setQuantity(current.valueToDouble);
|
||||||
|
exerciseRepository.setUnitQuantity(unitQuantity3Field.valueToDouble);
|
||||||
});
|
});
|
||||||
|
|
||||||
unitQuantity3Field.onValueChanges(onData: (previous, current) async* {
|
|
||||||
exerciseRepository.setUnitQuantity(current.valueToDouble);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -93,7 +88,9 @@ class ExerciseControlFormBloc extends FormBloc<String, String> {
|
|||||||
//updatedRMField.updateInitialValue(calculate1RM(percent75: false).toStringAsFixed(0));
|
//updatedRMField.updateInitialValue(calculate1RM(percent75: false).toStringAsFixed(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
//await exerciseRepository.addExercise();
|
if ( ! readonly ) {
|
||||||
|
await exerciseRepository.addExercise();
|
||||||
|
}
|
||||||
|
|
||||||
emitSuccess(canSubmitAgain: true);
|
emitSuccess(canSubmitAgain: true);
|
||||||
} on Exception catch (ex) {
|
} on Exception catch (ex) {
|
||||||
|
@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:aitrainer_app/localization/app_language.dart';
|
import 'package:aitrainer_app/localization/app_language.dart';
|
||||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||||
|
import 'package:aitrainer_app/model/cache.dart';
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
class AppLanguage extends ChangeNotifier {
|
class AppLanguage{
|
||||||
static final AppLanguage _singleton = AppLanguage._internal();
|
static final AppLanguage _singleton = AppLanguage._internal();
|
||||||
|
|
||||||
Locale _appLocale = Locale('en');
|
Locale _appLocale = Locale('en');
|
||||||
@ -51,6 +51,5 @@ class AppLanguage extends ChangeNotifier {
|
|||||||
await prefs.setString('countryCode', 'US');
|
await prefs.setString('countryCode', 'US');
|
||||||
}
|
}
|
||||||
print(" ---- Stored lang: " + _appLocale.toString());
|
print(" ---- Stored lang: " + _appLocale.toString());
|
||||||
notifyListeners();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import 'package:aitrainer_app/view/gdpr.dart';
|
|||||||
import 'package:aitrainer_app/view/login.dart';
|
import 'package:aitrainer_app/view/login.dart';
|
||||||
import 'package:aitrainer_app/view/exercise_new_page.dart';
|
import 'package:aitrainer_app/view/exercise_new_page.dart';
|
||||||
import 'package:aitrainer_app/view/menu_page.dart';
|
import 'package:aitrainer_app/view/menu_page.dart';
|
||||||
|
import 'package:aitrainer_app/view/mydevelopment_page.dart';
|
||||||
import 'package:aitrainer_app/view/registration.dart';
|
import 'package:aitrainer_app/view/registration.dart';
|
||||||
import 'package:aitrainer_app/view/settings.dart';
|
import 'package:aitrainer_app/view/settings.dart';
|
||||||
import 'package:aitrainer_app/widgets/home.dart';
|
import 'package:aitrainer_app/widgets/home.dart';
|
||||||
@ -171,6 +172,7 @@ class AitrainerApp extends StatelessWidget {
|
|||||||
'account': (context) => AccountPage(),
|
'account': (context) => AccountPage(),
|
||||||
'settings': (context) => SettingsPage(),
|
'settings': (context) => SettingsPage(),
|
||||||
'exerciseTypeDescription': (context) => ExerciseTypeDescription(),
|
'exerciseTypeDescription': (context) => ExerciseTypeDescription(),
|
||||||
|
'mydevelopment': (context) => MyDevelopmentPage(),
|
||||||
},
|
},
|
||||||
initialRoute: 'home',
|
initialRoute: 'home',
|
||||||
title: 'Aitrainer',
|
title: 'Aitrainer',
|
||||||
|
@ -7,6 +7,7 @@ import 'package:aitrainer_app/model/workout_tree.dart';
|
|||||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||||
import 'package:aitrainer_app/service/exercise_tree_service.dart';
|
import 'package:aitrainer_app/service/exercise_tree_service.dart';
|
||||||
import 'package:aitrainer_app/service/exercisetype_service.dart';
|
import 'package:aitrainer_app/service/exercisetype_service.dart';
|
||||||
|
import 'package:aitrainer_app/util/env.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:aitrainer_app/model/exercise_type.dart';
|
import 'package:aitrainer_app/model/exercise_type.dart';
|
||||||
|
|
||||||
@ -41,8 +42,9 @@ class Cache {
|
|||||||
static final String lastStoreDateKey = 'last_date';
|
static final String lastStoreDateKey = 'last_date';
|
||||||
static final String isRegisteredKey = 'is_registered';
|
static final String isRegisteredKey = 'is_registered';
|
||||||
static final String isLoggedInKey = 'is_logged_in';
|
static final String isLoggedInKey = 'is_logged_in';
|
||||||
|
static final String langKey = 'lang';
|
||||||
|
|
||||||
static final String baseUrl = 'http://aitrainer.info:8888/api/';
|
static String baseUrl = 'http://aitrainer.info:8888/api/';
|
||||||
static final String mediaUrl = 'https://aitrainer.info:4343/media/';
|
static final String mediaUrl = 'https://aitrainer.info:4343/media/';
|
||||||
static final String username = 'bosi';
|
static final String username = 'bosi';
|
||||||
static final String password = 'andio2009';
|
static final String password = 'andio2009';
|
||||||
@ -55,6 +57,7 @@ class Cache {
|
|||||||
List<ExerciseTree> _exerciseTree;
|
List<ExerciseTree> _exerciseTree;
|
||||||
List<Exercise> _exercises;
|
List<Exercise> _exercises;
|
||||||
LinkedHashMap _tree = LinkedHashMap<String, WorkoutTree>();
|
LinkedHashMap _tree = LinkedHashMap<String, WorkoutTree>();
|
||||||
|
double _percentExercises = -1;
|
||||||
|
|
||||||
List deviceLanguages;
|
List deviceLanguages;
|
||||||
String startPage;
|
String startPage;
|
||||||
@ -63,7 +66,12 @@ class Cache {
|
|||||||
return _singleton;
|
return _singleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache._internal();
|
Cache._internal() {
|
||||||
|
String testEnv = EnvironmentConfig.test_env;
|
||||||
|
if ( testEnv == "1") {
|
||||||
|
baseUrl = 'http://aitrainer.app:8899/api/';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String getAuthToken() {
|
String getAuthToken() {
|
||||||
return this.authToken;
|
return this.authToken;
|
||||||
@ -166,4 +174,16 @@ class Cache {
|
|||||||
return this._tree;
|
return this._tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setPercentExercises(double percent) {
|
||||||
|
this._percentExercises = percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
double getPercentExercises() {
|
||||||
|
return this._percentExercises;
|
||||||
|
}
|
||||||
|
|
||||||
|
void addExercise(Exercise exercise) {
|
||||||
|
_exercises.add(exercise);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,7 +1,10 @@
|
|||||||
|
import 'dart:collection';
|
||||||
|
|
||||||
import 'package:aitrainer_app/model/cache.dart';
|
import 'package:aitrainer_app/model/cache.dart';
|
||||||
import 'package:aitrainer_app/model/customer.dart';
|
import 'package:aitrainer_app/model/customer.dart';
|
||||||
import 'package:aitrainer_app/model/exercise.dart';
|
import 'package:aitrainer_app/model/exercise.dart';
|
||||||
import 'package:aitrainer_app/model/exercise_type.dart';
|
import 'package:aitrainer_app/model/exercise_type.dart';
|
||||||
|
import 'package:aitrainer_app/model/workout_tree.dart';
|
||||||
import 'package:aitrainer_app/service/exercise_service.dart';
|
import 'package:aitrainer_app/service/exercise_service.dart';
|
||||||
|
|
||||||
class ExerciseRepository {
|
class ExerciseRepository {
|
||||||
@ -70,6 +73,7 @@ class ExerciseRepository {
|
|||||||
modelExercise.customerId = this.customer.customerId;
|
modelExercise.customerId = this.customer.customerId;
|
||||||
modelExercise.exerciseTypeId = this.exerciseType.exerciseTypeId;
|
modelExercise.exerciseTypeId = this.exerciseType.exerciseTypeId;
|
||||||
await ExerciseApi().addExercise(modelExercise);
|
await ExerciseApi().addExercise(modelExercise);
|
||||||
|
Cache().addExercise(exercise);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -96,8 +100,57 @@ class ExerciseRepository {
|
|||||||
return this.exerciseList;
|
return this.exerciseList;
|
||||||
}
|
}
|
||||||
|
|
||||||
double getBaseExerciseFinishedPercent() {
|
void getBaseExerciseFinishedPercent() {
|
||||||
return 0;
|
List<int> checkedExerciseTypeId = List();
|
||||||
|
List<int> baseTreeItem = List();
|
||||||
|
List<int> checkedBaseTreeItem = List();
|
||||||
|
int count1RMExercises = 0;
|
||||||
|
LinkedHashMap<String, WorkoutTree> tree = Cache().getWorkoutTree();
|
||||||
|
|
||||||
|
if ( tree == null ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tree.forEach((key, value) {
|
||||||
|
WorkoutTree treeItem = value;
|
||||||
|
if (treeItem.exerciseType != null &&
|
||||||
|
treeItem.exerciseType.base == true &&
|
||||||
|
!baseTreeItem.contains(treeItem.parent)) {
|
||||||
|
baseTreeItem.add(treeItem.parent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if ( exerciseList == null ) {
|
||||||
|
exerciseList = Cache().getExercises();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( exerciseList == null ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
exerciseList.forEach((element) {
|
||||||
|
Exercise exercise = element;
|
||||||
|
if ( !checkedExerciseTypeId.contains(exercise.exerciseTypeId )) {
|
||||||
|
checkedExerciseTypeId.add(exercise.exerciseTypeId);
|
||||||
|
tree.forEach((key, value) {
|
||||||
|
WorkoutTree treeItem = value;
|
||||||
|
if (treeItem.exerciseType != null
|
||||||
|
&& treeItem.exerciseType.base == true
|
||||||
|
&& exercise.exerciseTypeId == treeItem.exerciseType.exerciseTypeId
|
||||||
|
&& !checkedBaseTreeItem.contains(treeItem.parent)) {
|
||||||
|
print ("id: " + exercise.exerciseTypeId.toString());
|
||||||
|
checkedBaseTreeItem.add(treeItem.parent);
|
||||||
|
count1RMExercises++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
print ("checkedExerciseTypeid: " + checkedExerciseTypeId.toString());
|
||||||
|
print ("baseTreeItem: " + baseTreeItem.toString());
|
||||||
|
print ("count1RMExercises: " + count1RMExercises.toString());
|
||||||
|
final double percent = count1RMExercises / baseTreeItem.length;
|
||||||
|
Cache().setPercentExercises(percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void getLastExercise() {
|
void getLastExercise() {
|
||||||
@ -128,4 +181,5 @@ class ExerciseRepository {
|
|||||||
}
|
}
|
||||||
return actualExerciseType;
|
return actualExerciseType;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -4,6 +4,7 @@ import 'package:aitrainer_app/model/cache.dart';
|
|||||||
import 'package:aitrainer_app/model/exercise_tree.dart';
|
import 'package:aitrainer_app/model/exercise_tree.dart';
|
||||||
import 'package:aitrainer_app/model/exercise_type.dart';
|
import 'package:aitrainer_app/model/exercise_type.dart';
|
||||||
import 'package:aitrainer_app/model/workout_tree.dart';
|
import 'package:aitrainer_app/model/workout_tree.dart';
|
||||||
|
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||||
import 'package:aitrainer_app/service/exercise_tree_service.dart';
|
import 'package:aitrainer_app/service/exercise_tree_service.dart';
|
||||||
import 'package:aitrainer_app/service/exercisetype_service.dart';
|
import 'package:aitrainer_app/service/exercisetype_service.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -12,9 +13,9 @@ class MenuTreeRepository {
|
|||||||
final LinkedHashMap tree = LinkedHashMap<String, WorkoutTree>();
|
final LinkedHashMap tree = LinkedHashMap<String, WorkoutTree>();
|
||||||
|
|
||||||
Future<void> createTree() async {
|
Future<void> createTree() async {
|
||||||
|
|
||||||
final AppLanguage appLanguage = AppLanguage();
|
final AppLanguage appLanguage = AppLanguage();
|
||||||
bool isEnglish = appLanguage.appLocal == Locale('en');
|
bool isEnglish = appLanguage.appLocal == Locale('en');
|
||||||
|
print("** Start creating tree on lang: " + appLanguage.appLocal.toString());
|
||||||
|
|
||||||
List<ExerciseTree> exerciseTree = Cache().getExerciseTree();
|
List<ExerciseTree> exerciseTree = Cache().getExerciseTree();
|
||||||
if ( exerciseTree == null || exerciseTree.length == 0) {
|
if ( exerciseTree == null || exerciseTree.length == 0) {
|
||||||
@ -25,8 +26,8 @@ class MenuTreeRepository {
|
|||||||
String treeName = isEnglish ? treeItem.name : treeItem.nameTranslation;
|
String treeName = isEnglish ? treeItem.name : treeItem.nameTranslation;
|
||||||
String assetImage = 'asset/menu/' + treeItem.imageUrl.substring(7);
|
String assetImage = 'asset/menu/' + treeItem.imageUrl.substring(7);
|
||||||
bool is1RM = treeItem.name == '1RM' ? true : false;
|
bool is1RM = treeItem.name == '1RM' ? true : false;
|
||||||
if ( is1RM == false) {
|
if ( is1RM == false && treeItem.parentId != 0) {
|
||||||
is1RM = false; //isParent1RM(treeItem.treeId);
|
is1RM = isParent1RM(treeItem.parentId);
|
||||||
}
|
}
|
||||||
this.tree[treeItem.name] = WorkoutTree(
|
this.tree[treeItem.name] = WorkoutTree(
|
||||||
treeItem.treeId,
|
treeItem.treeId,
|
||||||
@ -51,7 +52,8 @@ class MenuTreeRepository {
|
|||||||
String exerciseTypeName = isEnglish ?
|
String exerciseTypeName = isEnglish ?
|
||||||
exerciseType.name : exerciseType.nameTranslation;
|
exerciseType.name : exerciseType.nameTranslation;
|
||||||
String assetImage = 'asset/menu/' + exerciseType.imageUrl.substring(7);
|
String assetImage = 'asset/menu/' + exerciseType.imageUrl.substring(7);
|
||||||
bool is1RM = false; //this.isParent1RM(exerciseType.treeId);
|
bool is1RM = this.isParent1RM(exerciseType.treeId);
|
||||||
|
exerciseType.is1RM = is1RM;
|
||||||
this.tree[exerciseType.name] = WorkoutTree(
|
this.tree[exerciseType.name] = WorkoutTree(
|
||||||
exerciseType.exerciseTypeId,
|
exerciseType.exerciseTypeId,
|
||||||
exerciseType.treeId,
|
exerciseType.treeId,
|
||||||
@ -66,18 +68,24 @@ class MenuTreeRepository {
|
|||||||
is1RM
|
is1RM
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cache().setWorkoutTree(tree);
|
||||||
|
ExerciseRepository exerciseRepository = ExerciseRepository();
|
||||||
|
exerciseRepository.getBaseExerciseFinishedPercent();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isParent1RM(int treeId) {
|
bool isParent1RM(int treeId) {
|
||||||
bool isTreeItem1RM = false;
|
bool isTreeItem1RM = false;
|
||||||
|
|
||||||
for (int i = 0; i < this.tree.length; i++ ) {
|
this.tree.forEach((key, value) {
|
||||||
WorkoutTree treeItem = this.tree[i];
|
WorkoutTree treeItem = value as WorkoutTree;
|
||||||
if ( treeItem.id == treeId ) {
|
if ( treeItem.id == treeId ) {
|
||||||
isTreeItem1RM = treeItem.is1RM;
|
isTreeItem1RM = treeItem.is1RM;
|
||||||
break;
|
//print (treeItem.name + " 1RM " + treeItem.is1RM.toString() );
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
});
|
||||||
|
|
||||||
return isTreeItem1RM;
|
return isTreeItem1RM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
lib/util/env.dart
Normal file
3
lib/util/env.dart
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
class EnvironmentConfig {
|
||||||
|
static const test_env = String.fromEnvironment('test_env');
|
||||||
|
}
|
@ -65,7 +65,7 @@ class AccountPage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bottomNavigationBar: BottomNavigator(bottomNavIndex: 2));
|
bottomNavigationBar: BottomNavigator(bottomNavIndex: 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView accountWidget(BuildContext context, String customerName, AccountBloc accountBloc) {
|
ListView accountWidget(BuildContext context, String customerName, AccountBloc accountBloc) {
|
||||||
|
@ -277,7 +277,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
|||||||
padding: EdgeInsets.only(left:10),
|
padding: EdgeInsets.only(left:10),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
textFieldBloc: bloc.rm75Field,
|
textFieldBloc: bloc.rm75Field,
|
||||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.bold),
|
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.normal),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
@ -289,7 +289,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
|||||||
padding: EdgeInsets.only(left:10),
|
padding: EdgeInsets.only(left:10),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
textFieldBloc: bloc.rm75OconnorField,
|
textFieldBloc: bloc.rm75OconnorField,
|
||||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.bold),
|
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.normal),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
@ -301,7 +301,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
|||||||
padding: EdgeInsets.only(left:10),
|
padding: EdgeInsets.only(left:10),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
textFieldBloc: bloc.rm75WendlerField,
|
textFieldBloc: bloc.rm75WendlerField,
|
||||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.bold),
|
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.normal),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
@ -366,6 +366,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
|||||||
{
|
{
|
||||||
args['exerciseRepository'] = bloc.exerciseRepository,
|
args['exerciseRepository'] = bloc.exerciseRepository,
|
||||||
args['percent'] = 0.75,
|
args['percent'] = 0.75,
|
||||||
|
args['readonly'] = true,
|
||||||
Navigator.of(context).pushNamed('exerciseControlPage',
|
Navigator.of(context).pushNamed('exerciseControlPage',
|
||||||
arguments: args)
|
arguments: args)
|
||||||
},
|
},
|
||||||
@ -381,6 +382,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
|||||||
{
|
{
|
||||||
args['exerciseRepository'] = bloc.exerciseRepository,
|
args['exerciseRepository'] = bloc.exerciseRepository,
|
||||||
args['percent'] = 0.5,
|
args['percent'] = 0.5,
|
||||||
|
args['readonly'] = true,
|
||||||
Navigator.of(context).pushNamed('exerciseControlPage',
|
Navigator.of(context).pushNamed('exerciseControlPage',
|
||||||
arguments: args )
|
arguments: args )
|
||||||
},
|
},
|
||||||
|
@ -22,10 +22,11 @@ class _ExerciseControlPage extends State<ExerciseControlPage> {
|
|||||||
LinkedHashMap arguments = ModalRoute.of(context).settings.arguments;
|
LinkedHashMap arguments = ModalRoute.of(context).settings.arguments;
|
||||||
final ExerciseRepository exerciseRepository = arguments['exerciseRepository'];
|
final ExerciseRepository exerciseRepository = arguments['exerciseRepository'];
|
||||||
final double percent = arguments['percent'];
|
final double percent = arguments['percent'];
|
||||||
|
final bool readonly = arguments['readonly'];
|
||||||
|
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) =>
|
create: (context) =>
|
||||||
ExerciseControlFormBloc(exerciseRepository: exerciseRepository, percentToCalculate: percent),
|
ExerciseControlFormBloc(exerciseRepository: exerciseRepository, percentToCalculate: percent, readonly: readonly),
|
||||||
child: BlocBuilder<ExerciseControlFormBloc, FormBlocState>(
|
child: BlocBuilder<ExerciseControlFormBloc, FormBlocState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
// ignore: close_sinks
|
// ignore: close_sinks
|
||||||
@ -148,12 +149,7 @@ class _ExerciseControlPage extends State<ExerciseControlPage> {
|
|||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
WhitelistingTextInputFormatter (RegExp(r"[\d.]"))
|
WhitelistingTextInputFormatter (RegExp(r"[\d.]"))
|
||||||
],
|
],
|
||||||
onChanged: (input) => {
|
|
||||||
print("Quantity 1 value $input"),
|
|
||||||
//exerciseBloc.exerciseRepository.setQuantity(double.parse(input)),
|
|
||||||
//exerciseBloc.exerciseRepository
|
|
||||||
// .setUnit(exerciseBloc.exerciseRepository.exerciseType.unit)
|
|
||||||
},
|
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
filled: false,
|
filled: false,
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:collection';
|
||||||
|
|
||||||
import 'package:aitrainer_app/bloc/exercise_form_bloc.dart';
|
import 'package:aitrainer_app/bloc/exercise_form_bloc.dart';
|
||||||
import 'package:aitrainer_app/localization/app_language.dart';
|
import 'package:aitrainer_app/localization/app_language.dart';
|
||||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||||
@ -235,7 +237,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void confirmationDialog( ExerciseFormBloc bloc ) {
|
void confirmationDialog( ExerciseFormBloc bloc ) {
|
||||||
|
LinkedHashMap args = LinkedHashMap();
|
||||||
print("exercise validated " + bloc.exerciseRepository.exercise.quantity.toString());
|
print("exercise validated " + bloc.exerciseRepository.exercise.quantity.toString());
|
||||||
if ( bloc.exerciseRepository.exercise.quantity == null) {
|
if ( bloc.exerciseRepository.exercise.quantity == null) {
|
||||||
return;
|
return;
|
||||||
@ -245,9 +247,12 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> {
|
|||||||
bloc.exerciseRepository.exercise.quantity.round().toString() :
|
bloc.exerciseRepository.exercise.quantity.round().toString() :
|
||||||
bloc.exerciseRepository.exercise.quantity.toString();
|
bloc.exerciseRepository.exercise.quantity.toString();
|
||||||
|
|
||||||
String unitQuantity = bloc.exerciseRepository.exercise.unitQuantity % 1 == 0?
|
String unitQuantity = "";
|
||||||
|
if ( bloc.exerciseRepository.exercise.unitQuantity != null ) {
|
||||||
|
unitQuantity = bloc.exerciseRepository.exercise.unitQuantity % 1 == 0 ?
|
||||||
bloc.exerciseRepository.exercise.unitQuantity.round().toString() :
|
bloc.exerciseRepository.exercise.unitQuantity.round().toString() :
|
||||||
bloc.exerciseRepository.exercise.unitQuantity.toString();
|
bloc.exerciseRepository.exercise.unitQuantity.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
showCupertinoDialog(
|
showCupertinoDialog(
|
||||||
@ -261,7 +266,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> {
|
|||||||
children: [
|
children: [
|
||||||
Divider(),
|
Divider(),
|
||||||
Text(AppLocalizations.of(context).translate("Exercise") + ": " +
|
Text(AppLocalizations.of(context).translate("Exercise") + ": " +
|
||||||
AppLocalizations.of(context).translate(bloc.exerciseRepository.exerciseType.name),
|
bloc.exerciseRepository.exerciseType.name,
|
||||||
style: (TextStyle(color: Colors.blue)),),
|
style: (TextStyle(color: Colors.blue)),),
|
||||||
Text(quantity + " " +
|
Text(quantity + " " +
|
||||||
AppLocalizations.of(context).translate(bloc.exerciseRepository.exerciseType.unit),
|
AppLocalizations.of(context).translate(bloc.exerciseRepository.exerciseType.unit),
|
||||||
@ -285,9 +290,15 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> {
|
|||||||
onPressed: () => {
|
onPressed: () => {
|
||||||
bloc.exerciseRepository.setCustomer(Cache().userLoggedIn),
|
bloc.exerciseRepository.setCustomer(Cache().userLoggedIn),
|
||||||
bloc.exerciseRepository.addExercise(),
|
bloc.exerciseRepository.addExercise(),
|
||||||
|
|
||||||
Navigator.pop(context),
|
Navigator.pop(context),
|
||||||
Navigator.pop(context),
|
Navigator.pop(context),
|
||||||
|
if ( bloc.exerciseRepository.exerciseType.is1RM ) {
|
||||||
|
args['exerciseRepository'] = bloc.exerciseRepository,
|
||||||
|
args['percent'] = 0.75,
|
||||||
|
args['readonly'] = false,
|
||||||
|
Navigator.of(context).pushNamed('exerciseControlPage',
|
||||||
|
arguments: args )
|
||||||
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
147
lib/view/mydevelopment_page.dart
Normal file
147
lib/view/mydevelopment_page.dart
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
import 'package:aitrainer_app/localization/app_language.dart';
|
||||||
|
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||||
|
import 'package:aitrainer_app/model/exercise.dart';
|
||||||
|
import 'package:aitrainer_app/model/exercise_type.dart';
|
||||||
|
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||||
|
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||||
|
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_treeview/tree_view.dart';
|
||||||
|
|
||||||
|
class MyDevelopmentPage extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_MyDevelopmentPage createState() => _MyDevelopmentPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyDevelopmentPage extends State<MyDevelopmentPage> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final ExerciseRepository exerciseRepository = ExerciseRepository();
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBarNav(),
|
||||||
|
body: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
image: DecorationImage(
|
||||||
|
image: AssetImage('asset/image/WT_light_background.png'),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
child:
|
||||||
|
exerciseWidget(exerciseRepository),
|
||||||
|
|
||||||
|
)
|
||||||
|
),
|
||||||
|
bottomNavigationBar: BottomNavigator(bottomNavIndex: 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget exerciseWidget(ExerciseRepository exerciseRepository) {
|
||||||
|
TreeViewController _treeViewController = TreeViewController(children: nodeExercises(exerciseRepository) );
|
||||||
|
|
||||||
|
TreeViewTheme _treeViewTheme = TreeViewTheme(
|
||||||
|
expanderTheme: ExpanderThemeData(
|
||||||
|
type: ExpanderType.caret,
|
||||||
|
modifier: ExpanderModifier.none,
|
||||||
|
position: ExpanderPosition.start,
|
||||||
|
color: Colors.red.shade800,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
letterSpacing: 0.1,
|
||||||
|
),
|
||||||
|
parentLabelStyle: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
letterSpacing: 0.1,
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
color: Colors.orange.shade600,
|
||||||
|
),
|
||||||
|
iconTheme: IconThemeData(
|
||||||
|
size: 18,
|
||||||
|
color: Colors.grey.shade800,
|
||||||
|
),
|
||||||
|
colorScheme: ColorScheme.light(
|
||||||
|
background: Colors.transparent
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return TreeView(
|
||||||
|
controller: _treeViewController,
|
||||||
|
allowParentSelect: false,
|
||||||
|
supportParentDoubleTap: false,
|
||||||
|
//onExpansionChanged: _expandNodeHandler,
|
||||||
|
onNodeTap: (key) {
|
||||||
|
setState(() {
|
||||||
|
_treeViewController = _treeViewController.copyWith(selectedKey: key);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
theme: _treeViewTheme,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Node> nodeExercises(ExerciseRepository exerciseRepository) {
|
||||||
|
List<Node> nodes = List<Node>();
|
||||||
|
List<Exercise> exercises = exerciseRepository.getExerciseList();
|
||||||
|
|
||||||
|
String prevDay = "";
|
||||||
|
Node actualNode;
|
||||||
|
List<Node> listExercisesPerDay;
|
||||||
|
exercises.forEach((element) {
|
||||||
|
Exercise exercise = element;
|
||||||
|
ExerciseType exerciseType =
|
||||||
|
exerciseRepository.getExerciseTypeById(exercise.exerciseTypeId);
|
||||||
|
String actualDay = exercise.dateAdd.year.toString()+"-"+
|
||||||
|
exercise.dateAdd.month.toString()+"-"+
|
||||||
|
exercise.dateAdd.day.toString();
|
||||||
|
|
||||||
|
if ( prevDay.compareTo(actualDay) != 0) {
|
||||||
|
listExercisesPerDay = List<Node>();
|
||||||
|
actualNode =
|
||||||
|
Node(
|
||||||
|
label: actualDay,
|
||||||
|
key: exercise.dateAdd.toString(),
|
||||||
|
expanded: true,
|
||||||
|
children: listExercisesPerDay,
|
||||||
|
icon: NodeIcon(
|
||||||
|
codePoint: Icons.date_range.codePoint,
|
||||||
|
color: "blue"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
nodes.add(actualNode);
|
||||||
|
prevDay = actualDay;
|
||||||
|
}
|
||||||
|
|
||||||
|
String exerciseName = AppLanguage().appLocal == Locale("en") ?
|
||||||
|
exerciseType.name :
|
||||||
|
exerciseType.nameTranslation;
|
||||||
|
String unitQuantity = exerciseType.unitQuantity == "1" ?
|
||||||
|
exercise.unitQuantity.toStringAsFixed(0)
|
||||||
|
+ " " + AppLocalizations.of(context).translate(exerciseType.unitQuantityUnit) + " "
|
||||||
|
: "";
|
||||||
|
|
||||||
|
String labelExercise =
|
||||||
|
exerciseName + " " + unitQuantity
|
||||||
|
+ exercise.quantity.toStringAsFixed(0) + " "
|
||||||
|
+ AppLocalizations.of(context).translate(exercise.unit);
|
||||||
|
listExercisesPerDay.add(
|
||||||
|
Node(
|
||||||
|
label: labelExercise,
|
||||||
|
key: exercise.exerciseId.toString(),
|
||||||
|
expanded: false,
|
||||||
|
icon: NodeIcon(
|
||||||
|
codePoint: Icons.repeat.codePoint,
|
||||||
|
color: "blue"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
return nodes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -69,7 +69,7 @@ class SettingsPage extends StatelessWidget{
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bottomNavigationBar: BottomNavigator(bottomNavIndex: 3)
|
bottomNavigationBar: BottomNavigator(bottomNavIndex: 4)
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import 'dart:async';
|
|||||||
import 'package:aitrainer_app/animations/test_progress_animation.dart';
|
import 'package:aitrainer_app/animations/test_progress_animation.dart';
|
||||||
import 'package:aitrainer_app/bloc/menu/menu_bloc.dart';
|
import 'package:aitrainer_app/bloc/menu/menu_bloc.dart';
|
||||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||||
|
import 'package:aitrainer_app/model/cache.dart';
|
||||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -29,9 +30,9 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin {
|
|||||||
//AnimationController sizeController;
|
//AnimationController sizeController;
|
||||||
MenuBloc menuBloc;
|
MenuBloc menuBloc;
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
||||||
colorController =
|
colorController =
|
||||||
AnimationController(duration: Duration(seconds: 4), vsync: this);
|
AnimationController(duration: Duration(seconds: 4), vsync: this);
|
||||||
//sizeController =
|
//sizeController =
|
||||||
@ -68,8 +69,10 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin {
|
|||||||
..addStatusListener((status) {
|
..addStatusListener((status) {
|
||||||
if (status == AnimationStatus.completed) {
|
if (status == AnimationStatus.completed) {
|
||||||
Timer(Duration(seconds: 10), () {
|
Timer(Duration(seconds: 10), () {
|
||||||
colorController.reset();
|
//colorController.reset();
|
||||||
|
if ( mounted ) {
|
||||||
colorController.forward();
|
colorController.forward();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else if (status == AnimationStatus.dismissed) {
|
} else if (status == AnimationStatus.dismissed) {
|
||||||
colorController.forward();
|
colorController.forward();
|
||||||
@ -114,9 +117,14 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget getAnimatedWidget() {
|
Widget getAnimatedWidget() {
|
||||||
|
double percent = Cache().getPercentExercises();
|
||||||
|
if ( percent == -1) {
|
||||||
ExerciseRepository exerciseRepository = ExerciseRepository();
|
ExerciseRepository exerciseRepository = ExerciseRepository();
|
||||||
exerciseRepository.getExerciseList();
|
exerciseRepository.getBaseExerciseFinishedPercent();
|
||||||
if ( exerciseRepository.exerciseList == null || exerciseRepository.exerciseList.length == 0 ) {
|
percent = Cache().getPercentExercises();
|
||||||
|
}
|
||||||
|
int sizeExerciseList = Cache().getExercises() == null? 0 : Cache().getExercises().length;
|
||||||
|
if ( sizeExerciseList == 0 ) {
|
||||||
return Stack(
|
return Stack(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
children: [
|
children: [
|
||||||
@ -128,7 +136,7 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
double percent = 0.61;//exerciseRepository.getBaseExerciseFinishedPercent();
|
|
||||||
return Stack(
|
return Stack(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
children: [
|
children: [
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gradient_bottom_navigation_bar/gradient_bottom_navigation_bar.dart';
|
||||||
|
|
||||||
|
// ignore: must_be_immutable
|
||||||
class BottomNavigator extends StatefulWidget {
|
class BottomNavigator extends StatefulWidget {
|
||||||
int bottomNavIndex = 0;
|
int bottomNavIndex = 0;
|
||||||
BottomNavigator({this.bottomNavIndex}) {
|
BottomNavigator({this.bottomNavIndex}) {
|
||||||
@ -21,46 +23,67 @@ class _NawDrawerWidget extends State<BottomNavigator> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final Color bgrColor = Color(0xffb4f500);
|
||||||
|
final Color bgrColorEnd = Colors.blue;
|
||||||
|
final Color active = Colors.black;
|
||||||
|
final Color inactive = Colors.black26;
|
||||||
|
|
||||||
return BottomNavigationBar(
|
/*final Color bgrColor = Colors.black;
|
||||||
|
final Color active = Colors.yellowAccent;
|
||||||
|
final Color inactive = Colors.white60;*/
|
||||||
|
//
|
||||||
|
|
||||||
|
return GradientBottomNavigationBar(
|
||||||
currentIndex: widget.bottomNavIndex, // this will be set when a new tab is tapped
|
currentIndex: widget.bottomNavIndex, // this will be set when a new tab is tapped
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColorStart: bgrColorEnd,
|
||||||
selectedItemColor: Colors.yellow,
|
backgroundColorEnd: bgrColor,
|
||||||
unselectedItemColor: Colors.lightGreen,
|
fixedColor: active,
|
||||||
//type: BottomNavigationBarType.shifting,
|
//selectedItemColor: active,
|
||||||
showSelectedLabels: true,
|
//unselectedItemColor: inactive,
|
||||||
showUnselectedLabels: true,
|
//showSelectedLabels: true,
|
||||||
|
//showUnselectedLabels: true,
|
||||||
items: [
|
items: [
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
backgroundColor: Colors.black12,
|
backgroundColor: bgrColor,
|
||||||
icon: new Icon(Icons.home, color: Colors.lightGreen),
|
icon: new Icon(Icons.home, color: inactive),
|
||||||
activeIcon: new Icon(Icons.home, color: Colors.yellow,),
|
activeIcon: new Icon(Icons.home, color: active,),
|
||||||
title: new Text(AppLocalizations.of(context).translate("Home")),
|
title: new Text(AppLocalizations.of(context).translate("Home"),
|
||||||
|
style: TextStyle(fontSize: 9)),
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
backgroundColor: Colors.black12,
|
backgroundColor: bgrColor,
|
||||||
icon: new Icon(Icons.confirmation_number, color: Colors.lightGreen),
|
icon: new Icon(Icons.trending_up, color: inactive),
|
||||||
activeIcon: new Icon(Icons.event, color: Colors.yellow,),
|
activeIcon: new Icon(Icons.trending_up, color: active,),
|
||||||
title: new Text(AppLocalizations.of(context).translate("Events")),
|
title: new Text(AppLocalizations.of(context).translate("My Development"),
|
||||||
|
style: TextStyle(fontSize: 9),),
|
||||||
),
|
),
|
||||||
|
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
backgroundColor: Colors.black12,
|
backgroundColor: bgrColor,
|
||||||
icon: Icon(Icons.person, color: Colors.lightGreen,),
|
icon: new Icon(Icons.featured_play_list, color: inactive),
|
||||||
activeIcon: new Icon(Icons.person, color: Colors.yellow,),
|
activeIcon: new Icon(Icons.featured_play_list, color: active,),
|
||||||
title: Text(AppLocalizations.of(context).translate("Account"))
|
title: new Text(AppLocalizations.of(context).translate("My Training Plan"),
|
||||||
|
style: TextStyle(fontSize: 9),),
|
||||||
|
),
|
||||||
|
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
backgroundColor: bgrColor,
|
||||||
|
icon: Icon(Icons.person, color: inactive,),
|
||||||
|
activeIcon: new Icon(Icons.person, color: active,),
|
||||||
|
title: Text(AppLocalizations.of(context).translate("Account"),
|
||||||
|
style: TextStyle(fontSize: 9),)
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
backgroundColor: Colors.black12,
|
backgroundColor: bgrColor,
|
||||||
icon: Icon(Icons.settings, color: Colors.lightGreen),
|
icon: Icon(Icons.settings, color: inactive),
|
||||||
activeIcon: new Icon(Icons.settings, color: Colors.yellow,),
|
activeIcon: new Icon(Icons.settings, color: active,),
|
||||||
title: Text(AppLocalizations.of(context).translate("Settings"))
|
title: Text(AppLocalizations.of(context).translate("Settings"),
|
||||||
|
style: TextStyle(fontSize: 9))
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
onTap:(index) {
|
onTap:(index) {
|
||||||
setState(() {
|
setState(() {
|
||||||
widget.bottomNavIndex = index;
|
widget.bottomNavIndex = index;
|
||||||
});
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
@ -68,21 +91,29 @@ class _NawDrawerWidget extends State<BottomNavigator> {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Navigator.of(context).pushNamed('mydevelopment');
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
|
||||||
//throw new StateError('This is a Dart exception on event.');
|
//throw new StateError('This is a Dart exception on event.');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 3:
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pushNamed('account');
|
Navigator.of(context).pushNamed('account');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 4:
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pushNamed('settings');
|
Navigator.of(context).pushNamed('settings');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,12 +82,9 @@ class MenuPageWidget extends StatelessWidget {
|
|||||||
AppLocalizations.of(context).translate('Please log in'),
|
AppLocalizations.of(context).translate('Please log in'),
|
||||||
style: TextStyle(color: Colors.white))));
|
style: TextStyle(color: Colors.white))));
|
||||||
} else {
|
} else {
|
||||||
if (workoutTree.exerciseType.name == "Custom") {
|
if (workoutTree.exerciseType.name == "Custom" && Cache().userLoggedIn.admin == 1) {
|
||||||
Navigator.of(context).pushNamed('exerciseCustomPage',
|
Navigator.of(context).pushNamed('exerciseCustomPage',
|
||||||
arguments: workoutTree.exerciseType);
|
arguments: workoutTree.exerciseType);
|
||||||
} else if (workoutTree.exerciseType.name == "Control") {
|
|
||||||
Navigator.of(context).pushNamed('exerciseControlPage',
|
|
||||||
arguments: workoutTree.exerciseType);
|
|
||||||
} else {
|
} else {
|
||||||
Navigator.of(context).pushNamed('exerciseNewPage',
|
Navigator.of(context).pushNamed('exerciseNewPage',
|
||||||
arguments: workoutTree.exerciseType);
|
arguments: workoutTree.exerciseType);
|
||||||
@ -108,17 +105,6 @@ class MenuPageWidget extends StatelessWidget {
|
|||||||
|
|
||||||
dynamic _getButtonImage(WorkoutTree workoutTree) {
|
dynamic _getButtonImage(WorkoutTree workoutTree) {
|
||||||
dynamic image;
|
dynamic image;
|
||||||
/*String url = workoutTree.imageName;
|
|
||||||
if ( workoutTree.imageName.startsWith("https") ) {
|
|
||||||
image = FadeInImage.assetNetwork(
|
|
||||||
placeholder: 'asset/image/dots.gif',
|
|
||||||
image: url,
|
|
||||||
height: 180,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
image = Image.asset(workoutTree.imageName, height: 180,);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
image = Image.asset(
|
image = Image.asset(
|
||||||
workoutTree.imageName,
|
workoutTree.imageName,
|
||||||
|
24
pubspec.lock
24
pubspec.lock
@ -42,14 +42,14 @@ packages:
|
|||||||
name: bloc
|
name: bloc
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.2"
|
version: "6.0.3"
|
||||||
bloc_test:
|
bloc_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: bloc_test
|
name: bloc_test
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.0.2"
|
version: "7.0.3"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -229,7 +229,7 @@ packages:
|
|||||||
name: flutter_bloc
|
name: flutter_bloc
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.1"
|
version: "6.0.4"
|
||||||
flutter_driver:
|
flutter_driver:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -255,7 +255,7 @@ packages:
|
|||||||
name: flutter_keyboard_visibility
|
name: flutter_keyboard_visibility
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.2.1"
|
version: "3.2.2"
|
||||||
flutter_launcher_icons:
|
flutter_launcher_icons:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
@ -287,6 +287,13 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_treeview:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_treeview
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.6.0+1"
|
||||||
flutter_web_plugins:
|
flutter_web_plugins:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -325,6 +332,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.2.0"
|
||||||
|
gradient_bottom_navigation_bar:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: gradient_bottom_navigation_bar
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0+4"
|
||||||
graphs:
|
graphs:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -798,7 +812,7 @@ packages:
|
|||||||
name: uuid
|
name: uuid
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.0"
|
version: "2.2.2"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -32,13 +32,15 @@ dependencies:
|
|||||||
# firebase_messaging: ^6.0.16
|
# firebase_messaging: ^6.0.16
|
||||||
flutter_local_notifications: 1.1.1
|
flutter_local_notifications: 1.1.1
|
||||||
flutter_facebook_login: ^3.0.0
|
flutter_facebook_login: ^3.0.0
|
||||||
flutter_bloc: ^6.0.1
|
flutter_bloc: ^6.0.4
|
||||||
equatable: ^1.2.4
|
equatable: ^1.2.4
|
||||||
freezed: ^0.11.6
|
freezed: ^0.11.6
|
||||||
flutter_form_bloc: ^0.19.0
|
flutter_form_bloc: ^0.19.0
|
||||||
spider_chart: ^0.1.5
|
spider_chart: ^0.1.5
|
||||||
rainbow_color: ^0.1.1
|
rainbow_color: ^0.1.1
|
||||||
percent_indicator: ^2.1.5
|
percent_indicator: ^2.1.5
|
||||||
|
gradient_bottom_navigation_bar: ^1.0.0+4
|
||||||
|
flutter_treeview: ^0.6.0+1
|
||||||
|
|
||||||
mockito: ^4.1.1
|
mockito: ^4.1.1
|
||||||
|
|
||||||
@ -49,7 +51,7 @@ dev_dependencies:
|
|||||||
flutter_driver:
|
flutter_driver:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
test: any
|
test: any
|
||||||
bloc_test: ^7.0.2
|
bloc_test: ^7.0.1
|
||||||
|
|
||||||
build_runner:
|
build_runner:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user