WT1.1.2f login fix

This commit is contained in:
bossanyit 2020-10-30 07:49:39 +01:00
parent 8f651ceb0d
commit cffc397d70
11 changed files with 232 additions and 142 deletions

View File

@ -206,5 +206,6 @@
"hu_with": " ", "hu_with": " ",
"Are you sure to delete this exercise?": "Are you sure to delete this exercise?", "Are you sure to delete this exercise?": "Are you sure to delete this exercise?",
"I forgot the password":"I forgot the password" "I forgot the password":"I forgot the password",
"Exception: Instance of 'NotFoundException'": "Customer with the email not found. Please register or reset your password"
} }

View File

@ -208,5 +208,6 @@
"Summary of your test":"A teszt összefoglalása:", "Summary of your test":"A teszt összefoglalása:",
"Are you sure to delete this exercise?": "Biztos, hogy törlöd a gyakorlatot?", "Are you sure to delete this exercise?": "Biztos, hogy törlöd a gyakorlatot?",
"I forgot the password":"Elfelejtett jelszó" "I forgot the password":"Elfelejtett jelszó",
"Exception: Instance of 'NotFoundException'": "Ezzel az email címmel nem található felhasználó. Kérlek regisztálj vagy kérj jelszóemlékeztetőt"
} }

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 = 28; CURRENT_PROJECT_VERSION = 29;
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 = 28; CURRENT_PROJECT_VERSION = 29;
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 = 28; CURRENT_PROJECT_VERSION = 29;
DEVELOPMENT_TEAM = SFJJBDCU6Z; DEVELOPMENT_TEAM = SFJJBDCU6Z;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (

View File

@ -73,7 +73,13 @@ class FirebaseApi {
} else if (e.code == 'email-already-in-use') { } else if (e.code == 'email-already-in-use') {
print('The account already exists for that email.'); print('The account already exists for that email.');
rc = REGISTER_EMAIL_IN_USE; rc = REGISTER_EMAIL_IN_USE;
throw Exception("Customer exists"); userCredential = await FirebaseAuth.instance.signInWithEmailAndPassword(
email: email,
password: password
);
if ( rc != null ) {
String rc = SIGN_IN_OK;
}
} }
} catch (e) { } catch (e) {
print(e); print(e);

View File

@ -62,7 +62,6 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans{
exerciseBloc.exerciseRepository.exerciseType.nameTranslation; exerciseBloc.exerciseRepository.exerciseType.nameTranslation;
return Form( return Form(
autovalidate: true,
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
appBar: AppBarNav(depth: 1), appBar: AppBarNav(depth: 1),
@ -168,7 +167,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans{
}, },
listViewHeight: 80, listViewHeight: 80,
textStyle: TextStyle(fontSize: 24), textStyle: TextStyle(fontSize: 24),
textStyleHighlighted: TextStyle(fontSize: 40, color: Colors.orange, fontWeight: FontWeight.bold), textStyleHighlighted: TextStyle(fontSize: 38, color: Colors.orange, fontWeight: FontWeight.bold),
//decoration: _decoration, //decoration: _decoration,
), ),
@ -197,7 +196,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans{
}, },
listViewHeight: 80, listViewHeight: 80,
textStyle: TextStyle(fontSize: 24), textStyle: TextStyle(fontSize: 24),
textStyleHighlighted: TextStyle(fontSize: 40, color: Colors.orange, fontWeight: FontWeight.bold), textStyleHighlighted: TextStyle(fontSize: 38, color: Colors.orange, fontWeight: FontWeight.bold),
//decoration: _decoration, //decoration: _decoration,
), ),

View File

