WT1.1.2g Sizes

This commit is contained in:
bossanyit 2020-11-17 17:51:54 +01:00
parent e28f1edf50
commit b71544ba13
7 changed files with 230 additions and 246 deletions

View File

@ -362,7 +362,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 29; CURRENT_PROJECT_VERSION = 30;
DEVELOPMENT_TEAM = SFJJBDCU6Z; DEVELOPMENT_TEAM = SFJJBDCU6Z;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
@ -505,7 +505,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 29; CURRENT_PROJECT_VERSION = 30;
DEVELOPMENT_TEAM = SFJJBDCU6Z; DEVELOPMENT_TEAM = SFJJBDCU6Z;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
@ -540,7 +540,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 29; CURRENT_PROJECT_VERSION = 30;
DEVELOPMENT_TEAM = SFJJBDCU6Z; DEVELOPMENT_TEAM = SFJJBDCU6Z;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (

View File

@ -38,8 +38,11 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
final List<Property> womanSizes = List(); final List<Property> womanSizes = List();
final List<Property> manSizes = List(); final List<Property> manSizes = List();
final double baseWidth = 312;
final double baseHeight = 675.2;
double mediaWidth = 0; double mediaWidth = 0;
double mediaHeight = 0; double mediaHeight = 0;
bool isMan = true;
@override @override
ExerciseNewBloc({this.exerciseRepository, this.menuBloc, this.customerRepository, ExerciseType exerciseType}) ExerciseNewBloc({this.exerciseRepository, this.menuBloc, this.customerRepository, ExerciseType exerciseType})
@ -52,6 +55,8 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
weight = customerRepository.customer.getProperty("Weight"); weight = customerRepository.customer.getProperty("Weight");
height = customerRepository.customer.getProperty("Height"); height = customerRepository.customer.getProperty("Height");
fitnessLevel = customerRepository.customer.fitnessLevel; 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<ExerciseNewEvent, ExerciseNewState> {
void addSizes(String sex) { void addSizes(String sex) {
List<Property> properties = Cache().getProperties(); List<Property> 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) { properties.forEach((element) {
if (element.propertyName == "Shoulder") { if (element.propertyName == "Shoulder") {
element.top = (mediaHeight * 0.131).toInt(); element.top = (122 * distortionHeight).toInt();
element.left = (mediaWidth * 0.23).toInt(); element.left = (130 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Shoulder"); element.value = customerRepository.customer.getProperty("Shoulder");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Neck") { } else if (element.propertyName == "Neck") {
element.top = (mediaHeight * 0.069).toInt(); element.top = (68 * distortionHeight).toInt();
element.left = (mediaWidth * 0.23).toInt(); element.left = (130 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Neck"); element.value = customerRepository.customer.getProperty("Neck");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Biceps") { } else if (element.propertyName == "Biceps") {
element.top = (mediaHeight * 0.199).toInt(); element.top = (178 * distortionHeight).toInt();
element.left = (mediaWidth * 0.44).toInt(); element.left = (208 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Biceps"); element.value = customerRepository.customer.getProperty("Biceps");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Chest") { } else if (element.propertyName == "Chest") {
element.top = (mediaHeight * 0.171).toInt(); element.top = (154 * distortionHeight).toInt();
element.left = (mediaWidth * 0.23).toInt(); element.left = (130 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Chest"); element.value = customerRepository.customer.getProperty("Chest");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Belly") { } else if (element.propertyName == "Belly") {
element.top = (mediaHeight * 0.275).toInt(); element.top = (244 * distortionHeight).toInt();
element.left = (mediaWidth * 0.23).toInt(); element.left = (130 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Belly"); element.value = customerRepository.customer.getProperty("Belly");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Hip") { } else if (element.propertyName == "Hip") {
element.top = (mediaHeight * 0.355).toInt(); element.top = (308 * distortionHeight).toInt();
element.left = (mediaWidth * 0.23).toInt(); element.left = (130 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Hip"); element.value = customerRepository.customer.getProperty("Hip");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Thigh Top") { } else if (element.propertyName == "Thigh Top") {
element.top = (mediaHeight * 0.38).toInt(); element.top = (332 * distortionHeight).toInt();
element.left = (mediaWidth * 0.32).toInt(); element.left = (165 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Thigh Top"); element.value = customerRepository.customer.getProperty("Thigh Top");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Thigh Middle") { } else if (element.propertyName == "Thigh Middle") {
element.top = (mediaHeight * 0.438).toInt(); element.top = (382 * distortionHeight).toInt();
element.left = (mediaWidth * 0.14).toInt(); element.left = (100 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Thigh Middle"); element.value = customerRepository.customer.getProperty("Thigh Middle");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Knee") { } else if (element.propertyName == "Knee") {
element.top = (mediaHeight * 0.535).toInt(); element.top = (464 * distortionHeight).toInt();
element.left = (mediaWidth * 0.14).toInt(); element.left = (97 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Knee"); element.value = customerRepository.customer.getProperty("Knee");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Calf") { } else if (element.propertyName == "Calf") {
element.top = (mediaHeight * 0.60).toInt(); element.top = (520 * distortionHeight).toInt();
element.left = (mediaWidth * 0.14).toInt(); element.left = (97 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Calf"); element.value = customerRepository.customer.getProperty("Calf");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Ankle") { } else if (element.propertyName == "Ankle") {
element.top = (mediaHeight * 0.72).toInt(); element.top = (620 * distortionHeight).toInt();
element.left = (mediaWidth * 0.28).toInt(); element.left = (150 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Ankle"); element.value = customerRepository.customer.getProperty("Ankle");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Weight") { } else if (element.propertyName == "Weight") {
element.top = (mediaHeight * 0.44).toInt(); element.top = (402 * distortionHeight).toInt();
element.left = (mediaWidth * 0.54).toInt(); element.left = (240 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Weight"); element.value = customerRepository.customer.getProperty("Weight");
manSizes.add(element); manSizes.add(element);
} }
@ -130,63 +141,65 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
} else { } else {
properties.forEach((element) { properties.forEach((element) {
if (element.propertyName == "Shoulder") { if (element.propertyName == "Shoulder") {
element.top = (mediaHeight * 0.131).toInt(); element.top = (122 * distortionHeight).toInt();
element.left = (mediaWidth * 0.195).toInt(); element.left = (151 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Shoulder"); element.value = customerRepository.customer.getProperty("Shoulder");
print("CHEST top: " + element.top.toString() + " left " + element.left.toString());
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Neck") { } else if (element.propertyName == "Neck") {
element.top = (mediaHeight * 0.081).toInt(); element.top = (78 * distortionHeight).toInt();
element.left = (mediaWidth * 0.195).toInt(); element.left = (151 * distortionWidth).toInt();
print("Neck top: " + element.top.toString() + " left " + element.left.toString());
element.value = customerRepository.customer.getProperty("Neck"); element.value = customerRepository.customer.getProperty("Neck");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Biceps") { } else if (element.propertyName == "Biceps") {
element.top = (mediaHeight * 0.199).toInt(); element.top = (178 * distortionHeight).toInt();
element.left = (mediaWidth * 0.36).toInt(); element.left = (212 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Biceps"); element.value = customerRepository.customer.getProperty("Biceps");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Chest") { } else if (element.propertyName == "Chest") {
element.top = (mediaHeight * 0.168).toInt(); element.top = (154 * distortionHeight).toInt();
element.left = (mediaWidth * 0.195).toInt(); element.left = (151 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Chest"); element.value = customerRepository.customer.getProperty("Chest");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Belly") { } else if (element.propertyName == "Belly") {
element.top = (mediaHeight * 0.26).toInt(); element.top = (230 * distortionHeight).toInt();
element.left = (mediaWidth * 0.195).toInt(); element.left = (151 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Belly"); element.value = customerRepository.customer.getProperty("Belly");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Hip") { } else if (element.propertyName == "Hip") {
element.top = (mediaHeight * 0.335).toInt(); element.top = (294 * distortionHeight).toInt();
element.left = (mediaWidth * 0.195).toInt(); element.left = (151 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Hip"); element.value = customerRepository.customer.getProperty("Hip");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Thigh Top") { } else if (element.propertyName == "Thigh Top") {
element.top = (mediaHeight * 0.385).toInt(); element.top = (335 * distortionHeight).toInt();
element.left = (mediaWidth * 0.28).toInt(); element.left = (185 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Thigh Top"); element.value = customerRepository.customer.getProperty("Thigh Top");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Thigh Middle") { } else if (element.propertyName == "Thigh Middle") {
element.top = (mediaHeight * 0.433).toInt(); element.top = (377 * distortionHeight).toInt();
element.left = (mediaWidth * 0.12).toInt(); element.left = (125 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Thigh Middle"); element.value = customerRepository.customer.getProperty("Thigh Middle");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Knee") { } else if (element.propertyName == "Knee") {
element.top = (mediaHeight * 0.543).toInt(); element.top = (468 * distortionHeight).toInt();
element.left = (mediaWidth * 0.14).toInt(); element.left = (129 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Knee"); element.value = customerRepository.customer.getProperty("Knee");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Calf") { } else if (element.propertyName == "Calf") {
element.top = (mediaHeight * 0.608).toInt(); element.top = (525 * distortionHeight).toInt();
element.left = (mediaWidth * 0.14).toInt(); element.left = (129 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Calf"); element.value = customerRepository.customer.getProperty("Calf");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Ankle") { } else if (element.propertyName == "Ankle") {
element.top = (mediaHeight * 0.725).toInt(); element.top = (620 * distortionHeight).toInt();
element.left = (mediaWidth * 0.23).toInt(); element.left = (162 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Ankle"); element.value = customerRepository.customer.getProperty("Ankle");
manSizes.add(element); manSizes.add(element);
} else if (element.propertyName == "Weight") { } else if (element.propertyName == "Weight") {
element.top = (mediaHeight * 0.44).toInt(); element.top = (402 * distortionHeight).toInt();
element.left = (mediaWidth * 0.54).toInt(); element.left = (240 * distortionWidth).toInt();
element.value = customerRepository.customer.getProperty("Weight"); element.value = customerRepository.customer.getProperty("Weight");
manSizes.add(element); manSizes.add(element);
} }

View File

@ -98,9 +98,6 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
}, },
builder: (context, state) { builder: (context, state) {
final exerciseBloc = BlocProvider.of<ExerciseNewBloc>(context); final exerciseBloc = BlocProvider.of<ExerciseNewBloc>(context);
double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height;
exerciseBloc.setMediaDimensions(width, height);
return getExerciseWidget(exerciseBloc, exerciseType); return getExerciseWidget(exerciseBloc, exerciseType);
}, },
)); ));

View File

@ -35,32 +35,26 @@ class _LoginWidget extends State<LoginWidget> with Common, Trans {
final accountBloc = BlocProvider.of<AccountBloc>(context); final accountBloc = BlocProvider.of<AccountBloc>(context);
setContext(context); setContext(context);
return BlocProvider( return BlocProvider(
create: (context) => LoginFormBloc( create: (context) => LoginFormBloc(userRepository: UserRepository(), accountBloc: accountBloc),
userRepository: UserRepository(),
accountBloc: accountBloc
),
child: Builder(builder: (context) { child: Builder(builder: (context) {
final loginBloc = BlocProvider.of<LoginFormBloc>(context); final loginBloc = BlocProvider.of<LoginFormBloc>(context);
return Scaffold( return Scaffold(
key: _scaffoldKey, //key: _scaffoldKey,
appBar: AppBarMin(), appBar: AppBarMin(),
body: FormBlocListener<LoginFormBloc, String, String>( body: FormBlocListener<LoginFormBloc, String, String>(
onSubmitting: (context, state) { onSubmitting: (context, state) {
LoadingDialog.show(context); LoadingDialog.show(context);
}, },
onSuccess: (context, state) { onSuccess: (context, state) {
LoadingDialog.hide(context); LoadingDialog.hide(context);
Navigator.of(context).pushNamed('home'); Navigator.of(context).pushNamed('home');
}, },
onFailure: (context, state) { onFailure: (context, state) {
LoadingDialog.hide(context); LoadingDialog.hide(context);
showInSnackBar(t(state.failureResponse)); showInSnackBar(t(state.failureResponse));
}, },
onLoaded: (context, state ) { onLoaded: (context, state) {},
child: loadForm(loginBloc, accountBloc)),
},
child: loadForm(loginBloc, accountBloc)
),
); );
})); }));
} }
@ -83,16 +77,13 @@ class _LoginWidget extends State<LoginWidget> with Common, Trans {
} }
Widget buildLoginForm(LoginFormBloc formBloc, AccountBloc accountBloc) { Widget buildLoginForm(LoginFormBloc formBloc, AccountBloc accountBloc) {
return Form( return Form(
key: _scaffoldKey, key: _scaffoldKey,
child: Container( child: Container(
padding: const EdgeInsets.only(left: 15, right: 50), padding: const EdgeInsets.only(left: 15, right: 50),
child: child: ListView(shrinkWrap: false, padding: EdgeInsets.only(top: 150.0), children: <Widget>[
ListView(shrinkWrap: false, padding: EdgeInsets.only(top: 150.0), Divider(color: Colors.transparent),
children: <Widget>[ /* FlatButton(
Divider(color: Colors.transparent),
/* FlatButton(
child: new Image.asset( child: new Image.asset(
'asset/image/login_fb.png', 'asset/image/login_fb.png',
width: cWidth * .85, width: cWidth * .85,
@ -104,89 +95,73 @@ class _LoginWidget extends State<LoginWidget> with Common, Trans {
}, },
), ),
Text(AppLocalizations.of(context).translate("OR")),*/ Text(AppLocalizations.of(context).translate("OR")),*/
Divider(), Divider(),
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
new InkWell( new InkWell(
child: new Text( child: new Text(AppLocalizations.of(context).translate('Login'),
AppLocalizations.of(context).translate('Login'), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 24)),
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 24)),
),
],
), ),
Divider(), ],
TextFieldBlocBuilder( ),
key: LibraryKeys.loginEmailField, Divider(),
textFieldBloc: formBloc.emailField, TextFieldBlocBuilder(
decoration: InputDecoration( key: LibraryKeys.loginEmailField,
fillColor: Colors.white, textFieldBloc: formBloc.emailField,
filled: true, decoration: InputDecoration(
labelText: 'Email', fillColor: Colors.white,
), filled: true,
), labelText: 'Email',
Divider( ),
color: Colors.transparent, ),
), Divider(
TextFieldBlocBuilder( color: Colors.transparent,
key: LibraryKeys.loginPasswordField, ),
textFieldBloc: formBloc.passwordField, TextFieldBlocBuilder(
decoration: InputDecoration( key: LibraryKeys.loginPasswordField,
fillColor: Colors.white, textFieldBloc: formBloc.passwordField,
filled: true, decoration: InputDecoration(
labelText: 'Password', fillColor: Colors.white,
), filled: true,
suffixButton: SuffixButton.obscureText, labelText: 'Password',
), ),
Divider( suffixButton: SuffixButton.obscureText,
color: Colors.transparent, ),
), Divider(
Row( color: Colors.transparent,
mainAxisAlignment: MainAxisAlignment.end, ),
children: <Widget>[ Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[
new FlatButton( new FlatButton(
key: LibraryKeys.loginOKButton, key: LibraryKeys.loginOKButton,
child: Image.asset('asset/image/WT_OK.png', child: Image.asset('asset/image/WT_OK.png', width: 100, height: 100),
width: 100, height: 100), onPressed: () => {formBloc.add(SubmitFormBloc())}),
onPressed: () => { ]),
formBloc.add(SubmitFormBloc()) Divider(
}), color: Colors.transparent,
]), ),
Divider( Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[
color: Colors.transparent, new InkWell(
), child: new Text(AppLocalizations.of(context).translate('SignUp')),
Row( onTap: () => Navigator.of(context).pushNamed('registration'),
mainAxisAlignment: MainAxisAlignment.spaceAround, ),
children: <Widget>[ Spacer(flex: 2),
new InkWell( new InkWell(
child: new Text( child: new Text(AppLocalizations.of(context).translate('I forgot the password')),
AppLocalizations.of(context).translate('SignUp')), onTap: () => Navigator.of(context).pushNamed('resetPassword'),
onTap: () => ),
Navigator.of(context).pushNamed('registration'), Spacer(flex: 2),
), new InkWell(
Spacer(flex: 2), child: new Text(AppLocalizations.of(context).translate('Privacy')),
new InkWell( onTap: () => Navigator.of(context).pushNamed('gdpr'),
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) { void showInSnackBar(String error) {
_scaffoldKey.currentState.showSnackBar(SnackBar( _scaffoldKey.currentState
backgroundColor: Colors.orange, .showSnackBar(SnackBar(backgroundColor: Colors.orange, content: Text(error, style: TextStyle(color: Colors.white))));
content: Text(error, style: TextStyle(color: Colors.white))));
} }
} }

View File

@ -20,8 +20,7 @@ class RegistrationPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RegistrationWidget( return RegistrationWidget(userRepository: userRepository, customerRepository: customerRepository);
userRepository: userRepository, customerRepository: customerRepository);
} }
} }
@ -37,20 +36,16 @@ class RegistrationWidget extends StatefulWidget {
class _RegistrationWidget extends State<RegistrationWidget> with Common { class _RegistrationWidget extends State<RegistrationWidget> with Common {
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
final _formKey = GlobalKey<FormState>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final cWidth = mediaSizeWidth(context);
// ignore: close_sinks // ignore: close_sinks
final accountBloc = BlocProvider.of<AccountBloc>(context); final accountBloc = BlocProvider.of<AccountBloc>(context);
return BlocProvider( return BlocProvider(
create: (context) => RegistrationFormBloc( create: (context) => RegistrationFormBloc(userRepository: UserRepository(), accountBloc: accountBloc),
userRepository: UserRepository(), accountBloc: accountBloc),
child: Builder(builder: (context) { child: Builder(builder: (context) {
// ignore: close_sinks // ignore: close_sinks
final registrationBloc = final registrationBloc = BlocProvider.of<RegistrationFormBloc>(context);
BlocProvider.of<RegistrationFormBloc>(context);
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
@ -80,12 +75,9 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
), ),
), ),
child: Form( child: Form(
key: _formKey,
child: Container( child: Container(
padding: const EdgeInsets.only(left: 25, right: 50), padding: const EdgeInsets.only(left: 25, right: 50),
child: ListView( child: ListView(shrinkWrap: false, padding: EdgeInsets.only(top: 150.0),
shrinkWrap: false,
padding: EdgeInsets.only(top: 150.0),
//mainAxisAlignment: MainAxisAlignment.spaceAround, //mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[ children: <Widget>[
Divider( Divider(
@ -109,12 +101,8 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
new InkWell( new InkWell(
child: new Text( child: new Text(AppLocalizations.of(context).translate('SignUp'),
AppLocalizations.of(context) style: TextStyle(fontWeight: FontWeight.bold, fontSize: 24)),
.translate('SignUp'),
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 24)),
), ),
], ],
), ),
@ -144,40 +132,23 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
Divider( Divider(
color: Colors.transparent, color: Colors.transparent,
), ),
Row( Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[
mainAxisAlignment: MainAxisAlignment.end, new FlatButton(
children: <Widget>[ child: Image.asset('asset/image/WT_OK.png', width: 100, height: 100),
new FlatButton( onPressed: () => {registrationBloc.add(SubmitFormBloc())}),
child: Image.asset( ]),
'asset/image/WT_OK.png', Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[
width: 100, new InkWell(
height: 100), child: new Text(AppLocalizations.of(context).translate('Login')),
onPressed: () => { onTap: () => Navigator.of(context).pushNamed('login'),
registrationBloc ),
.add(SubmitFormBloc()) Spacer(flex: 1),
}), new InkWell(
]), child: new Text(AppLocalizations.of(context).translate('Privacy')),
Row( onTap: () => Navigator.of(context).pushNamed('gdpr'),
mainAxisAlignment: ),
MainAxisAlignment.spaceAround, Spacer(flex: 2),
children: <Widget>[ ]),
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), //Spacer(flex:2),
])), ])),
), ),
@ -191,11 +162,7 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
void showInSnackBar(String error) { void showInSnackBar(String error) {
_scaffoldKey.currentState.showSnackBar(SnackBar( _scaffoldKey.currentState.showSnackBar(SnackBar(
backgroundColor: Colors.orange, backgroundColor: Colors.orange,
content: Text( content: Text(AppLocalizations.of(context).translate("There is an error: during registration:") + " " + error,
AppLocalizations.of(context)
.translate("There is an error: during registration:") +
" " +
error,
style: TextStyle(color: Colors.white)))); style: TextStyle(color: Colors.white))));
} }
} }

View File

@ -68,7 +68,7 @@ class _InputDialogState<Event> extends State<InputDialog<Event>> with Trans {
_buildChild(BuildContext context) => Container( _buildChild(BuildContext context) => Container(
height: 350, 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( child: KeyboardActions(
config: _buildConfig(context), config: _buildConfig(context),
child: Column( child: Column(
@ -107,7 +107,7 @@ class _InputDialogState<Event> extends State<InputDialog<Event>> with Trans {
]), ]),
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white70, color: Colors.grey[900],
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12))), borderRadius: BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12))),
), ),

View File

@ -42,6 +42,7 @@ class _SizeState extends State<SizeWidget> with Trans {
padding: EdgeInsets.only(top: 10), padding: EdgeInsets.only(top: 10),
child: Column(crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ child: Column(crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [
Stack( Stack(
alignment: Alignment.center,
children: getSizeFigure(), children: getSizeFigure(),
) )
]))), ]))),
@ -49,16 +50,20 @@ class _SizeState extends State<SizeWidget> with Trans {
} }
List<Widget> getSizeFigure() { List<Widget> 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<Widget> list = List(); List<Widget> list = List();
list.add(SizedBox( list.add(SizedBox(
width: MediaQuery.of(context).size.width * .80, //child: Container(color: Colors.black87),
height: MediaQuery.of(context).size.height * .80, width: mediaWidth,
height: mediaHeight,
)); ));
list.add( list.add(
Positioned( Positioned(
top: 20, top: mediaHeight * .07,
left: 160, left: widget.exerciseBloc.isMan ? mediaWidth * .62 : mediaWidth * .65,
child: Stack( child: Stack(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
children: [ children: [
@ -72,7 +77,7 @@ class _SizeState extends State<SizeWidget> with Trans {
color: Colors.black54, color: Colors.black54,
), ),
], ],
fontSize: 22, fontSize: 20,
color: Colors.orange[500], color: Colors.orange[500],
)), )),
Positioned( Positioned(
@ -83,20 +88,24 @@ class _SizeState extends State<SizeWidget> with Trans {
icon: Icon(Icons.save), icon: Icon(Icons.save),
iconSize: 40, iconSize: 40,
hoverColor: Colors.blueAccent, 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())})) onPressed: () => {print("Save"), widget.exerciseBloc.add(ExerciseNewSaveWeight())}))
], ],
)), )),
); );
list.add(widget.exerciseBloc.customerRepository.sex == "Man" list.add(
? Image.asset( widget.exerciseBloc.isMan
"asset/image/man_sizes.png", ? Image.asset(
height: MediaQuery.of(context).size.height * .80, "asset/image/man_sizes.png",
) height: mediaHeight,
: Image.asset( width: mediaWidth,
"asset/image/woman_sizes.png", )
height: MediaQuery.of(context).size.height * .80, : Image.asset(
)); "asset/image/woman_sizes.png",
height: mediaHeight,
width: mediaWidth,
),
);
list.addAll(getSizeElements()); list.addAll(getSizeElements());
return list; return list;
@ -111,18 +120,41 @@ class _SizeState extends State<SizeWidget> with Trans {
top: element.top.toDouble(), top: element.top.toDouble(),
left: element.left.toDouble(), left: element.left.toDouble(),
child: element.value != 0 child: element.value != 0
? IconButton( ? Container(
icon: Icon(CustomIcon.ok_circled), width: 20,
height: 20,
decoration: BoxDecoration(
color: widget.exerciseBloc.isMan ? Colors.green[800] : Color(0xFFEA776C),
borderRadius: BorderRadius.all(
Radius.circular(20),
),
),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
color: Colors.green[200], child: IconButton(
onPressed: () => onPressed(element), icon: Icon(CustomIcon.ok_circled),
) padding: EdgeInsets.zero,
: IconButton( color: Colors.green[200],
icon: Icon(CustomIcon.question), onPressed: () => onPressed(element),
))
: Container(
width: 20,
height: 20,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
color: Colors.red[800], decoration: BoxDecoration(
onPressed: () => onPressed(element), 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),
))),
); );
}); });