wt1.1.2f fix for 1.1.3

This commit is contained in:
Bossanyi Tibor
2020-10-28 14:05:31 +01:00
parent 27c1d26dfd
commit db95c9a6f7
26 changed files with 672 additions and 510 deletions
+3 -18
View File
@@ -6,6 +6,7 @@ import 'package:aitrainer_app/localization/app_language.dart';
import 'package:aitrainer_app/model/workout_menu_tree.dart';
import 'package:aitrainer_app/repository/exercise_repository.dart';
import 'package:aitrainer_app/util/trans.dart';
import 'package:aitrainer_app/widgets/app_bar.dart';
import 'package:aitrainer_app/widgets/splash.dart';
import 'package:aitrainer_app/library/numberpicker.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -71,24 +72,7 @@ class _ExerciseExecuteAddPage extends State<ExerciseExecutePlanAddPage> with Tra
autovalidate: true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: AppBar(
backgroundColor: Colors.black,
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(t("Save Exercise"), style: TextStyle(fontSize: 18),),
Image.asset(
'asset/image/WT_long_logo.png',
fit: BoxFit.cover,
height: 65.0,
),
],
),
leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.white),
onPressed: () => Navigator.of(context).pop(),
),
),
appBar: AppBarNav(depth: 1),
body: Container(
width: MediaQuery
.of(context)
@@ -115,6 +99,7 @@ class _ExerciseExecuteAddPage extends State<ExerciseExecutePlanAddPage> with Tra
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Text(t("Save Exercise")),
Text(exerciseName,
style: TextStyle(fontWeight: FontWeight.bold,
fontSize: 18,
@@ -50,6 +50,8 @@ class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> with T
));
}
Widget getForm(ExercisePlanCustomAddBloc bloc, WorkoutMenuTree workoutMenuTree) {
String exerciseName = "";
if (bloc != null) {
@@ -94,25 +96,58 @@ class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> with T
fit: FlexFit.tight,
flex: 8,
child:
Text(t("Serie")),
Text(
t("Serie"),
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
),
NumberPicker.horizontal(
highlightSelectedValue: true,
initialValue: bloc.serie.toInt(),
minValue: 0,
maxValue: 200,
itemExtent: 85,
minValue: 1,
maxValue: 20,
//decoration: _decoration,
step: 1,
onChanged: (value) => {
bloc.add(ExercisePlanCustomAddChangeSerie(quantity: value.toDouble()))
},
listViewHeight: 80,
textStyle: TextStyle(fontSize: 24),
textStyleHighlighted: TextStyle(fontSize: 40, color: Colors.orange, fontWeight: FontWeight.bold),
textStyleHighlighted: TextStyle(fontSize: 36, color: Colors.orange, fontWeight: FontWeight.bold),
//decoration: _decoration,
),
]
),
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Flexible(
fit: FlexFit.tight,
flex: 8,
child:
Text(t("Repeats"),
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),),
),
NumberPicker.horizontal(
highlightSelectedValue: true,
initialValue: bloc.quantity.toInt(),
itemExtent: 85,
minValue: 0,
maxValue: 200,
step: 1,
onChanged: (value) => {
bloc.add(ExercisePlanCustomAddChangeQuantity(quantity: value.toDouble()))
},
listViewHeight: 80,
textStyle: TextStyle(fontSize: 24),
textStyleHighlighted: TextStyle(fontSize: 36, color: Colors.orange, fontWeight: FontWeight.bold),
//decoration: _decoration,
),
]),
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.start,
@@ -121,11 +156,14 @@ class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> with T
fit: FlexFit.tight,
flex: 8,
child:
Text(t("Weight") + " (" + bloc.exercisePlanRepository.getActualPlanDetail().exerciseType.unitQuantityUnit + ")"),
Text(t("Weight") + " (" + bloc.exercisePlanRepository.getActualPlanDetail().exerciseType.unitQuantityUnit + ")",
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),),
),
NumberPicker.horizontal(
highlightSelectedValue: true,
initialValue: bloc.quantityUnit.toInt(),
//decoration: _decoration,
itemExtent: 85,
minValue: 0,
maxValue: 650,
step: 1,
@@ -134,79 +172,19 @@ class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> with T
},
listViewHeight: 80,
textStyle: TextStyle(fontSize: 24),
textStyleHighlighted: TextStyle(fontSize: 40, color: Colors.orange, fontWeight: FontWeight.bold),
textStyleHighlighted: TextStyle(fontSize: 36, color: Colors.orange, fontWeight: FontWeight.bold),
//decoration: _decoration,
),
]),
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Flexible(
fit: FlexFit.tight,
flex: 8,
child:
Text(t("Repeats")),
),
NumberPicker.horizontal(
highlightSelectedValue: true,
initialValue: bloc.quantity.toInt(),
minValue: 0,
maxValue: 200,
step: 1,
onChanged: (value) => {
bloc.add(ExercisePlanCustomAddChangeQuantity(quantity: value.toDouble()))
},
listViewHeight: 80,
textStyle: TextStyle(fontSize: 24),
textStyleHighlighted: TextStyle(fontSize: 40, color: Colors.orange, fontWeight: FontWeight.bold),
//decoration: _decoration,
),
]),
Divider(),
/*TextFieldBlocBuilder(
textFieldBloc: bloc.serieField,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 30, color: Colors.lightBlue, fontWeight: FontWeight.bold),
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r"[\d.]"))],
decoration: InputDecoration(
fillColor: Colors.white,
filled: false,
hintStyle: TextStyle(fontSize: 16, color: Colors.black54, fontWeight: FontWeight.w100),
hintText: AppLocalizations.of(context).translate("The number of the serie done with"),
labelStyle: TextStyle(fontSize: 16, color: Colors.lightBlue),
labelText: AppLocalizations.of(context).translate("Serie"),
),
),*/
/*TextFieldBlocBuilder(
textFieldBloc: bloc.quantityField,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 30, color: Colors.lightBlue, fontWeight: FontWeight.bold),
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r"[\d.]"))],
decoration: InputDecoration(
fillColor: Colors.white,
filled: false,
hintStyle: TextStyle(fontSize: 16, color: Colors.black54, fontWeight: FontWeight.w100),
hintText:
AppLocalizations.of(context).translate("The number of the repeats of one serie"),
labelStyle: TextStyle(fontSize: 16, color: Colors.lightBlue),
labelText: AppLocalizations.of(context).translate("Repeats"),
),
),*/
/*TextFieldBlocBuilder(
textFieldBloc: bloc.weightField,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 30, color: Colors.lightBlue, fontWeight: FontWeight.bold),
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r"[\d.]"))],
decoration: InputDecoration(
fillColor: Colors.white,
filled: false,
hintStyle: TextStyle(fontSize: 16, color: Colors.black54, fontWeight: FontWeight.w100),
hintText: AppLocalizations.of(context).translate("The weight"),
labelStyle: TextStyle(fontSize: 16, color: Colors.lightBlue),
labelText: AppLocalizations.of(context).translate("Weight"),
),
),*/
Text(
bloc.serie.toStringAsFixed(0) + " x " + bloc.quantity.toStringAsFixed(0) + " x " + bloc.quantityUnit.toStringAsFixed(0) + " kg" ,
style: TextStyle(fontSize: 28, fontWeight: FontWeight.normal),
),
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
@@ -217,11 +195,6 @@ class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> with T
onPressed: () => {
bloc.add(ExercisePlanCustomAddRemove()),
Navigator.of(context).pop(),
/*print("Remove " + bloc.exercisePlanRepository.getActualPlanDetail().exerciseType.name),
bloc.exercisePlanRepository.getActualPlanDetail().change = ExercisePlanDetailChange.delete,
planBloc.add(ExercisePlanRemoveExercise(
exercisePlanDetail: bloc.exercisePlanRepository.getActualPlanDetail() )),
Navigator.of(context).pop(),*/
},
child: Text(t(
"Delete")), //Text(AppLocalizations.of(context).translate("Delete"), style: TextStyle(fontSize: 16),)
@@ -233,8 +206,6 @@ class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> with T
onPressed: () => {
bloc.add(ExercisePlanCustomAddSubmit()),
Navigator.of(context).pop(),
/* bloc.submit(),
Navigator.of(context).pop(),*/
},
child: Text(
t("Save"),
+15 -34
View File
@@ -2,12 +2,13 @@ import 'package:aitrainer_app/bloc/login_form_bloc.dart';
import 'package:aitrainer_app/bloc/account/account_bloc.dart';
import 'package:aitrainer_app/localization/app_localization.dart';
import 'package:aitrainer_app/repository/user_repository.dart';
import 'package:aitrainer_app/service/firebase_api.dart';
import 'package:aitrainer_app/util/common.dart';
import 'package:aitrainer_app/util/trans.dart';
import 'package:aitrainer_app/widgets/splash.dart';
import 'package:flutter/material.dart';
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 '../library_keys.dart';
@@ -26,13 +27,14 @@ class LoginWidget extends StatefulWidget {
State<StatefulWidget> createState() => _LoginWidget();
}
class _LoginWidget extends State<LoginWidget> with Common {
class _LoginWidget extends State<LoginWidget> with Common, Trans {
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
final accountBloc = BlocProvider.of<AccountBloc>(context);
setContext(context);
return BlocProvider(
create: (context) => LoginFormBloc(
userRepository: UserRepository(),
@@ -72,7 +74,6 @@ class _LoginWidget extends State<LoginWidget> with Common {
}
Widget buildLoginForm(LoginFormBloc formBloc, AccountBloc accountBloc) {
final cWidth = mediaSizeWidth(context);
return Form(
key: _formKey,
@@ -81,17 +82,18 @@ class _LoginWidget extends State<LoginWidget> with Common {
child:
ListView(shrinkWrap: false, padding: EdgeInsets.only(top: 120.0),
children: <Widget>[
FlatButton(
/* FlatButton(
child: new Image.asset(
'asset/image/login_fb.png',
width: cWidth * .85,
),
onPressed: () => {
_fbLogin(),
//_fbLogin(),
FirebaseApi().signInWithFacebook(),
print("Login with FB"),
},
),
Text(AppLocalizations.of(context).translate("OR")),
Text(AppLocalizations.of(context).translate("OR")),*/
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.start,
@@ -156,10 +158,15 @@ class _LoginWidget extends State<LoginWidget> with Common {
Spacer(flex: 1),
new InkWell(
child: new Text(
AppLocalizations.of(context).translate('Privacy')),
AppLocalizations.of(context).translate('I forgot the password')),
onTap: () => Navigator.of(context).pushNamed('resetPassword'),
),
Spacer(flex: 1),
new InkWell(
child: new Text(
AppLocalizations.of(context).translate('Privacy')),
onTap: () => Navigator.of(context).pushNamed('gdpr'),
),
Spacer(flex: 2),
]),
])),
);
@@ -172,30 +179,4 @@ class _LoginWidget extends State<LoginWidget> with Common {
content: Text(error, style: TextStyle(color: Colors.white))));
}
Future<Null> _fbLogin() async {
final FacebookLogin facebookSignIn = new FacebookLogin();
final FacebookLoginResult result = await facebookSignIn.logIn(['email']);
switch (result.status) {
case FacebookLoginStatus.loggedIn:
final FacebookAccessToken accessToken = result.accessToken;
showInSnackBar('''
Logged in!
Token: ${accessToken.token}
User id: ${accessToken.userId}
Expires: ${accessToken.expires}
Permissions: ${accessToken.permissions}
Declined permissions: ${accessToken.declinedPermissions}
''');
break;
case FacebookLoginStatus.cancelledByUser:
showInSnackBar('Login cancelled by the user.');
break;
case FacebookLoginStatus.error:
showInSnackBar('Something went wrong with the login process.\n'
'Here\'s the error Facebook gave us: ${result.errorMessage}');
break;
}
}
}
+80 -76
View File
@@ -3,6 +3,7 @@ import 'dart:collection';
import 'package:aitrainer_app/model/cache.dart';
import 'package:aitrainer_app/repository/customer_repository.dart';
import 'package:aitrainer_app/repository/exercise_repository.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:aitrainer_app/util/trans.dart';
import 'package:aitrainer_app/widgets/app_bar.dart';
import 'package:aitrainer_app/widgets/bottom_nav.dart';
@@ -22,114 +23,121 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
final CustomerRepository customerRepository = CustomerRepository();
final LinkedHashMap args = LinkedHashMap();
setContext(context);
double mediaWidth = MediaQuery.of(context).size.width;
double imageWidth = (mediaWidth - 45) / 2;
print("Media: " + mediaWidth.toString() + " imageWidth: " + imageWidth.toString());
return Scaffold(
appBar: AppBarNav(depth: 0),
body: Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('asset/image/WT_menu_dark.png'),
fit: BoxFit.cover,
alignment: Alignment.center,
),
),
child: CustomScrollView(
scrollDirection: Axis.vertical,
slivers:
[
SliverGrid(
delegate: SliverChildListDelegate(
[
appBar: AppBarNav(depth: 0),
body: Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('asset/image/WT_menu_dark.png'),
fit: BoxFit.cover,
alignment: Alignment.center,
),
),
child: CustomScrollView(scrollDirection: Axis.vertical, slivers: [
SliverGrid(
delegate: SliverChildListDelegate([
ImageButton(
width: imageWidth,
textAlignment: Alignment.topCenter,
text: t("My Exercise Logs"),
style: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold, backgroundColor: Colors.black54.withOpacity(0.4)),
style: GoogleFonts.robotoMono(
textStyle: TextStyle(
fontSize: 14,
color: Colors.orange,
fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4)
)
),
image: "asset/image/edzesnaplom400400.jpg",
top: 150,
left: 10,
onTap:() => this.callBackExerciseLog(exerciseRepository, customerRepository),
onTap: () => this.callBackExerciseLog(exerciseRepository, customerRepository),
isLocked: false,
),
ImageButton(
width: imageWidth,
textAlignment: Alignment.topLeft,
text: t("My Whole Body Development"),
style: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4)),
style: GoogleFonts.robotoMono(
textStyle: TextStyle(
fontSize: 14,
color: Colors.orange,
fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4)),
),
image: "asset/image/testemfejl400x400.jpg",
top: 150,
left: 10,
onTap:() => {
onTap: () => {
args['customerId'] = Cache().userLoggedIn.customerId,
Navigator.of(context).pushNamed('mydevelopmentBodyPage',
arguments: args)
Navigator.of(context).pushNamed('mydevelopmentBodyPage', arguments: args)
},
isLocked: true,
),
ImageButton(
width: imageWidth,
textAlignment: Alignment.topLeft,
text: t("Development Of Muscles"),
style: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4)),
style: GoogleFonts.robotoMono(
textStyle: TextStyle(
fontSize: 14,
color: Colors.orange,
fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4))),
image: "asset/image/izomcsop400400.jpg",
top: 120,
left: 10,
onTap:() => {
Navigator.of(context).pushNamed('mydevelopmentMusclePage',
arguments: args)
},
onTap: () => {Navigator.of(context).pushNamed('mydevelopmentMusclePage', arguments: args)},
isLocked: true,
),
ImageButton(
width: imageWidth,
left: 10,
textAlignment: Alignment.topLeft,
text: t("Predictions"),
style: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4)),
image: "asset/menu/2.2.1.1RM.png",
top: 150,
onTap:() => {
},
style: GoogleFonts.robotoMono(
textStyle: TextStyle(
fontSize: 14,
color: Colors.orange,
fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4))),
image: "asset/image/predictions.jpg",
onTap: () => {},
isLocked: true,
),
hiddenWidget(customerRepository, exerciseRepository),
]
),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 15.0,
crossAxisSpacing: 15.0,
childAspectRatio: 1.0,
),
)
]
)
),
bottomNavigationBar: BottomNavigator(bottomNavIndex: 1));
]),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 15.0,
crossAxisSpacing: 15.0,
childAspectRatio: 1.0,
),
)
])),
bottomNavigationBar: BottomNavigator(bottomNavIndex: 1));
}
Widget hiddenWidget(CustomerRepository customerRepository, ExerciseRepository exerciseRepository) {
final LinkedHashMap args = LinkedHashMap();
if (Cache().getTrainee() != null) {
return FlatButton(
padding: EdgeInsets.all(20),
textColor: Colors.white,
color: Colors.black12,
focusColor: Colors.blueAccent,
onPressed: () =>
{
args['exerciseRepository'] = exerciseRepository,
args['customerRepository'] = customerRepository,
args['customerId'] = Cache().getTrainee().customerId,
Navigator.of(context).pushNamed('exerciseLogPage',
arguments: args)
},
child: Text(t("My Trainee's Exercise Logs"),
style: TextStyle(fontSize: 18),)
);
padding: EdgeInsets.all(20),
textColor: Colors.white,
color: Colors.black12,
focusColor: Colors.blueAccent,
onPressed: () => {
args['exerciseRepository'] = exerciseRepository,
args['customerRepository'] = customerRepository,
args['customerId'] = Cache().getTrainee().customerId,
Navigator.of(context).pushNamed('exerciseLogPage', arguments: args)
},
child: Text(
t("My Trainee's Exercise Logs"),
style: TextStyle(fontSize: 18),
));
} else {
return Container();
}
@@ -140,10 +148,6 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
args['exerciseRepository'] = exerciseRepository;
args['customerRepository'] = customerRepository;
args['customerId'] = Cache().userLoggedIn.customerId;
Navigator.of(context).pushNamed('exerciseLogPage',
arguments: args);
Navigator.of(context).pushNamed('exerciseLogPage', arguments: args);
}
}
+25 -14
View File
@@ -7,6 +7,7 @@ import 'package:aitrainer_app/widgets/bottom_nav.dart';
import 'package:aitrainer_app/widgets/image_button.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class MyExercisePlanPage extends StatefulWidget {
@override
@@ -20,6 +21,10 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
final LinkedHashMap args = LinkedHashMap();
setContext(context);
double mediaWidth = MediaQuery.of(context).size.width;
double imageWidth = (mediaWidth - 45) / 2;
print("Media: " + mediaWidth.toString() + " imageWidth: " + imageWidth.toString());
return Scaffold(
appBar: AppBarNav(depth: 0),
body: Container(
@@ -39,10 +44,12 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
delegate: SliverChildListDelegate(
[
ImageButton(
width: imageWidth,
textAlignment: Alignment.topLeft,
text: t("Execute My Selected Training Plan"),
style: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4)),
style: GoogleFonts.robotoMono(
textStyle: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4))),
image: "asset/image/exercise_plan_execute.jpg",
top: 130,
left: 10,
@@ -55,12 +62,13 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
),
ImageButton(
width: imageWidth,
textAlignment: Alignment.topLeft,
text: t("Edit My Custom Plan"),
style: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4)),
style: GoogleFonts.robotoMono(
textStyle: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4))),
image: "asset/image/exercise_plan_custom.jpg",
top: 150,
left: 10,
onTap:() => {
args['exerciseRepository'] = exerciseRepository,
@@ -72,12 +80,13 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
),
ImageButton(
width: imageWidth,
textAlignment: Alignment.topLeft,
text: t("Suggested Training Plan"),
style: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4)),
style: GoogleFonts.robotoMono(
textStyle: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4))),
image: "asset/image/exercise_plan_suggested.jpg",
top: 130,
left: 10,
onTap:() => {
@@ -86,12 +95,13 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
),
ImageButton(
width: imageWidth,
textAlignment: Alignment.topLeft,
text: t("My Special Plan"),
style: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4)),
style: GoogleFonts.robotoMono(
textStyle: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4))),
image: "asset/image/exercise_plan_special.jpg",
top: 150,
left: 10,
onTap:() => {
@@ -100,12 +110,13 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
),
ImageButton(
width: imageWidth,
textAlignment: Alignment.topLeft,
text: t("My Arnold's Plan"),
style: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4)),
style: GoogleFonts.robotoMono(
textStyle: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
backgroundColor: Colors.black54.withOpacity(0.4))),
image: "asset/image/exercise_plan_stars.jpg",
top: 120,
left: 10,
onTap:() => {
+2 -28
View File
@@ -86,7 +86,7 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
children: <Widget>[
//Spacer(flex:4),
FlatButton(
/* FlatButton(
child: new Image.asset(
'asset/image/login_fb.png',
width: cWidth * .85,
@@ -96,7 +96,7 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
print("Login with FB"),
},
),
Text(AppLocalizations.of(context).translate("OR")),
Text(AppLocalizations.of(context).translate("OR")),*/
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.start,
@@ -187,30 +187,4 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
error,
style: TextStyle(color: Colors.white))));
}
/* Future<Null> _fbLogin() async {
final FacebookLogin facebookSignIn = new FacebookLogin();
final FacebookLoginResult result = await facebookSignIn.logIn(['email']);
switch (result.status) {
case FacebookLoginStatus.loggedIn:
final FacebookAccessToken accessToken = result.accessToken;
showInSnackBar('''
Logged in!
Token: ${accessToken.token}
User id: ${accessToken.userId}
Expires: ${accessToken.expires}
Permissions: ${accessToken.permissions}
Declined permissions: ${accessToken.declinedPermissions}
''');
break;
case FacebookLoginStatus.cancelledByUser:
showInSnackBar('Login cancelled by the user.');
break;
case FacebookLoginStatus.error:
showInSnackBar('Something went wrong with the login process.\n'
'Here\'s the error Facebook gave us: ${result.errorMessage}');
break;
}
} */
}
+135
View File
@@ -0,0 +1,135 @@
import 'package:aitrainer_app/bloc/login_form_bloc.dart';
import 'package:aitrainer_app/bloc/account/account_bloc.dart';
import 'package:aitrainer_app/bloc/reset_password_bloc.dart';
import 'package:aitrainer_app/localization/app_localization.dart';
import 'package:aitrainer_app/repository/user_repository.dart';
import 'package:aitrainer_app/service/firebase_api.dart';
import 'package:aitrainer_app/util/common.dart';
import 'package:aitrainer_app/util/trans.dart';
import 'package:aitrainer_app/widgets/splash.dart';
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 '../library_keys.dart';
// ignore: must_be_immutable
class ResetPasswordPage extends StatelessWidget with Trans {
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
setContext(context);
return BlocProvider(
create: (context) => ResetPasswordFormBloc(
userRepository: UserRepository(),
),
child: Builder(builder: (context) {
final loginBloc = BlocProvider.of<ResetPasswordFormBloc>(context);
return Scaffold(
key: _scaffoldKey,
body: FormBlocListener<ResetPasswordFormBloc, String, String>(
onSubmitting: (context, state) {
LoadingDialog.show(context);
},
onSuccess: (context, state) {
LoadingDialog.hide(context);
Navigator.of(context).pop();
},
onFailure: (context, state) {
LoadingDialog.hide(context);
showInSnackBar(state.failureResponse);
},
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('asset/image/WT_login.png'),
fit: BoxFit.cover,
//height: double.infinity,
//width: double.infinity,
alignment: Alignment.center,
),
),
child: buildResetPasswordForm(loginBloc),
),
),
);
}));
}
Widget buildResetPasswordForm(ResetPasswordFormBloc formBloc) {
return Form(
key: _formKey,
child: Container(
padding: const EdgeInsets.only(left: 25, right: 100),
child:
ListView(shrinkWrap: false, padding: EdgeInsets.only(top: 120.0),
children: <Widget>[
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
new InkWell(
child: new Text(
AppLocalizations.of(context).translate('I forgot the password'),
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,
),
Divider(
color: Colors.transparent,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
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: <Widget>[
new InkWell(
child: new Text(
AppLocalizations.of(context).translate('Login')),
onTap: () =>
Navigator.of(context).pushNamed('login'),
),
Spacer(flex: 1),
]),
])),
);
}
void showInSnackBar(String error) {
_scaffoldKey.currentState.showSnackBar(SnackBar(
backgroundColor: Colors.orange,
content: Text(error, style: TextStyle(color: Colors.white))));
}
}