@ -4,6 +4,7 @@ import 'package:aitrainer_app/localization/app_localization.dart';
import 'package:aitrainer_app/repository/user_repository.dart'; import 'package:aitrainer_app/repository/user_repository.dart';
import 'package:aitrainer_app/util/common.dart'; import 'package:aitrainer_app/util/common.dart';
import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/util/trans.dart';
import 'package:aitrainer_app/widgets/app_bar_min.dart';
import 'package:aitrainer_app/widgets/splash.dart'; import 'package:aitrainer_app/widgets/splash.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -43,6 +44,7 @@ class _LoginWidget extends State<LoginWidget> with Common, Trans {
final loginBloc = BlocProvider.of<LoginFormBloc>(context); final loginBloc = BlocProvider.of<LoginFormBloc>(context);
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: AppBarMin(),
body: FormBlocListener<LoginFormBloc, String, String>( body: FormBlocListener<LoginFormBloc, String, String>(
onSubmitting: (context, state) { onSubmitting: (context, state) {
LoadingDialog.show(context); LoadingDialog.show(context);
@ -53,18 +55,22 @@ class _LoginWidget extends State<LoginWidget> with Common, Trans {
}, },
onFailure: (context, state) { onFailure: (context, state) {
LoadingDialog.hide(context); LoadingDialog.hide(context);
showInSnackBar(state.failureResponse); showInSnackBar(t(state.failureResponse));
}, },
child: Container( child: SafeArea(
decoration: BoxDecoration( top: false,
image: DecorationImage( bottom: false,
image: AssetImage('asset/image/WT_login.png'), child: Container(
fit: BoxFit.cover, decoration: BoxDecoration(
alignment: Alignment.center, image: DecorationImage(
image: AssetImage('asset/image/WT_login.png'),
fit: BoxFit.cover,
alignment: Alignment.center,
),
), ),
child: buildLoginForm(loginBloc, accountBloc),
), ),
child: buildLoginForm(loginBloc, accountBloc), )
),
), ),
); );
})); }));

View File

