diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index aa1d27c..e4ac9f4 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 = 29; + CURRENT_PROJECT_VERSION = 30; 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 = 29; + CURRENT_PROJECT_VERSION = 30; 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 = 29; + CURRENT_PROJECT_VERSION = 30; DEVELOPMENT_TEAM = SFJJBDCU6Z; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/lib/bloc/exercise_new/exercise_new_bloc.dart b/lib/bloc/exercise_new/exercise_new_bloc.dart index 57006a3..9ccb483 100644 --- a/lib/bloc/exercise_new/exercise_new_bloc.dart +++ b/lib/bloc/exercise_new/exercise_new_bloc.dart @@ -38,8 +38,11 @@ class ExerciseNewBloc extends Bloc { final List womanSizes = List(); final List manSizes = List(); + final double baseWidth = 312; + final double baseHeight = 675.2; double mediaWidth = 0; double mediaHeight = 0; + bool isMan = true; @override ExerciseNewBloc({this.exerciseRepository, this.menuBloc, this.customerRepository, ExerciseType exerciseType}) @@ -52,6 +55,8 @@ class ExerciseNewBloc extends Bloc { weight = customerRepository.customer.getProperty("Weight"); height = customerRepository.customer.getProperty("Height"); fitnessLevel = customerRepository.customer.fitnessLevel; + this.isMan = (customerRepository.customer.sex == "m"); + print("Sex Man? " + isMan.toString() + " " + customerRepository.customer.sex); } } @@ -63,66 +68,72 @@ class ExerciseNewBloc extends Bloc { void addSizes(String sex) { List properties = Cache().getProperties(); - if (sex == "Man") { + if (properties == null) { + return; + } + final double distortionWidth = mediaWidth / baseWidth; + final double distortionHeight = mediaHeight / baseHeight; + print("distiortionW " + distortionWidth.toString() + " dH " + distortionHeight.toString()); + if (isMan) { properties.forEach((element) { if (element.propertyName == "Shoulder") { - element.top = (mediaHeight * 0.131).toInt(); - element.left = (mediaWidth * 0.23).toInt(); + element.top = (122 * distortionHeight).toInt(); + element.left = (130 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Shoulder"); manSizes.add(element); } else if (element.propertyName == "Neck") { - element.top = (mediaHeight * 0.069).toInt(); - element.left = (mediaWidth * 0.23).toInt(); + element.top = (68 * distortionHeight).toInt(); + element.left = (130 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Neck"); manSizes.add(element); } else if (element.propertyName == "Biceps") { - element.top = (mediaHeight * 0.199).toInt(); - element.left = (mediaWidth * 0.44).toInt(); + element.top = (178 * distortionHeight).toInt(); + element.left = (208 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Biceps"); manSizes.add(element); } else if (element.propertyName == "Chest") { - element.top = (mediaHeight * 0.171).toInt(); - element.left = (mediaWidth * 0.23).toInt(); + element.top = (154 * distortionHeight).toInt(); + element.left = (130 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Chest"); manSizes.add(element); } else if (element.propertyName == "Belly") { - element.top = (mediaHeight * 0.275).toInt(); - element.left = (mediaWidth * 0.23).toInt(); + element.top = (244 * distortionHeight).toInt(); + element.left = (130 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Belly"); manSizes.add(element); } else if (element.propertyName == "Hip") { - element.top = (mediaHeight * 0.355).toInt(); - element.left = (mediaWidth * 0.23).toInt(); + element.top = (308 * distortionHeight).toInt(); + element.left = (130 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Hip"); manSizes.add(element); } else if (element.propertyName == "Thigh Top") { - element.top = (mediaHeight * 0.38).toInt(); - element.left = (mediaWidth * 0.32).toInt(); + element.top = (332 * distortionHeight).toInt(); + element.left = (165 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Thigh Top"); manSizes.add(element); } else if (element.propertyName == "Thigh Middle") { - element.top = (mediaHeight * 0.438).toInt(); - element.left = (mediaWidth * 0.14).toInt(); + element.top = (382 * distortionHeight).toInt(); + element.left = (100 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Thigh Middle"); manSizes.add(element); } else if (element.propertyName == "Knee") { - element.top = (mediaHeight * 0.535).toInt(); - element.left = (mediaWidth * 0.14).toInt(); + element.top = (464 * distortionHeight).toInt(); + element.left = (97 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Knee"); manSizes.add(element); } else if (element.propertyName == "Calf") { - element.top = (mediaHeight * 0.60).toInt(); - element.left = (mediaWidth * 0.14).toInt(); + element.top = (520 * distortionHeight).toInt(); + element.left = (97 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Calf"); manSizes.add(element); } else if (element.propertyName == "Ankle") { - element.top = (mediaHeight * 0.72).toInt(); - element.left = (mediaWidth * 0.28).toInt(); + element.top = (620 * distortionHeight).toInt(); + element.left = (150 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Ankle"); manSizes.add(element); } else if (element.propertyName == "Weight") { - element.top = (mediaHeight * 0.44).toInt(); - element.left = (mediaWidth * 0.54).toInt(); + element.top = (402 * distortionHeight).toInt(); + element.left = (240 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Weight"); manSizes.add(element); } @@ -130,63 +141,65 @@ class ExerciseNewBloc extends Bloc { } else { properties.forEach((element) { if (element.propertyName == "Shoulder") { - element.top = (mediaHeight * 0.131).toInt(); - element.left = (mediaWidth * 0.195).toInt(); + element.top = (122 * distortionHeight).toInt(); + element.left = (151 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Shoulder"); + print("CHEST top: " + element.top.toString() + " left " + element.left.toString()); manSizes.add(element); } else if (element.propertyName == "Neck") { - element.top = (mediaHeight * 0.081).toInt(); - element.left = (mediaWidth * 0.195).toInt(); + element.top = (78 * distortionHeight).toInt(); + element.left = (151 * distortionWidth).toInt(); + print("Neck top: " + element.top.toString() + " left " + element.left.toString()); element.value = customerRepository.customer.getProperty("Neck"); manSizes.add(element); } else if (element.propertyName == "Biceps") { - element.top = (mediaHeight * 0.199).toInt(); - element.left = (mediaWidth * 0.36).toInt(); + element.top = (178 * distortionHeight).toInt(); + element.left = (212 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Biceps"); manSizes.add(element); } else if (element.propertyName == "Chest") { - element.top = (mediaHeight * 0.168).toInt(); - element.left = (mediaWidth * 0.195).toInt(); + element.top = (154 * distortionHeight).toInt(); + element.left = (151 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Chest"); manSizes.add(element); } else if (element.propertyName == "Belly") { - element.top = (mediaHeight * 0.26).toInt(); - element.left = (mediaWidth * 0.195).toInt(); + element.top = (230 * distortionHeight).toInt(); + element.left = (151 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Belly"); manSizes.add(element); } else if (element.propertyName == "Hip") { - element.top = (mediaHeight * 0.335).toInt(); - element.left = (mediaWidth * 0.195).toInt(); + element.top = (294 * distortionHeight).toInt(); + element.left = (151 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Hip"); manSizes.add(element); } else if (element.propertyName == "Thigh Top") { - element.top = (mediaHeight * 0.385).toInt(); - element.left = (mediaWidth * 0.28).toInt(); + element.top = (335 * distortionHeight).toInt(); + element.left = (185 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Thigh Top"); manSizes.add(element); } else if (element.propertyName == "Thigh Middle") { - element.top = (mediaHeight * 0.433).toInt(); - element.left = (mediaWidth * 0.12).toInt(); + element.top = (377 * distortionHeight).toInt(); + element.left = (125 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Thigh Middle"); manSizes.add(element); } else if (element.propertyName == "Knee") { - element.top = (mediaHeight * 0.543).toInt(); - element.left = (mediaWidth * 0.14).toInt(); + element.top = (468 * distortionHeight).toInt(); + element.left = (129 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Knee"); manSizes.add(element); } else if (element.propertyName == "Calf") { - element.top = (mediaHeight * 0.608).toInt(); - element.left = (mediaWidth * 0.14).toInt(); + element.top = (525 * distortionHeight).toInt(); + element.left = (129 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Calf"); manSizes.add(element); } else if (element.propertyName == "Ankle") { - element.top = (mediaHeight * 0.725).toInt(); - element.left = (mediaWidth * 0.23).toInt(); + element.top = (620 * distortionHeight).toInt(); + element.left = (162 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Ankle"); manSizes.add(element); } else if (element.propertyName == "Weight") { - element.top = (mediaHeight * 0.44).toInt(); - element.left = (mediaWidth * 0.54).toInt(); + element.top = (402 * distortionHeight).toInt(); + element.left = (240 * distortionWidth).toInt(); element.value = customerRepository.customer.getProperty("Weight"); manSizes.add(element); } diff --git a/lib/view/exercise_new_page.dart b/lib/view/exercise_new_page.dart index 188a6b7..5c14a4c 100644 --- a/lib/view/exercise_new_page.dart +++ b/lib/view/exercise_new_page.dart @@ -98,9 +98,6 @@ class _ExerciseNewPageState extends State with Trans { }, builder: (context, state) { final exerciseBloc = BlocProvider.of(context); - double width = MediaQuery.of(context).size.width; - double height = MediaQuery.of(context).size.height; - exerciseBloc.setMediaDimensions(width, height); return getExerciseWidget(exerciseBloc, exerciseType); }, )); diff --git a/lib/view/login.dart b/lib/view/login.dart index 542be44..3b04e5a 100644 --- a/lib/view/login.dart +++ b/lib/view/login.dart @@ -35,32 +35,26 @@ class _LoginWidget extends State with Common, Trans { final accountBloc = BlocProvider.of(context); setContext(context); return BlocProvider( - create: (context) => LoginFormBloc( - userRepository: UserRepository(), - accountBloc: accountBloc - ), + create: (context) => LoginFormBloc(userRepository: UserRepository(), accountBloc: accountBloc), child: Builder(builder: (context) { final loginBloc = BlocProvider.of(context); return Scaffold( - key: _scaffoldKey, + //key: _scaffoldKey, appBar: AppBarMin(), body: FormBlocListener( - onSubmitting: (context, state) { - LoadingDialog.show(context); - }, - onSuccess: (context, state) { - LoadingDialog.hide(context); - Navigator.of(context).pushNamed('home'); - }, - onFailure: (context, state) { - LoadingDialog.hide(context); - showInSnackBar(t(state.failureResponse)); - }, - onLoaded: (context, state ) { - - }, - child: loadForm(loginBloc, accountBloc) - ), + onSubmitting: (context, state) { + LoadingDialog.show(context); + }, + onSuccess: (context, state) { + LoadingDialog.hide(context); + Navigator.of(context).pushNamed('home'); + }, + onFailure: (context, state) { + LoadingDialog.hide(context); + showInSnackBar(t(state.failureResponse)); + }, + onLoaded: (context, state) {}, + child: loadForm(loginBloc, accountBloc)), ); })); } @@ -83,16 +77,13 @@ class _LoginWidget extends State with Common, Trans { } Widget buildLoginForm(LoginFormBloc formBloc, AccountBloc accountBloc) { - return Form( key: _scaffoldKey, child: Container( padding: const EdgeInsets.only(left: 15, right: 50), - child: - ListView(shrinkWrap: false, padding: EdgeInsets.only(top: 150.0), - children: [ - Divider(color: Colors.transparent), - /* FlatButton( + child: ListView(shrinkWrap: false, padding: EdgeInsets.only(top: 150.0), children: [ + Divider(color: Colors.transparent), + /* FlatButton( child: new Image.asset( 'asset/image/login_fb.png', width: cWidth * .85, @@ -104,89 +95,73 @@ class _LoginWidget extends State with Common, Trans { }, ), Text(AppLocalizations.of(context).translate("OR")),*/ - Divider(), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - new InkWell( - child: new Text( - AppLocalizations.of(context).translate('Login'), - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 24)), - ), - ], + Divider(), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + new InkWell( + child: new Text(AppLocalizations.of(context).translate('Login'), + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 24)), ), - Divider(), - TextFieldBlocBuilder( - key: LibraryKeys.loginEmailField, - textFieldBloc: formBloc.emailField, - decoration: InputDecoration( - fillColor: Colors.white, - filled: true, - labelText: 'Email', - ), - ), - Divider( - color: Colors.transparent, - ), - TextFieldBlocBuilder( - key: LibraryKeys.loginPasswordField, - textFieldBloc: formBloc.passwordField, - decoration: InputDecoration( - fillColor: Colors.white, - filled: true, - labelText: 'Password', - ), - suffixButton: SuffixButton.obscureText, - ), - Divider( - color: Colors.transparent, - ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - new FlatButton( - key: LibraryKeys.loginOKButton, - child: Image.asset('asset/image/WT_OK.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')), - onTap: () => - Navigator.of(context).pushNamed('registration'), - ), - Spacer(flex: 2), - new InkWell( - child: new 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')), - onTap: () => Navigator.of(context).pushNamed('gdpr'), - ), - ]), - ])), + ], + ), + Divider(), + TextFieldBlocBuilder( + key: LibraryKeys.loginEmailField, + textFieldBloc: formBloc.emailField, + decoration: InputDecoration( + fillColor: Colors.white, + filled: true, + labelText: 'Email', + ), + ), + Divider( + color: Colors.transparent, + ), + TextFieldBlocBuilder( + key: LibraryKeys.loginPasswordField, + textFieldBloc: formBloc.passwordField, + decoration: InputDecoration( + fillColor: Colors.white, + filled: true, + labelText: 'Password', + ), + suffixButton: SuffixButton.obscureText, + ), + Divider( + color: Colors.transparent, + ), + Row(mainAxisAlignment: MainAxisAlignment.end, children: [ + new FlatButton( + key: LibraryKeys.loginOKButton, + child: Image.asset('asset/image/WT_OK.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')), + onTap: () => Navigator.of(context).pushNamed('registration'), + ), + Spacer(flex: 2), + new InkWell( + child: new 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')), + onTap: () => Navigator.of(context).pushNamed('gdpr'), + ), + ]), + ])), ); } - void showInSnackBar(String error) { - _scaffoldKey.currentState.showSnackBar(SnackBar( - backgroundColor: Colors.orange, - content: Text(error, style: TextStyle(color: Colors.white)))); + _scaffoldKey.currentState + .showSnackBar(SnackBar(backgroundColor: Colors.orange, content: Text(error, style: TextStyle(color: Colors.white)))); } - } diff --git a/lib/view/registration.dart b/lib/view/registration.dart index beb5645..12c8c71 100644 --- a/lib/view/registration.dart +++ b/lib/view/registration.dart @@ -20,8 +20,7 @@ class RegistrationPage extends StatelessWidget { @override Widget build(BuildContext context) { - return RegistrationWidget( - userRepository: userRepository, customerRepository: customerRepository); + return RegistrationWidget(userRepository: userRepository, customerRepository: customerRepository); } } @@ -37,20 +36,16 @@ class RegistrationWidget extends StatefulWidget { class _RegistrationWidget extends State with Common { final GlobalKey _scaffoldKey = new GlobalKey(); - final _formKey = GlobalKey(); @override Widget build(BuildContext context) { - final cWidth = mediaSizeWidth(context); // ignore: close_sinks final accountBloc = BlocProvider.of(context); return BlocProvider( - create: (context) => RegistrationFormBloc( - userRepository: UserRepository(), accountBloc: accountBloc), + create: (context) => RegistrationFormBloc(userRepository: UserRepository(), accountBloc: accountBloc), child: Builder(builder: (context) { // ignore: close_sinks - final registrationBloc = - BlocProvider.of(context); + final registrationBloc = BlocProvider.of(context); return Scaffold( key: _scaffoldKey, @@ -80,12 +75,9 @@ class _RegistrationWidget extends State with Common { ), ), child: Form( - key: _formKey, child: Container( padding: const EdgeInsets.only(left: 25, right: 50), - child: ListView( - shrinkWrap: false, - padding: EdgeInsets.only(top: 150.0), + child: ListView(shrinkWrap: false, padding: EdgeInsets.only(top: 150.0), //mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Divider( @@ -109,12 +101,8 @@ class _RegistrationWidget extends State with Common { mainAxisAlignment: MainAxisAlignment.start, children: [ new InkWell( - child: new Text( - AppLocalizations.of(context) - .translate('SignUp'), - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 24)), + child: new Text(AppLocalizations.of(context).translate('SignUp'), + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 24)), ), ], ), @@ -144,40 +132,23 @@ class _RegistrationWidget extends State with Common { Divider( color: Colors.transparent, ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - new FlatButton( - child: Image.asset( - 'asset/image/WT_OK.png', - width: 100, - height: 100), - onPressed: () => { - registrationBloc - .add(SubmitFormBloc()) - }), - ]), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - new InkWell( - child: new Text( - AppLocalizations.of(context) - .translate('Login')), - onTap: () => Navigator.of(context) - .pushNamed('login'), - ), - Spacer(flex: 1), - new InkWell( - child: new Text( - AppLocalizations.of(context) - .translate('Privacy')), - onTap: () => Navigator.of(context) - .pushNamed('gdpr'), - ), - Spacer(flex: 2), - ]), + Row(mainAxisAlignment: MainAxisAlignment.end, children: [ + new FlatButton( + child: Image.asset('asset/image/WT_OK.png', width: 100, height: 100), + onPressed: () => {registrationBloc.add(SubmitFormBloc())}), + ]), + Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ + new InkWell( + child: new Text(AppLocalizations.of(context).translate('Login')), + onTap: () => Navigator.of(context).pushNamed('login'), + ), + Spacer(flex: 1), + new InkWell( + child: new Text(AppLocalizations.of(context).translate('Privacy')), + onTap: () => Navigator.of(context).pushNamed('gdpr'), + ), + Spacer(flex: 2), + ]), //Spacer(flex:2), ])), ), @@ -191,11 +162,7 @@ class _RegistrationWidget extends State with Common { void showInSnackBar(String error) { _scaffoldKey.currentState.showSnackBar(SnackBar( backgroundColor: Colors.orange, - content: Text( - AppLocalizations.of(context) - .translate("There is an error: during registration:") + - " " + - error, + content: Text(AppLocalizations.of(context).translate("There is an error: during registration:") + " " + error, style: TextStyle(color: Colors.white)))); } } diff --git a/lib/widgets/input_dialog_widget.dart b/lib/widgets/input_dialog_widget.dart index 064fc27..df299ea 100644 --- a/lib/widgets/input_dialog_widget.dart +++ b/lib/widgets/input_dialog_widget.dart @@ -68,7 +68,7 @@ class _InputDialogState extends State> with Trans { _buildChild(BuildContext context) => Container( height: 350, - decoration: BoxDecoration(color: Colors.white60, shape: BoxShape.rectangle, borderRadius: BorderRadius.all(Radius.circular(12))), + decoration: BoxDecoration(color: Colors.grey[700], shape: BoxShape.rectangle, borderRadius: BorderRadius.all(Radius.circular(12))), child: KeyboardActions( config: _buildConfig(context), child: Column( @@ -107,7 +107,7 @@ class _InputDialogState extends State> with Trans { ]), width: double.infinity, decoration: BoxDecoration( - color: Colors.white70, + color: Colors.grey[900], shape: BoxShape.rectangle, borderRadius: BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12))), ), diff --git a/lib/widgets/size_widget.dart b/lib/widgets/size_widget.dart index 3226646..b0cd81b 100644 --- a/lib/widgets/size_widget.dart +++ b/lib/widgets/size_widget.dart @@ -42,6 +42,7 @@ class _SizeState extends State with Trans { padding: EdgeInsets.only(top: 10), child: Column(crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Stack( + alignment: Alignment.center, children: getSizeFigure(), ) ]))), @@ -49,16 +50,20 @@ class _SizeState extends State with Trans { } List getSizeFigure() { - //print("w " + MediaQuery.of(context).size.width.toString() + "h " + MediaQuery.of(context).size.height.toString()); + 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); List list = List(); list.add(SizedBox( - width: MediaQuery.of(context).size.width * .80, - height: MediaQuery.of(context).size.height * .80, + //child: Container(color: Colors.black87), + width: mediaWidth, + height: mediaHeight, )); list.add( Positioned( - top: 20, - left: 160, + top: mediaHeight * .07, + left: widget.exerciseBloc.isMan ? mediaWidth * .62 : mediaWidth * .65, child: Stack( alignment: Alignment.topLeft, children: [ @@ -72,7 +77,7 @@ class _SizeState extends State with Trans { color: Colors.black54, ), ], - fontSize: 22, + fontSize: 20, color: Colors.orange[500], )), Positioned( @@ -83,20 +88,24 @@ class _SizeState extends State with Trans { icon: Icon(Icons.save), iconSize: 40, hoverColor: Colors.blueAccent, - color: widget.exerciseBloc.changedSizes ? Colors.orange[300] : Colors.black54, + color: widget.exerciseBloc.changedSizes ? Colors.orange[300] : Colors.black87, onPressed: () => {print("Save"), widget.exerciseBloc.add(ExerciseNewSaveWeight())})) ], )), ); - list.add(widget.exerciseBloc.customerRepository.sex == "Man" - ? Image.asset( - "asset/image/man_sizes.png", - height: MediaQuery.of(context).size.height * .80, - ) - : Image.asset( - "asset/image/woman_sizes.png", - height: MediaQuery.of(context).size.height * .80, - )); + list.add( + widget.exerciseBloc.isMan + ? Image.asset( + "asset/image/man_sizes.png", + height: mediaHeight, + width: mediaWidth, + ) + : Image.asset( + "asset/image/woman_sizes.png", + height: mediaHeight, + width: mediaWidth, + ), + ); list.addAll(getSizeElements()); return list; @@ -111,18 +120,41 @@ class _SizeState extends State with Trans { top: element.top.toDouble(), left: element.left.toDouble(), child: element.value != 0 - ? IconButton( - icon: Icon(CustomIcon.ok_circled), + ? Container( + width: 20, + height: 20, + decoration: BoxDecoration( + color: widget.exerciseBloc.isMan ? Colors.green[800] : Color(0xFFEA776C), + borderRadius: BorderRadius.all( + Radius.circular(20), + ), + ), padding: EdgeInsets.zero, - color: Colors.green[200], - onPressed: () => onPressed(element), - ) - : IconButton( - icon: Icon(CustomIcon.question), + child: IconButton( + icon: Icon(CustomIcon.ok_circled), + padding: EdgeInsets.zero, + color: Colors.green[200], + onPressed: () => onPressed(element), + )) + : Container( + width: 20, + height: 20, padding: EdgeInsets.zero, - color: Colors.red[800], - onPressed: () => onPressed(element), - )), + decoration: BoxDecoration( + color: widget.exerciseBloc.isMan ? Color(0xFF369fb9) : Color(0xFFEA776C), + borderRadius: BorderRadius.all( + Radius.circular(20), + ), + ), + child: IconButton( + icon: Icon( + CustomIcon.help_circled, + ), + padding: EdgeInsets.zero, + color: Colors.red[800], + splashColor: Colors.amber, + onPressed: () => onPressed(element), + ))), ); });