diff --git a/asset/image/equipment_gym_place.jpg b/asset/image/equipment_gym_place.jpg new file mode 100644 index 0000000..98ea3b1 Binary files /dev/null and b/asset/image/equipment_gym_place.jpg differ diff --git a/asset/image/equipment_home_place.jpg b/asset/image/equipment_home_place.jpg new file mode 100644 index 0000000..c3f0843 Binary files /dev/null and b/asset/image/equipment_home_place.jpg differ diff --git a/asset/image/equipment_street_place.jpg b/asset/image/equipment_street_place.jpg new file mode 100644 index 0000000..fe83c5c Binary files /dev/null and b/asset/image/equipment_street_place.jpg differ diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index f876646..830febb 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -362,7 +362,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 33; + CURRENT_PROJECT_VERSION = 34; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -505,7 +505,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 33; + CURRENT_PROJECT_VERSION = 34; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -540,7 +540,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 33; + CURRENT_PROJECT_VERSION = 34; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/lib/bloc/customer_exercise_device/customer_exercise_device_bloc.dart b/lib/bloc/customer_exercise_device/customer_exercise_device_bloc.dart index 194bb06..ac41e0d 100644 --- a/lib/bloc/customer_exercise_device/customer_exercise_device_bloc.dart +++ b/lib/bloc/customer_exercise_device/customer_exercise_device_bloc.dart @@ -30,6 +30,7 @@ class CustomerExerciseDeviceBloc extends Bloc "2"); await repository.addDevice(event.device); Cache().initBadges(); yield CustomerExerciseDeviceReady(); diff --git a/lib/bloc/exercise_new/exercise_new_bloc.dart b/lib/bloc/exercise_new/exercise_new_bloc.dart index 328f5a3..46925b0 100644 --- a/lib/bloc/exercise_new/exercise_new_bloc.dart +++ b/lib/bloc/exercise_new/exercise_new_bloc.dart @@ -335,31 +335,34 @@ class ExerciseNewBloc extends Bloc { if (this.bmi == 0) { getBMI(); } - //bmi = 15; + final double distortionWidth = mediaWidth / baseWidth; + final double distortionHeight = mediaHeight / baseHeight; + print("W m " + mediaWidth.toString() + " b" + baseWidth.toString() + " d: " + distortionWidth.toString()); + print("H m " + mediaHeight.toString() + " b" + baseHeight.toString() + " d: " + distortionHeight.toString()); this.bmiAngle = (bmi * 90 / 25) - 90; if (bmi < 18.5) { goalBMI = 19; - this.bmiTop = 99; - this.bmiLeft = 72; + this.bmiTop = 99 * distortionHeight; + this.bmiLeft = 77 * distortionWidth; bmiAngle = -62; } else if (bmi < 25 && 18.5 < bmi) { goalBMI = 27; - this.bmiTop = 46; - this.bmiLeft = 130; + this.bmiTop = 48 * distortionHeight; + this.bmiLeft = 130 * distortionWidth; bmiAngle = -23; } else if (bmi < 30 && 24.9 < bmi) { goalBMI = 24; - this.bmiTop = 38.0; - this.bmiLeft = 186.0; + this.bmiTop = 40.0 * distortionHeight; + this.bmiLeft = 184.0 * distortionWidth; bmiAngle = 7.2; } else if (bmi < 34.9 && 29.9 < bmi) { goalBMI = 29; - bmiTop = 48; - bmiLeft = 211; + bmiTop = 48 * distortionHeight; + bmiLeft = 211 * distortionWidth; } else if (bmi > 35) { goalBMI = 34; - bmiTop = 94; - bmiLeft = 260; + bmiTop = 94 * distortionHeight; + bmiLeft = 260 * distortionWidth; bmiAngle = 59; } diff --git a/lib/repository/customer_exercise_device_repository.dart b/lib/repository/customer_exercise_device_repository.dart index 9bff8c0..a46a047 100644 --- a/lib/repository/customer_exercise_device_repository.dart +++ b/lib/repository/customer_exercise_device_repository.dart @@ -27,6 +27,8 @@ class CustomerExerciseDeviceRepository { found = element; } }); + } else { + _devices = List(); } if (found == null) { int customerId; @@ -36,8 +38,8 @@ class CustomerExerciseDeviceRepository { CustomerExerciseDevice newDevice = CustomerExerciseDevice(customerId: customerId, exerciseDeviceId: device.exerciseDeviceId, favourite: false); newDevice.change = ModelChange.add; - await CustomerExerciseDeviceApi().addDevice(newDevice); - this._devices.add(newDevice); + CustomerExerciseDevice saved = await CustomerExerciseDeviceApi().addDevice(newDevice); + this._devices.add(saved); Cache().setCustomerDevices(_devices); } } @@ -55,9 +57,9 @@ class CustomerExerciseDeviceRepository { } if (found != null) { this._devices.remove(found); - if (found.change != ModelChange.add) { - await CustomerExerciseDeviceApi().removeDevice(found.customerExerciseDeviceId); - } + //if (found.change != ModelChange.add) { + await CustomerExerciseDeviceApi().removeDevice(found.customerExerciseDeviceId); + //} Cache().setCustomerDevices(_devices); } } diff --git a/lib/view/customer_exercise_device.dart b/lib/view/customer_exercise_device.dart index 33c9686..5e85dfe 100644 --- a/lib/view/customer_exercise_device.dart +++ b/lib/view/customer_exercise_device.dart @@ -6,7 +6,7 @@ import 'package:aitrainer_app/repository/customer_exercise_device_repository.dar import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/widgets/app_bar.dart'; import 'package:aitrainer_app/widgets/image_button.dart'; -import 'package:aitrainer_app/widgets/splash.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:google_fonts/google_fonts.dart'; @@ -19,6 +19,7 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans { Widget build(BuildContext context) { setContext(context); double cWidth = MediaQuery.of(context).size.width; + double cHeight = MediaQuery.of(context).size.height; return Scaffold( appBar: AppBarNav(depth: 0), body: Container( @@ -37,7 +38,10 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans { child: BlocConsumer( listener: (context, state) { if (state is CustomerExerciseDeviceLoading) { - return LoadingDialog(); + Scaffold.of(context).showSnackBar(SnackBar( + duration: Duration(milliseconds: 100), + backgroundColor: Colors.transparent, + content: Container(child: Center(child: CircularProgressIndicator())))); } else if (state is CustomerExerciseDeviceError) { Scaffold.of(context).showSnackBar( SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white)))); @@ -45,13 +49,13 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans { }, builder: (context, state) { final bloc = BlocProvider.of(context); - return getPage(bloc, cWidth); + return getPage(bloc, cWidth, cHeight); }, )))); } - Widget getPage(CustomerExerciseDeviceBloc bloc, double cWidth) { - print("width" + cWidth.toString()); + Widget getPage(CustomerExerciseDeviceBloc bloc, double cWidth, double cHeight) { + //print("width" + cWidth.toString()); return CustomScrollView(scrollDirection: Axis.vertical, slivers: [ SliverGrid( delegate: SliverChildListDelegate([ @@ -104,12 +108,12 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans { ), ), SliverGrid( - delegate: SliverChildListDelegate(getDevicesPlace(bloc, cWidth)), + delegate: SliverChildListDelegate(getDevicesPlace(bloc, cWidth, cHeight)), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 1, mainAxisSpacing: 15.0, - crossAxisSpacing: 10.0, - childAspectRatio: 3.0, + crossAxisSpacing: 5.0, + childAspectRatio: 2.5, ), ), SliverGrid( @@ -164,7 +168,7 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans { ), ), SliverGrid( - delegate: SliverChildListDelegate(getDevices(bloc)), + delegate: SliverChildListDelegate(getDevices(bloc, cWidth, cHeight)), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, mainAxisSpacing: 15.0, @@ -175,7 +179,8 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans { ]); } - List getDevices(CustomerExerciseDeviceBloc bloc) { + List getDevices(CustomerExerciseDeviceBloc bloc, double cWidth, double cHeight) { + print("height " + cHeight.toString()); final bool isEnglish = AppLanguage().appLocal.languageCode == "en"; this.listDevice = List(); final devices = bloc.devices; @@ -185,8 +190,8 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans { if (element.place == false) { final String url = "asset/image/" + element.imageUrl.substring(7); ImageButton button = ImageButton( - width: 178, - height: 175, + width: cWidth / 2 - 10, + height: cWidth / 2 - 10, textAlignment: Alignment.topCenter, text: isEnglish ? element.name : element.nameTranslation, style: GoogleFonts.archivoBlack(fontSize: 14, color: Colors.white, backgroundColor: Colors.black54.withOpacity(0.4)), @@ -205,7 +210,8 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans { return listDevice; } - List getDevicesPlace(CustomerExerciseDeviceBloc bloc, double cWidth) { + List getDevicesPlace(CustomerExerciseDeviceBloc bloc, double cWidth, cHeight) { + print("height " + cHeight.toString() + " width " + cWidth.toString()); final bool isEnglish = AppLanguage().appLocal.languageCode == "en"; this.listDevice = List(); final devices = bloc.devices; @@ -213,15 +219,16 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans { devices.sort((a, b) => a.sort.compareTo(b.sort)); devices.forEach((element) { if (element.place) { + final String url = "asset/image/" + element.imageUrl.substring(7); ImageButton button = ImageButton( - width: cWidth - 80, - height: 125, + width: cWidth - 60, + height: cWidth / 2 - 40, top: 10, textAlignment: Alignment.topCenter, text: isEnglish ? element.name : element.nameTranslation, style: GoogleFonts.archivoBlack(fontSize: 14, color: Colors.white, backgroundColor: Colors.black54.withOpacity(0.4)), - image: element.imageUrl, - left: 35, + image: url, + left: 5, onTap: () => changeButtonShape(element, bloc), isLocked: false, buttonIndex: element.exerciseDeviceId, diff --git a/lib/view/customer_modify_page.dart b/lib/view/customer_modify_page.dart index f4b5e8c..a875854 100644 --- a/lib/view/customer_modify_page.dart +++ b/lib/view/customer_modify_page.dart @@ -45,8 +45,9 @@ class CustomerModifyPage extends StatelessWidget with Trans { child: BlocConsumer( listener: (context, state) { if (state is CustomerChangeLoading) { - LoadingDialog(); + //LoadingDialog(); } else if (state is CustomerSaveError) { + //LoadingDialog.hide(context); Scaffold.of(context).showSnackBar( SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white)))); } else if (state is CustomerSaveSuccess) { diff --git a/lib/view/exercise_control_page.dart b/lib/view/exercise_control_page.dart index 8429c82..f69a629 100644 --- a/lib/view/exercise_control_page.dart +++ b/lib/view/exercise_control_page.dart @@ -31,14 +31,16 @@ class _ExerciseControlPage extends State with Trans { ..add(ExerciseControlLoad()), child: BlocConsumer(listener: (context, state) { if (state is ExerciseControlError) { + //LoadingDialog.hide(context); Scaffold.of(context).showSnackBar( SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white)))); } else if (state is ExerciseControlLoading) { - return LoadingDialog(); + //LoadingDialog.show(context); } }, builder: (context, state) { final exerciseBloc = BlocProvider.of(context); if (state is ExerciseControlReady) { + //LoadingDialog.hide(context); return getControlForm(exerciseBloc); } else { return getControlForm(exerciseBloc); diff --git a/lib/view/exercise_execute_page.dart b/lib/view/exercise_execute_page.dart index 5e0193e..8362e65 100644 --- a/lib/view/exercise_execute_page.dart +++ b/lib/view/exercise_execute_page.dart @@ -56,28 +56,27 @@ class _ExerciseExecutePage extends State with Trans { alignment: Alignment.center, ), ), - child: BlocConsumer( - listener: (context, state) { - if (state is ExerciseByPlanError) { - Scaffold.of(context).showSnackBar(SnackBar( - content: Text( - state.message, - ), - backgroundColor: Colors.orange, - )); - } else if (state is ExerciseByPlanLoading) { - LoadingDialog(); - } - }, - - builder: (context, state) { - if (state is ExerciseByPlanStateInitial || state is ExerciseByPlanLoading) { - return Container(); - } else if (state is ExerciseByPlanReady) { - return exerciseWidget(bloc); - } else { - return exerciseWidget(bloc); - } + child: BlocConsumer(listener: (context, state) { + if (state is ExerciseByPlanError) { + //LoadingDialog.hide(context); + Scaffold.of(context).showSnackBar(SnackBar( + content: Text( + state.message, + ), + backgroundColor: Colors.orange, + )); + } else if (state is ExerciseByPlanLoading) { + //LoadingDialog.show(context); + } + }, builder: (context, state) { + if (state is ExerciseByPlanStateInitial || state is ExerciseByPlanLoading) { + return Container(); + } else if (state is ExerciseByPlanReady) { + //LoadingDialog.hide(context); + return exerciseWidget(bloc); + } else { + return exerciseWidget(bloc); + } })), bottomNavigationBar: BottomNavigator(bottomNavIndex: 2), ); @@ -107,14 +106,14 @@ class _ExerciseExecutePage extends State with Trans { ), Text(" "), Flexible( - child: - Text( + child: Text( t("Execute your active Exercise Plan!"), - style: GoogleFonts.archivoBlack(fontSize: 20,), + style: GoogleFonts.archivoBlack( + fontSize: 20, + ), maxLines: 2, ), - ), - + ), ], ), Divider( @@ -130,8 +129,7 @@ class _ExerciseExecutePage extends State with Trans { exerciseTypes.add(explanation); bloc.menuTreeRepository.sortedTree.forEach((name, list) { - exerciseTypes.add( - Container( + exerciseTypes.add(Container( margin: const EdgeInsets.only(left: 4.0), child: TreeViewChild( startExpanded: true, @@ -146,63 +144,47 @@ class _ExerciseExecutePage extends State with Trans { List _getChildList(List listWorkoutTree, ExerciseExecutePlanBloc bloc) { List list = List(); listWorkoutTree.forEach((element) { - - if ( element.selected) { - list.add( - TreeViewChild( + if (element.selected) { + list.add(TreeViewChild( startExpanded: false, - parent: - Card( + parent: Card( margin: EdgeInsets.only(left: 10, top: 5), color: Colors.white54, child: Container( padding: const EdgeInsets.only(left: 5, top: 0, right: 5, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - IconButton( - icon: element.executed ? Icon(Icons.check_box, color: Colors.green): - Icon(Icons.indeterminate_check_box, color: Colors.blue.shade800,), - onPressed: () => { - addExerciseByPlanEvent(bloc, element) - }, - ), - SizedBox(width: 20), - Flexible( - fit:FlexFit.tight, - child: - InkWell( - child: - Text( - element.name, - textAlign: TextAlign.start, - style: GoogleFonts.inter( - fontSize: 17, - color: Colors.black), - - ), - onTap: () => { - addExerciseByPlanEvent(bloc, element) - }, + child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [ + IconButton( + icon: element.executed + ? Icon(Icons.check_box, color: Colors.green) + : Icon( + Icons.indeterminate_check_box, + color: Colors.blue.shade800, + ), + onPressed: () => {addExerciseByPlanEvent(bloc, element)}, + ), + SizedBox(width: 20), + Flexible( + fit: FlexFit.tight, + child: InkWell( + child: Text( + element.name, + textAlign: TextAlign.start, + style: GoogleFonts.inter(fontSize: 17, color: Colors.black), ), - + onTap: () => {addExerciseByPlanEvent(bloc, element)}, ), - IconButton( - - padding: EdgeInsets.all(0), - icon: Icon(Icons.info, color: Colors.black12,), - onPressed: () { - - }, + ), + IconButton( + padding: EdgeInsets.all(0), + icon: Icon( + Icons.info, + color: Colors.black12, ), - - ]), - ) - ), - children: [ - ] - ) - ); + onPressed: () {}, + ), + ]), + )), + children: [])); } }); return list; diff --git a/lib/view/exercise_log_page.dart b/lib/view/exercise_log_page.dart index f54ea03..4106f32 100644 --- a/lib/view/exercise_log_page.dart +++ b/lib/view/exercise_log_page.dart @@ -31,32 +31,24 @@ class _ExerciseLogPage extends State with Trans, Common { setContext(context); return BlocProvider( - create: (context) => ExerciseLogBloc(exerciseRepository: ExerciseRepository()).. - add(ExerciseLogLoad()), - child: BlocConsumer( - listener: (context, state) { - if ( state is ExerciseLogLoading ) { - return LoadingDialog(); - } else if ( state is ExerciseLogError ) { - Scaffold.of(context).showSnackBar(SnackBar( - backgroundColor: Colors.orange, - content: - Text(state.message, style: TextStyle(color: Colors.white)))); + create: (context) => ExerciseLogBloc(exerciseRepository: ExerciseRepository())..add(ExerciseLogLoad()), + child: BlocConsumer(listener: (context, state) { + if (state is ExerciseLogLoading) { + //LoadingDialog.show(context); + } else if (state is ExerciseLogError) { + //LoadingDialog.hide(context); + Scaffold.of(context).showSnackBar( + SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white)))); } - }, - builder: (context, state) { + }, builder: (context, state) { final exerciseBloc = BlocProvider.of(context); - if ( state is ExerciseLogReady ) { + if (state is ExerciseLogReady) { + //LoadingDialog.hide(context); return getExerciseLog(customerId, exerciseBloc); } else { return getExerciseLog(customerId, exerciseBloc); } - } - - ) - ); - - + })); } Widget getExerciseLog(int customerId, ExerciseLogBloc exerciseLogBloc) { @@ -66,8 +58,9 @@ class _ExerciseLogPage extends State with Trans, Common { padding: EdgeInsets.all(20), decoration: BoxDecoration( image: DecorationImage( - image: customerId == Cache().userLoggedIn.customerId ? AssetImage('asset/image/WT_light_background.png'): - AssetImage('asset/image/WT_menu_dark.png'), + image: customerId == Cache().userLoggedIn.customerId + ? AssetImage('asset/image/WT_light_background.png') + : AssetImage('asset/image/WT_menu_dark.png'), fit: BoxFit.cover, alignment: Alignment.center, ), @@ -88,9 +81,9 @@ class _ExerciseLogPage extends State with Trans, Common { List _getTreeChildren(ExerciseLogBloc exerciseLogBloc, int customerId) { final ExerciseRepository exerciseRepository = exerciseLogBloc.exerciseRepository; - if ( customerId == Cache().userLoggedIn.customerId ) { + if (customerId == Cache().userLoggedIn.customerId) { exerciseRepository.exerciseList = exerciseRepository.getExerciseList(); - } else if ( Cache().getTrainee() != null && customerId == Cache().getTrainee().customerId ) { + } else if (Cache().getTrainee() != null && customerId == Cache().getTrainee().customerId) { exerciseRepository.exerciseList = exerciseRepository.getExerciseListTrainee(); } exerciseRepository.sortByDate(); @@ -98,37 +91,34 @@ class _ExerciseLogPage extends State with Trans, Common { List listWidget = List(); Card explanation = Card( - color: Colors.white60, - child: Container( - padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Row( + color: Colors.white60, + child: Container( + padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - Icon( - Icons.info, - color: Colors.orangeAccent, + Row( + children: [ + Icon( + Icons.info, + color: Colors.orangeAccent, + ), + Text(" "), + Text( + t("My Exercise Logs"), + style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + ), + ], + ), + Divider( + color: Colors.transparent, ), - Text(" "), Text( - t("My Exercise Logs"), - style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + t("In this list you will find all your executed exercises grouped by the date."), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.normal), ), ], - ), - Divider( - color: Colors.transparent, - ), - Text( - t("In this list you will find all your executed exercises grouped by the date."), - style: TextStyle(fontSize: 12, fontWeight: FontWeight.normal), - ), - - ], - ) - ) - ); + ))); listWidget.add(explanation); List listExercises = List(); @@ -136,44 +126,35 @@ class _ExerciseLogPage extends State with Trans, Common { exerciseRepository.exerciseList.forEach((exercise) { String exerciseDate = DateFormat("yyyy-MM-dd", AppLanguage().appLocal.toString()).format(exercise.dateAdd); - if ( origDate != exerciseDate) { - if ( origDate.length == 0 ) { + if (origDate != exerciseDate) { + if (origDate.length == 0) { listExercises.add(exercise); origDate = exerciseDate; } else { - listWidget.add( - Container( + listWidget.add(Container( margin: const EdgeInsets.only(left: 4.0), child: TreeViewChild( startExpanded: false, parent: TreeviewParentWidget(text: origDate), children: _getChildList(listExercises, exerciseRepository, exerciseLogBloc), - ) - ) - ); + ))); listExercises = List(); listExercises.add(exercise); origDate = exerciseDate; } - } else { listExercises.add(exercise); origDate = exerciseDate; } - - }); - if ( listExercises.length > 0) { - listWidget.add( - Container( + if (listExercises.length > 0) { + listWidget.add(Container( margin: const EdgeInsets.only(left: 4.0), child: TreeViewChild( startExpanded: true, parent: TreeviewParentWidget(text: origDate), children: _getChildList(listExercises, exerciseRepository, exerciseLogBloc), - ) - ) - ); + ))); } return listWidget; @@ -187,109 +168,105 @@ class _ExerciseLogPage extends State with Trans, Common { ExerciseType exerciseType = exerciseRepository.getExerciseTypeById(exercise.exerciseTypeId); String exerciseName = isEnglish ? exerciseType.name : exerciseType.nameTranslation; - String unitQuantity = exerciseType.unitQuantity == "1" - ? exercise.unitQuantity.toStringAsFixed(0) + - " " + - t(exerciseType.unitQuantityUnit) + - " " - : ""; + String unitQuantity = + exerciseType.unitQuantity == "1" ? exercise.unitQuantity.toStringAsFixed(0) + " " + t(exerciseType.unitQuantityUnit) + " " : ""; - String labelExercise = - unitQuantity + - exercise.quantity.toStringAsFixed(0) + - " " + - t(exercise.unit); + String labelExercise = unitQuantity + exercise.quantity.toStringAsFixed(0) + " " + t(exercise.unit); list.add( - Card( + Card( margin: EdgeInsets.only(left: 10, top: 5), color: Colors.white54, child: Container( padding: const EdgeInsets.only(left: 5, top: 0, right: 5, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - - Icon(Icons.accessibility, color: Colors.black12), - SizedBox(width: 10,), - Flexible( + child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [ + Icon(Icons.accessibility, color: Colors.black12), + SizedBox( + width: 10, + ), + Flexible( + fit: FlexFit.tight, + flex: 8, + child: Text( + exerciseName, + style: TextStyle(fontSize: 12, color: Colors.black), + ), + ), + Flexible( fit: FlexFit.tight, - flex: 8, - child: Text( - exerciseName, - - style: TextStyle(fontSize: 12, color: Colors.black), - ), - ), - Flexible(fit: FlexFit.tight, child: SizedBox(width: 10,)), - Text(labelExercise , style: TextStyle(fontSize: 9, color: Colors.blueAccent.shade700),) , - Flexible(fit: FlexFit.tight, child: SizedBox(width: 10,)), - IconButton( - icon: Icon(Icons.delete, color: Colors.black12), - onPressed: () { - confirmationDialog(exerciseLogBloc, exercise); - }, - ), - - ]), - ) - ), + child: SizedBox( + width: 10, + )), + Text( + labelExercise, + style: TextStyle(fontSize: 9, color: Colors.blueAccent.shade700), + ), + Flexible( + fit: FlexFit.tight, + child: SizedBox( + width: 10, + )), + IconButton( + icon: Icon(Icons.delete, color: Colors.black12), + onPressed: () { + confirmationDialog(exerciseLogBloc, exercise); + }, + ), + ]), + )), ); - }); return list; } - void confirmationDialog( ExerciseLogBloc bloc, Exercise exercise ) { - + void confirmationDialog(ExerciseLogBloc bloc, Exercise exercise) { ExerciseType exerciseType = bloc.exerciseRepository.getExerciseTypeById(exercise.exerciseTypeId); - String exerciseName = AppLanguage().appLocal == Locale("en") - ? exerciseType.name - : exerciseType.nameTranslation; + String exerciseName = AppLanguage().appLocal == Locale("en") ? exerciseType.name : exerciseType.nameTranslation; String strDate = AppLanguage().appLocal == Locale("en") - ? "on the " + DateFormat(DateFormat.YEAR_MONTH_DAY, AppLanguage().appLocal.toString()).format(exercise.dateAdd.toUtc()) - : DateFormat(DateFormat.YEAR_MONTH_DAY, AppLanguage().appLocal.toString()).format(exercise.dateAdd.toUtc()) + "-n"; + ? "on the " + DateFormat(DateFormat.YEAR_MONTH_DAY, AppLanguage().appLocal.toString()).format(exercise.dateAdd.toUtc()) + : DateFormat(DateFormat.YEAR_MONTH_DAY, AppLanguage().appLocal.toString()).format(exercise.dateAdd.toUtc()) + "-n"; showCupertinoDialog( - useRootNavigator: true, - context: context, - //barrierDismissible: false, - builder:(_) => CupertinoAlertDialog( - title: Text(t("Are you sure to delete this exercise?")), - content: Column( - - children: [ - Divider(), - Text(t("Exercise") + ": " + exerciseName, - style: (TextStyle(color: Colors.blue)),), - Text( - exercise.quantity.toStringAsFixed(0) + "x" + exercise.unitQuantity.toStringAsFixed(0) + " " + exerciseType.unitQuantityUnit, - style: (TextStyle(color: Colors.deepOrange)), - ), - Text( - strDate, - style: (TextStyle(color: Colors.deepOrange)), - ), - - ]), - actions: [ - FlatButton( - child: Text(t("No")), - onPressed: () => Navigator.pop(context), - ), - FlatButton( - child: Text(t("Yes")), - onPressed: () => { - print("delete exercise: " + exercise.toJson().toString()), - bloc.add(ExerciseLogDelete(exercise: exercise)), - Navigator.pop(context) - }, - ) - ], - ) - ); + useRootNavigator: true, + context: context, + //barrierDismissible: false, + builder: (_) => CupertinoAlertDialog( + title: Text(t("Are you sure to delete this exercise?")), + content: Column(children: [ + Divider(), + Text( + t("Exercise") + ": " + exerciseName, + style: (TextStyle(color: Colors.blue)), + ), + Text( + exercise.quantity.toStringAsFixed(0) + + "x" + + exercise.unitQuantity.toStringAsFixed(0) + + " " + + exerciseType.unitQuantityUnit, + style: (TextStyle(color: Colors.deepOrange)), + ), + Text( + strDate, + style: (TextStyle(color: Colors.deepOrange)), + ), + ]), + actions: [ + FlatButton( + child: Text(t("No")), + onPressed: () => Navigator.pop(context), + ), + FlatButton( + child: Text(t("Yes")), + onPressed: () => { + print("delete exercise: " + exercise.toJson().toString()), + bloc.add(ExerciseLogDelete(exercise: exercise)), + Navigator.pop(context) + }, + ) + ], + )); } - } diff --git a/lib/view/exercise_new_page.dart b/lib/view/exercise_new_page.dart index 5c14a4c..dec0d3a 100644 --- a/lib/view/exercise_new_page.dart +++ b/lib/view/exercise_new_page.dart @@ -90,13 +90,17 @@ class _ExerciseNewPageState extends State with Trans { child: BlocConsumer( listener: (context, state) { if (state is ExerciseNewLoading) { - return LoadingDialog(); + //LoadingDialog.show(context); } else if (state is ExerciseNewError) { + //LoadingDialog.hide(context); Scaffold.of(context).showSnackBar( SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white)))); } }, builder: (context, state) { + if (state is ExerciseNewReady) { + //LoadingDialog.hide(context); + } final exerciseBloc = BlocProvider.of(context); return getExerciseWidget(exerciseBloc, exerciseType); }, diff --git a/lib/view/exercise_plan_custom_detail_add_page.dart b/lib/view/exercise_plan_custom_detail_add_page.dart index dd04363..3f5db28 100644 --- a/lib/view/exercise_plan_custom_detail_add_page.dart +++ b/lib/view/exercise_plan_custom_detail_add_page.dart @@ -106,13 +106,17 @@ class _ExercisePlanDetailAddPage extends State with T child: BlocConsumer( listener: (context, state) { if (state is ExercisePlanCustomAddLoading) { - return LoadingDialog(); + //LoadingDialog.show(context); } else if (state is ExercisePlanCustomAddError) { + //LoadingDialog.hide(context); Scaffold.of(context).showSnackBar( SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white)))); } }, builder: (context, state) { + if (state is ExercisePlanCustomAddReady) { + //LoadingDialog.hide(context); + } // ignore: close_sinks final bloc = BlocProvider.of(context); return getForm(bloc, workoutMenuTree); diff --git a/lib/view/exercise_plan_custom_page.dart b/lib/view/exercise_plan_custom_page.dart index 9e438e8..948ee00 100644 --- a/lib/view/exercise_plan_custom_page.dart +++ b/lib/view/exercise_plan_custom_page.dart @@ -45,41 +45,39 @@ class _ExercisePlanCustomPage extends State with Trans { setContext(context); return Scaffold( - key: _scaffoldKey, - appBar: AppBarNav(depth: 1), - body: Container( - padding: EdgeInsets.all(20), - decoration: BoxDecoration( - image: DecorationImage( - image: customerId == Cache().userLoggedIn.customerId ? AssetImage('asset/image/WT_menu_dark.png'): - AssetImage('asset/image/WT_menu_dark.png'), - fit: BoxFit.cover, - alignment: Alignment.center, - ), + key: _scaffoldKey, + appBar: AppBarNav(depth: 1), + body: Container( + padding: EdgeInsets.all(20), + decoration: BoxDecoration( + image: DecorationImage( + image: customerId == Cache().userLoggedIn.customerId + ? AssetImage('asset/image/WT_menu_dark.png') + : AssetImage('asset/image/WT_menu_dark.png'), + fit: BoxFit.cover, + alignment: Alignment.center, ), - child: BlocConsumer( - listener: (context, state) { - if (state is ExercisePlanError) { - Scaffold.of(context).showSnackBar(SnackBar( - content: Text( - state.message, - ), - backgroundColor: Colors.orange, - )); - } else if (state is ExercisePlanLoading) { - LoadingDialog(); - } - }, - // ignore: missing_return - builder: (context, state) { - if (state is ExercisePlanReady) { - return exerciseWidget(bloc); - } - return Container(); - + ), + child: BlocConsumer(listener: (context, state) { + if (state is ExercisePlanError) { + Scaffold.of(context).showSnackBar(SnackBar( + content: Text( + state.message, + ), + backgroundColor: Colors.orange, + )); + } else if (state is ExercisePlanLoading) { + //LoadingDialog.show(context); } - ) - ), + }, + // ignore: missing_return + builder: (context, state) { + if (state is ExercisePlanReady) { + //LoadingDialog.hide(context); + return exerciseWidget(bloc); + } + return Container(); + })), bottomNavigationBar: BottomNavigator(bottomNavIndex: 2), ); } @@ -95,47 +93,44 @@ class _ExercisePlanCustomPage extends State with Trans { List exerciseTypes = List(); Card explanation = Card( - color: Colors.white60, - child: Container( - padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Row( + color: Colors.white60, + child: Container( + padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - Icon( - Icons.info, - color: Colors.orangeAccent, + Row( + children: [ + Icon( + Icons.info, + color: Colors.orangeAccent, + ), + Text(" "), + Text( + t("Custom Exercise Plan"), + style: GoogleFonts.archivoBlack(fontSize: 20), + ), + ], + ), + Divider( + color: Colors.transparent, ), - Text(" "), Text( - t("Custom Exercise Plan"), - style: GoogleFonts.archivoBlack(fontSize: 20), + t("Select manually the exercises what you would like to have in your plan. At the end don't forget to save."), + style: GoogleFonts.inter(fontSize: 12, fontWeight: FontWeight.normal), ), ], - ), - Divider( - color: Colors.transparent, - ), - Text( - t("Select manually the exercises what you would like to have in your plan. At the end don't forget to save."), - style: GoogleFonts.inter(fontSize: 12, fontWeight: FontWeight.normal), - ), - - ], - ) - ) - ); + ))); exerciseTypes.add(explanation); - bloc.menuTreeRepository.sortedTree.forEach((name, list) { + bloc.menuTreeRepository.sortedTree.forEach((name, list) { exerciseTypes.add(Container( - margin: const EdgeInsets.only(left: 4.0), - child: TreeViewChild( - startExpanded: false, - parent: TreeviewParentWidget(text: name), - children: _getChildList(list, bloc), - ))); + margin: const EdgeInsets.only(left: 4.0), + child: TreeViewChild( + startExpanded: false, + parent: TreeviewParentWidget(text: name), + children: _getChildList(list, bloc), + ))); }); return exerciseTypes; @@ -144,65 +139,65 @@ class _ExercisePlanCustomPage extends State with Trans { List _getChildList(List listWorkoutTree, ExercisePlanBloc bloc) { List list = List(); listWorkoutTree.forEach((element) { - - list.add( - TreeViewChild( - startExpanded: false, - parent: - Card( + list.add(TreeViewChild( + startExpanded: false, + parent: Card( margin: EdgeInsets.only(left: 10, top: 5), color: Colors.white54, child: Container( padding: const EdgeInsets.only(left: 5, top: 0, right: 5, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - IconButton( - icon: element.selected ? Icon(Icons.check, color: Colors.green[600],) - : Icon(Icons.add, color: Colors.indigo,), - onPressed: () => clickAddDetail(bloc, element), - ), - SizedBox(width: 10), - Flexible( - fit: FlexFit.tight, - flex: 8, - child: - InkWell( - child: - Text( - element.name, - textAlign: TextAlign.start, - style: GoogleFonts.inter(fontSize: 16, color: Colors.black), - ), - onTap: () => clickAddDetail(bloc, element), + child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [ + IconButton( + icon: element.selected + ? Icon( + Icons.check, + color: Colors.green[600], + ) + : Icon( + Icons.add, + color: Colors.indigo, + ), + onPressed: () => clickAddDetail(bloc, element), + ), + SizedBox(width: 10), + Flexible( + fit: FlexFit.tight, + flex: 8, + child: InkWell( + child: Text( + element.name, + textAlign: TextAlign.start, + style: GoogleFonts.inter(fontSize: 16, color: Colors.black), ), - ), - InkWell( - child: - !element.selected || bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId] == null || - bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId].change == null ? Text("") : - Text(bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId].repeats.toString() + - " x " + bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId].weightEquation + - " " + element.exerciseType.unitQuantityUnit, style: TextStyle(fontSize: 9, color: Colors.green),), onTap: () => clickAddDetail(bloc, element), ), - IconButton( - - padding: EdgeInsets.all(0), - icon: Icon(Icons.info, color: Colors.black12,), - onPressed: () { - - }, + ), + InkWell( + child: !element.selected || + bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId] == null || + bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId].change == null + ? Text("") + : Text( + bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId].repeats.toString() + + " x " + + bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId].weightEquation + + " " + + element.exerciseType.unitQuantityUnit, + style: TextStyle(fontSize: 9, color: Colors.green), + ), + onTap: () => clickAddDetail(bloc, element), + ), + IconButton( + padding: EdgeInsets.all(0), + icon: Icon( + Icons.info, + color: Colors.black12, ), - - ]), - ) - ), - children: [ - ] - ) - ); - + onPressed: () {}, + ), + ]), + )), + children: [])); }); return list; } diff --git a/lib/view/login.dart b/lib/view/login.dart index 0aa0763..b76d6ce 100644 --- a/lib/view/login.dart +++ b/lib/view/login.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_form_bloc/flutter_form_bloc.dart'; +import 'package:google_fonts/google_fonts.dart'; import '../library_keys.dart'; @@ -133,27 +134,37 @@ class _LoginWidget extends State with Common, Trans { color: Colors.transparent, ), Row(mainAxisAlignment: MainAxisAlignment.end, children: [ - new FlatButton( + FlatButton( key: LibraryKeys.loginOKButton, - child: Image.asset('asset/image/WT_OK.png', width: 100, height: 100), + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset('asset/icon/gomb_zold_a.png', width: 140, height: 60), + Text( + t("OK"), + style: GoogleFonts.archivoBlack(fontSize: 20, color: Colors.white), + ), + ], + ), + //Image.asset('asset/icon/gomb_zold_b-1.png', width: 100, height: 100), onPressed: () => {formBloc.add(SubmitFormBloc())}), ]), Divider( color: Colors.transparent, ), Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - new InkWell( - child: new Text(AppLocalizations.of(context).translate('SignUp')), + InkWell( + child: Text(AppLocalizations.of(context).translate('SignUp')), onTap: () => Navigator.of(context).pushNamed('registration'), ), Spacer(flex: 2), - new InkWell( - child: new Text(AppLocalizations.of(context).translate('I forgot the password')), + InkWell( + child: Text(AppLocalizations.of(context).translate('I forgot the password')), onTap: () => Navigator.of(context).pushNamed('resetPassword'), ), Spacer(flex: 2), - new InkWell( - child: new Text(AppLocalizations.of(context).translate('Privacy')), + InkWell( + child: Text(AppLocalizations.of(context).translate('Privacy')), onTap: () => Navigator.of(context).pushNamed('gdpr'), ), ]), diff --git a/lib/view/mydevelopment_muscle_page.dart b/lib/view/mydevelopment_muscle_page.dart index 8c40728..969706f 100644 --- a/lib/view/mydevelopment_muscle_page.dart +++ b/lib/view/mydevelopment_muscle_page.dart @@ -63,13 +63,14 @@ class _MyDevelopmentMuscleState extends State with Comm backgroundColor: Colors.orange, )); } else if (state is DevelopmentByMuscleLoadingState) { - LoadingDialog(); + //LoadingDialog.show(context); } }, builder: (context, state) { if (state is DevelopmentByMuscleStateInitial) { return Container(); } else { + //LoadingDialog.hide(context); return TreeView( startExpanded: false, children: _getTreeChildren(bloc.workoutTreeRepository.sortedTree, bloc), @@ -116,35 +117,30 @@ class _MyDevelopmentMuscleState extends State with Comm mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ ChoiceChip( - avatar: Icon(Icons.bubble_chart,), + avatar: Icon( + Icons.bubble_chart, + ), label: Text(t('Sum Of Mass')), - - labelStyle: TextStyle(fontSize: 9,color: Colors.black), + labelStyle: TextStyle(fontSize: 9, color: Colors.black), selectedColor: Colors.lightBlueAccent, selected: bloc.diagramType == DiagramType.sumMass, - onSelected: (value) => { - bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.sumMass)) - }, + onSelected: (value) => {bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.sumMass))}, ), ChoiceChip( avatar: Icon(Icons.accessibility_new), label: Text(t('One Max Rep')), - labelStyle: TextStyle(fontSize: 9,color: Colors.black), + labelStyle: TextStyle(fontSize: 9, color: Colors.black), selectedColor: Colors.lightBlueAccent, selected: bloc.diagramType == DiagramType.oneRepMax, - onSelected: (value) => { - bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.oneRepMax)) - }, + onSelected: (value) => {bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.oneRepMax))}, ), ChoiceChip( avatar: Icon(Icons.perm_device_information), label: Text(t('Percent')), - labelStyle: TextStyle(fontSize: 9,color: Colors.black), + labelStyle: TextStyle(fontSize: 9, color: Colors.black), selectedColor: Colors.lightBlueAccent, selected: bloc.diagramType == DiagramType.percent, - onSelected: (value) => { - bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.percent)) - }, + onSelected: (value) => {bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.percent))}, ), ], ), @@ -158,10 +154,7 @@ class _MyDevelopmentMuscleState extends State with Comm disabledColor: Colors.black26, selectedColor: Colors.greenAccent, selected: bloc.dateRate == DateRate.daily, - onSelected: (value) => { - bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.daily)) - }, - + onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.daily))}, ), ChoiceChip( avatar: Icon(Icons.timer), @@ -171,10 +164,7 @@ class _MyDevelopmentMuscleState extends State with Comm disabledColor: Colors.white12, tooltip: "Heti bontás", selected: bloc.dateRate == DateRate.weekly, - onSelected: (value) => { - bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.weekly)) - }, - + onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.weekly))}, ), ChoiceChip( avatar: Icon(Icons.timer), @@ -183,10 +173,7 @@ class _MyDevelopmentMuscleState extends State with Comm selectedColor: Colors.greenAccent, disabledColor: Colors.black26, selected: bloc.dateRate == DateRate.monthly, - onSelected: (value) => { - bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.monthly)) - }, - + onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.monthly))}, ), ChoiceChip( avatar: Icon(Icons.timer), @@ -195,16 +182,12 @@ class _MyDevelopmentMuscleState extends State with Comm selectedColor: Colors.greenAccent, disabledColor: Colors.white70, selected: bloc.dateRate == DateRate.yearly, - onSelected: (value) => { - bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.yearly)) - }, + onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.yearly))}, ), ], ) ], - ) - ) - ); + ))); exerciseTypes.add(explanation); tree.forEach((name, list) { @@ -229,14 +212,14 @@ class _MyDevelopmentMuscleState extends State with Comm listWorkoutTree.forEach((element) { bool hasNoData = (bloc.listChartData[element.exerciseTypeId] == null); String unit = " kg"; - if ( bloc.diagramType == DiagramType.percent) { + if (bloc.diagramType == DiagramType.percent) { unit = " %"; } list.add(SizedBox( width: cWidth * 0.85, height: hasNoData ? 0 : 200, child: Container( - padding: const EdgeInsets.only(left:5, top:5, right:5, bottom: 5), + padding: const EdgeInsets.only(left: 5, top: 5, right: 5, bottom: 5), color: Colors.white70, child: Column(mainAxisSize: MainAxisSize.min, children: [ hasNoData @@ -253,58 +236,56 @@ class _MyDevelopmentMuscleState extends State with Comm //fit: FlexFit.loose, child: BarChart( BarChartData( - alignment: BarChartAlignment.spaceAround, - barTouchData: BarTouchData( - touchTooltipData: BarTouchTooltipData( - tooltipBgColor: Colors.white70, - getTooltipItem: (group, groupIndex, rod, rodIndex) { - return BarTooltipItem( - rod.y.toStringAsFixed(0) + unit, - TextStyle(color: Colors.black54, fontSize: 12, fontWeight: FontWeight.bold), - ); - }), - ), - titlesData: FlTitlesData( - show: true, - bottomTitles: SideTitles( - showTitles: true, - getTextStyles: (_) => TextStyle(fontSize: 8, color: Colors.blueGrey), - getTitles: (double value) { - var date = new DateTime.fromMillisecondsSinceEpoch(value.toInt()); - //String strDate = DateFormat('MM.dd.', AppLanguage().appLocal.toString()).format(date); - String strDate = getDatePart(date, bloc.dateRate); - return strDate; - }, - ), - leftTitles: SideTitles( + alignment: BarChartAlignment.spaceAround, + barTouchData: BarTouchData( + touchTooltipData: BarTouchTooltipData( + tooltipBgColor: Colors.white70, + getTooltipItem: (group, groupIndex, rod, rodIndex) { + return BarTooltipItem( + rod.y.toStringAsFixed(0) + unit, + TextStyle(color: Colors.black54, fontSize: 12, fontWeight: FontWeight.bold), + ); + }), + ), + titlesData: FlTitlesData( + show: true, + bottomTitles: SideTitles( showTitles: true, getTextStyles: (_) => TextStyle(fontSize: 8, color: Colors.blueGrey), - interval: bloc.listChartData[element.exerciseTypeId] == null - ? 100 - : bloc.listChartData[element.exerciseTypeId].interval, - margin: 10, getTitles: (double value) { - return value.toStringAsFixed(0) + unit; - })), - borderData: FlBorderData( - show: false, + var date = new DateTime.fromMillisecondsSinceEpoch(value.toInt()); + //String strDate = DateFormat('MM.dd.', AppLanguage().appLocal.toString()).format(date); + String strDate = getDatePart(date, bloc.dateRate); + return strDate; + }, + ), + leftTitles: SideTitles( + showTitles: true, + getTextStyles: (_) => TextStyle(fontSize: 8, color: Colors.blueGrey), + interval: bloc.listChartData[element.exerciseTypeId] == null + ? 100 + : bloc.listChartData[element.exerciseTypeId].interval, + margin: 10, + getTitles: (double value) { + return value.toStringAsFixed(0) + unit; + })), + borderData: FlBorderData( + show: false, + ), + gridData: FlGridData( + show: true, + checkToShowHorizontalLine: (value) => value % bloc.listChartData[element.exerciseTypeId].gridInterval == 0, + getDrawingHorizontalLine: (value) { + return FlLine( + color: Colors.black26, + strokeWidth: 0.5, + ); + }, + ), + groupsSpace: 2, + barGroups: + bloc.listChartData[element.exerciseTypeId] == null ? [] : bloc.listChartData[element.exerciseTypeId].data, ), - gridData: FlGridData( - show: true, - checkToShowHorizontalLine: (value) => - value % bloc.listChartData[element.exerciseTypeId].gridInterval == 0, - getDrawingHorizontalLine: (value) { - return FlLine( - color: Colors.black26, - strokeWidth: 0.5, - ); - }, - ), - groupsSpace: 2, - barGroups: bloc.listChartData[element.exerciseTypeId] == null - ? [] - : bloc.listChartData[element.exerciseTypeId].data, - ), swapAnimationDuration: Duration(milliseconds: 1200), ), ) @@ -316,5 +297,3 @@ class _MyDevelopmentMuscleState extends State with Comm return list; } } - - diff --git a/lib/view/registration.dart b/lib/view/registration.dart index cb89508..0f87023 100644 --- a/lib/view/registration.dart +++ b/lib/view/registration.dart @@ -12,6 +12,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; //import 'package:flutter_facebook_login/flutter_facebook_login.dart'; import 'package:flutter_form_bloc/flutter_form_bloc.dart'; +import 'package:google_fonts/google_fonts.dart'; import '../library_keys.dart'; @@ -137,7 +138,17 @@ class _RegistrationWidget extends State with Common, Trans { ), Row(mainAxisAlignment: MainAxisAlignment.end, children: [ new FlatButton( - child: Image.asset('asset/image/WT_OK.png', width: 100, height: 100), + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset('asset/icon/gomb_zold_a.png', width: 140, height: 60), + Text( + t("OK"), + style: GoogleFonts.archivoBlack(fontSize: 20, color: Colors.white), + ), + ], + ), + // Image.asset('asset/image/WT_OK.png', width: 100, height: 100), onPressed: () => {registrationBloc.add(SubmitFormBloc())}), ]), Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ diff --git a/lib/view/reset_password.dart b/lib/view/reset_password.dart index 44935a7..20eb9b6 100644 --- a/lib/view/reset_password.dart +++ b/lib/view/reset_password.dart @@ -8,6 +8,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_form_bloc/flutter_form_bloc.dart'; +import 'package:google_fonts/google_fonts.dart'; import '../library_keys.dart'; @@ -66,6 +67,9 @@ class ResetPasswordPage extends StatelessWidget with Trans { child: Container( padding: const EdgeInsets.only(left: 25, right: 50), child: ListView(shrinkWrap: false, padding: EdgeInsets.only(top: 150.0), children: [ + Divider( + color: Colors.transparent, + ), Divider(), Row( mainAxisAlignment: MainAxisAlignment.start, @@ -95,7 +99,17 @@ class ResetPasswordPage extends StatelessWidget with Trans { Row(mainAxisAlignment: MainAxisAlignment.end, children: [ new FlatButton( key: LibraryKeys.loginOKButton, - child: Image.asset('asset/image/WT_OK.png', width: 100, height: 100), + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset('asset/icon/gomb_zold_a.png', width: 140, height: 60), + Text( + t("OK"), + style: GoogleFonts.archivoBlack(fontSize: 20, color: Colors.white), + ), + ], + ), + //Image.asset('asset/image/WT_OK.png', width: 100, height: 100), onPressed: () => {formBloc.add(SubmitFormBloc())}), ]), Divider( diff --git a/lib/view/settings.dart b/lib/view/settings.dart index 57cdc97..7d2da2c 100644 --- a/lib/view/settings.dart +++ b/lib/view/settings.dart @@ -8,10 +8,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; - - -class SettingsPage extends StatelessWidget{ - +class SettingsPage extends StatelessWidget { @override Widget build(BuildContext context) { // ignore: close_sinks @@ -40,75 +37,54 @@ class SettingsPage extends StatelessWidget{ decoration: BoxDecoration( image: DecorationImage( image: AssetImage('asset/image/WT_light_background.png'), - fit: BoxFit.cover, - alignment: Alignment.center, - ), - ), - child: Form( - child: BlocConsumer( - listener: (context, state) { - if ( state is SettingsError ) { - - } else if ( state is SettingsReady ) { - menuBloc.add(MenuRecreateTree()); - } - }, - // ignore: missing_return - builder: (context, state) { - if ( state is SettingsLoading ) { - return LoadingDialog(); - } else if ( state is SettingsInitial) { - return settingsUI(context, settingsBloc, menuBloc); - } else if ( state is SettingsReady ) { - return settingsUI(context, settingsBloc, menuBloc); - } else { - return Container(); - } - } - ), + fit: BoxFit.cover, + alignment: Alignment.center, ), + ), + child: Form( + child: BlocConsumer(listener: (context, state) { + if (state is SettingsError) { + } else if (state is SettingsReady) { + menuBloc.add(MenuRecreateTree()); + } + }, + // ignore: missing_return + builder: (context, state) { + if (state is SettingsLoading) { + //LoadingDialog.show(context); + } else if (state is SettingsInitial) { + return settingsUI(context, settingsBloc, menuBloc); + } else if (state is SettingsReady) { + //LoadingDialog.hide(context); + return settingsUI(context, settingsBloc, menuBloc); + } else { + return Container(); + } + }), + ), ), - bottomNavigationBar: BottomNavigator(bottomNavIndex: 4) - - ); + bottomNavigationBar: BottomNavigator(bottomNavIndex: 4)); } ListView settingsUI(BuildContext context, SettingsBloc settingsBloc, MenuBloc menuBloc) { - return ListView( - padding: EdgeInsets.only(top: 150), - children: [ - ListTile( + return ListView(padding: EdgeInsets.only(top: 150), children: [ + ListTile( leading: Icon(Icons.language), - subtitle: Text( - AppLocalizations.of(context).translate( - "Change App Language")), + subtitle: Text(AppLocalizations.of(context).translate("Change App Language")), title: DropdownButton( - - value: settingsBloc.getLocale() == Locale('en') - ? AppLocalizations.of(context).translate( - "English") - : AppLocalizations.of(context).translate( - "Hungarian"), - items: [AppLocalizations.of(context).translate( - "English"), AppLocalizations.of(context) - .translate("Hungarian") - ] - .map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - onChanged: (String lang) => - { - settingsBloc.add( - SettingsChangeLanguage(language: lang) - ), - } - ) - - ), - ] - ); + value: settingsBloc.getLocale() == Locale('en') + ? AppLocalizations.of(context).translate("English") + : AppLocalizations.of(context).translate("Hungarian"), + items: [AppLocalizations.of(context).translate("English"), AppLocalizations.of(context).translate("Hungarian")] + .map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + onChanged: (String lang) => { + settingsBloc.add(SettingsChangeLanguage(language: lang)), + })), + ]); } -} \ No newline at end of file +} diff --git a/lib/widgets/bmi_widget.dart b/lib/widgets/bmi_widget.dart index e4ddc8a..ee80ce2 100644 --- a/lib/widgets/bmi_widget.dart +++ b/lib/widgets/bmi_widget.dart @@ -72,6 +72,10 @@ class _BMIState extends State with Trans { Widget build(BuildContext context) { setContext(context); Flurry.logEvent("BMI"); + double mediaWidth = MediaQuery.of(context).size.width * .8; + double mediaHeight = MediaQuery.of(context).size.height * .8; + //print("w " + mediaWidth.toString() + "h " + mediaHeight.toString()); + widget.exerciseBloc.setMediaDimensions(mediaWidth, mediaHeight); widget.exerciseBloc.getBMI(); return Form( child: Scaffold(