@ -4,6 +4,7 @@ import 'package:aitrainer_app/localization/app_localization.dart';
import 'package:aitrainer_app/util/common.dart'; import 'package:aitrainer_app/util/common.dart';
import 'package:aitrainer_app/repository/customer_repository.dart'; import 'package:aitrainer_app/repository/customer_repository.dart';
import 'package:aitrainer_app/repository/user_repository.dart'; import 'package:aitrainer_app/repository/user_repository.dart';
import 'package:aitrainer_app/widgets/app_bar_min.dart';
import 'package:aitrainer_app/widgets/splash.dart'; import 'package:aitrainer_app/widgets/splash.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -45,14 +46,15 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
final accountBloc = BlocProvider.of<AccountBloc>(context); final accountBloc = BlocProvider.of<AccountBloc>(context);
return BlocProvider( return BlocProvider(
create: (context) => RegistrationFormBloc( create: (context) => RegistrationFormBloc(
userRepository: UserRepository(), userRepository: UserRepository(), accountBloc: accountBloc),
accountBloc: accountBloc),
child: Builder(builder: (context) { child: Builder(builder: (context) {
// ignore: close_sinks // ignore: close_sinks
final registrationBloc = BlocProvider.of<RegistrationFormBloc>(context); final registrationBloc =
BlocProvider.of<RegistrationFormBloc>(context);
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: AppBarMin(),
body: FormBlocListener<RegistrationFormBloc, String, String>( body: FormBlocListener<RegistrationFormBloc, String, String>(
onSubmitting: (context, state) { onSubmitting: (context, state) {
LoadingDialog.show(context); LoadingDialog.show(context);
@ -65,29 +67,33 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
LoadingDialog.hide(context); LoadingDialog.hide(context);
showInSnackBar(state.failureResponse); showInSnackBar(state.failureResponse);
}, },
child: Container( child: SafeArea(
decoration: BoxDecoration( bottom: false,
image: DecorationImage( child: Container(
image: AssetImage('asset/image/WT_login.png'), decoration: BoxDecoration(
fit: BoxFit.cover, image: DecorationImage(
//height: double.infinity, image: AssetImage('asset/image/WT_login.png'),
//width: double.infinity, fit: BoxFit.cover,
alignment: Alignment.center, //height: double.infinity,
//width: double.infinity,
alignment: Alignment.center,
),
), ),
), child: Form(
child: Form( key: _formKey,
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,
shrinkWrap: false, padding: EdgeInsets.only(top: 150.0),
padding: EdgeInsets.only(top: 150.0), //mainAxisAlignment: MainAxisAlignment.spaceAround,
//mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[
children: <Widget>[ Divider(
Divider(color: Colors.transparent,), color: Colors.transparent,
//Spacer(flex:4), ),
//Spacer(flex:4),
/* FlatButton( /* 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,
@ -98,79 +104,83 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
}, },
), ),
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) AppLocalizations.of(context)
.translate('SignUp'), .translate('SignUp'),
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 24)), fontSize: 24)),
),
],
),
Divider(),
TextFieldBlocBuilder(
key: LibraryKeys.loginEmailField,
textFieldBloc: registrationBloc.emailField,
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
labelText: 'Email',
), ),
],
),
Divider(),
TextFieldBlocBuilder(
key: LibraryKeys.loginEmailField,
textFieldBloc: registrationBloc.emailField,
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
labelText: 'Email',
), ),
), Divider(
Divider( color: Colors.transparent,
color: Colors.transparent,
),
TextFieldBlocBuilder(
key: LibraryKeys.loginPasswordField,
textFieldBloc: registrationBloc.passwordField,
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
labelText: 'Password',
), ),
suffixButton: SuffixButton.obscureText, TextFieldBlocBuilder(
), key: LibraryKeys.loginPasswordField,
Divider( textFieldBloc: registrationBloc.passwordField,
color: Colors.transparent, decoration: InputDecoration(
), fillColor: Colors.white,
Row( filled: true,
mainAxisAlignment: MainAxisAlignment.end, labelText: 'Password',
children: <Widget>[ ),
new FlatButton( suffixButton: SuffixButton.obscureText,
child: Image.asset( ),
'asset/image/WT_OK.png', Divider(
width: 100, color: Colors.transparent,
height: 100), ),
onPressed: () => { Row(
registrationBloc.add(SubmitFormBloc()) mainAxisAlignment: MainAxisAlignment.end,
}), children: <Widget>[
]), new FlatButton(
Row( child: Image.asset(
mainAxisAlignment: 'asset/image/WT_OK.png',
MainAxisAlignment.spaceAround, width: 100,
children: <Widget>[ height: 100),
new InkWell( onPressed: () => {
child: new Text(AppLocalizations.of(context) registrationBloc
.translate('Login')), .add(SubmitFormBloc())
onTap: () => Navigator.of(context) }),
.pushNamed('login'), ]),
), Row(
Spacer(flex: 1), mainAxisAlignment:
new InkWell( MainAxisAlignment.spaceAround,
child: new Text(AppLocalizations.of(context) children: <Widget>[
.translate('Privacy')), new InkWell(
onTap: () => child: new Text(
Navigator.of(context).pushNamed('gdpr'), AppLocalizations.of(context)
), .translate('Login')),
Spacer(flex: 2), onTap: () => Navigator.of(context)
]), .pushNamed('login'),
//Spacer(flex:2), ),
])), 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),
])),
),
), ),
), ),
), ),

View File

@ -6,6 +6,7 @@ import 'package:aitrainer_app/repository/user_repository.dart';
import 'package:aitrainer_app/service/firebase_api.dart'; import 'package:aitrainer_app/service/firebase_api.dart';
import 'package:aitrainer_app/util/common.dart'; import 'package:aitrainer_app/util/common.dart';
import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/util/trans.dart';
import 'package:aitrainer_app/widgets/app_bar_min.dart';
import 'package:aitrainer_app/widgets/splash.dart'; import 'package:aitrainer_app/widgets/splash.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -24,12 +25,13 @@ class ResetPasswordPage extends StatelessWidget with Trans {
setContext(context); setContext(context);
return BlocProvider( return BlocProvider(
create: (context) => ResetPasswordFormBloc( create: (context) => ResetPasswordFormBloc(
userRepository: UserRepository(), userRepository: UserRepository(),
), ),
child: Builder(builder: (context) { child: Builder(builder: (context) {
final loginBloc = BlocProvider.of<ResetPasswordFormBloc>(context); final loginBloc = BlocProvider.of<ResetPasswordFormBloc>(context);
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
appBar: AppBarMin(),
body: FormBlocListener<ResetPasswordFormBloc, String, String>( body: FormBlocListener<ResetPasswordFormBloc, String, String>(
onSubmitting: (context, state) { onSubmitting: (context, state) {
LoadingDialog.show(context); LoadingDialog.show(context);
@ -42,17 +44,20 @@ class ResetPasswordPage extends StatelessWidget with Trans {
LoadingDialog.hide(context); LoadingDialog.hide(context);
showInSnackBar(state.failureResponse); showInSnackBar(state.failureResponse);
}, },
child: Container( child: SafeArea(
decoration: BoxDecoration( bottom: false,
image: DecorationImage( child: Container(
image: AssetImage('asset/image/WT_login.png'), decoration: BoxDecoration(
fit: BoxFit.cover, image: DecorationImage(
//height: double.infinity, image: AssetImage('asset/image/WT_login.png'),
//width: double.infinity, fit: BoxFit.cover,
alignment: Alignment.center, //height: double.infinity,
//width: double.infinity,
alignment: Alignment.center,
),
), ),
child: buildResetPasswordForm(loginBloc),
), ),
child: buildResetPasswordForm(loginBloc),
), ),
), ),
); );
@ -60,21 +65,22 @@ class ResetPasswordPage extends StatelessWidget with Trans {
} }
Widget buildResetPasswordForm(ResetPasswordFormBloc formBloc) { Widget buildResetPasswordForm(ResetPasswordFormBloc formBloc) {
return Form( return Form(
key: _formKey, key: _formKey,
child: Container( child: Container(
padding: const EdgeInsets.only(left: 25, right: 100), padding: const EdgeInsets.only(left: 25, right: 50),
child: child: ListView(
ListView(shrinkWrap: false, padding: EdgeInsets.only(top: 120.0), shrinkWrap: false,
children: <Widget>[ padding: EdgeInsets.only(top: 150.0),
children: <Widget>[
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('I forgot the password'), AppLocalizations.of(context)
.translate('I forgot the password'),
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 24)), fontWeight: FontWeight.bold, fontSize: 24)),
), ),
@ -103,9 +109,7 @@ class ResetPasswordPage extends StatelessWidget with Trans {
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: () => { onPressed: () => {formBloc.add(SubmitFormBloc())}),
formBloc.add(SubmitFormBloc())
}),
]), ]),
Divider( Divider(
color: Colors.transparent, color: Colors.transparent,
@ -116,8 +120,7 @@ class ResetPasswordPage extends StatelessWidget with Trans {
new InkWell( new InkWell(
child: new Text( child: new Text(
AppLocalizations.of(context).translate('Login')), AppLocalizations.of(context).translate('Login')),
onTap: () => onTap: () => Navigator.of(context).pushNamed('login'),
Navigator.of(context).pushNamed('login'),
), ),
Spacer(flex: 1), Spacer(flex: 1),
]), ]),
@ -125,11 +128,9 @@ class ResetPasswordPage extends StatelessWidget with Trans {
); );
} }
void showInSnackBar(String error) { void showInSnackBar(String error) {
_scaffoldKey.currentState.showSnackBar(SnackBar( _scaffoldKey.currentState.showSnackBar(SnackBar(
backgroundColor: Colors.orange, backgroundColor: Colors.orange,
content: Text(error, style: TextStyle(color: Colors.white)))); content: Text(error, style: TextStyle(color: Colors.white))));
} }
} }

View File

@ -119,7 +119,7 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin,
int sizeExerciseList = Cache().getExercises() == null? 0 : Cache().getExercises().length; int sizeExerciseList = Cache().getExercises() == null? 0 : Cache().getExercises().length;
if ( sizeExerciseList == 0 ) { if ( sizeExerciseList == 0 ) {
String text = AppLocalizations.of(context).translate("Make your first test"); String text = AppLocalizations.of(context).translate("Make your first test");
double fontSize = text.length > 24 ? 10 : 16; double fontSize = text.length > 24 ? 13 : 16;
return Stack( return Stack(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
overflow: Overflow.clip, overflow: Overflow.clip,

View File

@ -0,0 +1,61 @@
import 'dart:async';
import 'package:aitrainer_app/bloc/menu/menu_bloc.dart';
import 'package:aitrainer_app/localization/app_localization.dart';
import 'package:aitrainer_app/model/cache.dart';
import 'package:aitrainer_app/repository/exercise_repository.dart';
import 'package:aitrainer_app/util/common.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:percent_indicator/linear_percent_indicator.dart';
import 'package:rainbow_color/rainbow_color.dart';
class AppBarMin extends StatefulWidget implements PreferredSizeWidget {
const AppBarMin();
@override
_AppBarNav createState() => _AppBarNav();
@override
Size get preferredSize => const Size.fromHeight(50);
}
class _AppBarNav extends State<AppBarMin> with Common {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return AppBar(
backgroundColor: Colors.black,
title: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Image.asset(
'asset/image/WT_long_logo.png',
//fit: BoxFit.cover,
height: 45.0,
),
],
),
leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black),
onPressed: () =>
{
},
)
);
}
@override
void dispose() {
super.dispose();
}
}

View File

@ -1,3 +1,4 @@
import 'package:aitrainer_app/widgets/app_bar_min.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -12,6 +13,7 @@ class LoadingScreenMain extends StatelessWidget {
); );
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: AppBarMin(),
body: new InkWell( body: new InkWell(
child: new Stack( child: new Stack(
fit: StackFit.expand, fit: StackFit.expand,
@ -23,17 +25,20 @@ class LoadingScreenMain extends StatelessWidget {
), ),
/// Render the background image /// Render the background image
new Container( new Container(
child: _backgroundImage, child: SafeArea(
bottom: false,
child: _backgroundImage,
)
), ),
/// Render the Title widget, loader and messages below each other /// Render the Title widget, loader and messages below each other
new Column( new Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
new Expanded( new Expanded(
flex: 3, flex: 3,
child: new Container( child: new Container(
child: new Column( child: new Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
new Padding( new Padding(
padding: const EdgeInsets.only(top: 30.0), padding: const EdgeInsets.only(top: 30.0),