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": " ",
"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:",
"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;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 28;
CURRENT_PROJECT_VERSION = 29;
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 = 28;
CURRENT_PROJECT_VERSION = 29;
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 = 28;
CURRENT_PROJECT_VERSION = 29;
DEVELOPMENT_TEAM = SFJJBDCU6Z;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (

View File

@ -73,7 +73,13 @@ class FirebaseApi {
} else if (e.code == 'email-already-in-use') {
print('The account already exists for that email.');
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) {
print(e);

View File

@ -62,7 +62,6 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans{
exerciseBloc.exerciseRepository.exerciseType.nameTranslation;
return Form(
autovalidate: true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: AppBarNav(depth: 1),
@ -168,7 +167,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans{
},
listViewHeight: 80,
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,
),
@ -197,7 +196,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans{
},
listViewHeight: 80,
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,
),

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/util/common.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:flutter/material.dart';
import 'package:flutter/cupertino.dart';
@ -43,6 +44,7 @@ class _LoginWidget extends State<LoginWidget> with Common, Trans {
final loginBloc = BlocProvider.of<LoginFormBloc>(context);
return Scaffold(
key: _scaffoldKey,
appBar: AppBarMin(),
body: FormBlocListener<LoginFormBloc, String, String>(
onSubmitting: (context, state) {
LoadingDialog.show(context);
@ -53,18 +55,22 @@ class _LoginWidget extends State<LoginWidget> with Common, Trans {
},
onFailure: (context, state) {
LoadingDialog.hide(context);
showInSnackBar(state.failureResponse);
showInSnackBar(t(state.failureResponse));
},
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('asset/image/WT_login.png'),
fit: BoxFit.cover,
alignment: Alignment.center,
child: SafeArea(
top: false,
bottom: false,
child: Container(
decoration: BoxDecoration(
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/repository/customer_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:flutter/material.dart';
import 'package:flutter/cupertino.dart';
@ -45,14 +46,15 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
final accountBloc = BlocProvider.of<AccountBloc>(context);
return BlocProvider(
create: (context) => RegistrationFormBloc(
userRepository: UserRepository(),
accountBloc: accountBloc),
userRepository: UserRepository(), accountBloc: accountBloc),
child: Builder(builder: (context) {
// ignore: close_sinks
final registrationBloc = BlocProvider.of<RegistrationFormBloc>(context);
final registrationBloc =
BlocProvider.of<RegistrationFormBloc>(context);
return Scaffold(
key: _scaffoldKey,
appBar: AppBarMin(),
body: FormBlocListener<RegistrationFormBloc, String, String>(
onSubmitting: (context, state) {
LoadingDialog.show(context);
@ -65,29 +67,33 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
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: SafeArea(
bottom: false,
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: Form(
key: _formKey,
child: Container(
padding: const EdgeInsets.only(left: 25, right: 50),
child: ListView(
shrinkWrap: false,
padding: EdgeInsets.only(top: 150.0),
//mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Divider(color: Colors.transparent,),
//Spacer(flex:4),
child: Form(
key: _formKey,
child: Container(
padding: const EdgeInsets.only(left: 25, right: 50),
child: ListView(
shrinkWrap: false,
padding: EdgeInsets.only(top: 150.0),
//mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Divider(
color: Colors.transparent,
),
//Spacer(flex:4),
/* FlatButton(
/* FlatButton(
child: new Image.asset(
'asset/image/login_fb.png',
width: cWidth * .85,
@ -98,79 +104,83 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
},
),
Text(AppLocalizations.of(context).translate("OR")),*/
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
new InkWell(
child: new Text(
AppLocalizations.of(context)
.translate('SignUp'),
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 24)),
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
new InkWell(
child: new Text(
AppLocalizations.of(context)
.translate('SignUp'),
style: TextStyle(
fontWeight: FontWeight.bold,
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(
color: Colors.transparent,
),
TextFieldBlocBuilder(
key: LibraryKeys.loginPasswordField,
textFieldBloc: registrationBloc.passwordField,
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
labelText: 'Password',
Divider(
color: Colors.transparent,
),
suffixButton: SuffixButton.obscureText,
),
Divider(
color: Colors.transparent,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
new FlatButton(
child: Image.asset(
'asset/image/WT_OK.png',
width: 100,
height: 100),
onPressed: () => {
registrationBloc.add(SubmitFormBloc())
}),
]),
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),
new InkWell(
child: new Text(AppLocalizations.of(context)
.translate('Privacy')),
onTap: () =>
Navigator.of(context).pushNamed('gdpr'),
),
Spacer(flex: 2),
]),
//Spacer(flex:2),
])),
TextFieldBlocBuilder(
key: LibraryKeys.loginPasswordField,
textFieldBloc: registrationBloc.passwordField,
decoration: InputDecoration(
fillColor: Colors.white,
filled: true,
labelText: 'Password',
),
suffixButton: SuffixButton.obscureText,
),
Divider(
color: Colors.transparent,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
new FlatButton(
child: Image.asset(
'asset/image/WT_OK.png',
width: 100,
height: 100),
onPressed: () => {
registrationBloc
.add(SubmitFormBloc())
}),
]),
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),
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/util/common.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:flutter/material.dart';
import 'package:flutter/cupertino.dart';
@ -24,12 +25,13 @@ class ResetPasswordPage extends StatelessWidget with Trans {
setContext(context);
return BlocProvider(
create: (context) => ResetPasswordFormBloc(
userRepository: UserRepository(),
),
userRepository: UserRepository(),
),
child: Builder(builder: (context) {
final loginBloc = BlocProvider.of<ResetPasswordFormBloc>(context);
return Scaffold(
key: _scaffoldKey,
appBar: AppBarMin(),
body: FormBlocListener<ResetPasswordFormBloc, String, String>(
onSubmitting: (context, state) {
LoadingDialog.show(context);
@ -42,17 +44,20 @@ class ResetPasswordPage extends StatelessWidget with Trans {
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: SafeArea(
bottom: false,
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),
),
child: buildResetPasswordForm(loginBloc),
),
),
);
@ -60,21 +65,22 @@ class ResetPasswordPage extends StatelessWidget with Trans {
}
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>[
padding: const EdgeInsets.only(left: 25, right: 50),
child: ListView(
shrinkWrap: false,
padding: EdgeInsets.only(top: 150.0),
children: <Widget>[
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
new InkWell(
child: new Text(
AppLocalizations.of(context).translate('I forgot the password'),
AppLocalizations.of(context)
.translate('I forgot the password'),
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 24)),
),
@ -103,9 +109,7 @@ class ResetPasswordPage extends StatelessWidget with Trans {
key: LibraryKeys.loginOKButton,
child: Image.asset('asset/image/WT_OK.png',
width: 100, height: 100),
onPressed: () => {
formBloc.add(SubmitFormBloc())
}),
onPressed: () => {formBloc.add(SubmitFormBloc())}),
]),
Divider(
color: Colors.transparent,
@ -116,8 +120,7 @@ class ResetPasswordPage extends StatelessWidget with Trans {
new InkWell(
child: new Text(
AppLocalizations.of(context).translate('Login')),
onTap: () =>
Navigator.of(context).pushNamed('login'),
onTap: () => Navigator.of(context).pushNamed('login'),
),
Spacer(flex: 1),
]),
@ -125,11 +128,9 @@ class ResetPasswordPage extends StatelessWidget with Trans {
);
}
void showInSnackBar(String error) {
_scaffoldKey.currentState.showSnackBar(SnackBar(
backgroundColor: Colors.orange,
content: Text(error, style: TextStyle(color: Colors.white))));
backgroundColor: Colors.orange,
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;
if ( sizeExerciseList == 0 ) {
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(
alignment: Alignment.topLeft,
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/material.dart';
@ -12,6 +13,7 @@ class LoadingScreenMain extends StatelessWidget {
);
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBarMin(),
body: new InkWell(
child: new Stack(
fit: StackFit.expand,
@ -23,17 +25,20 @@ class LoadingScreenMain extends StatelessWidget {
),
/// Render the background image
new Container(
child: _backgroundImage,
child: SafeArea(
bottom: false,
child: _backgroundImage,
)
),
/// Render the Title widget, loader and messages below each other
new Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Expanded(
flex: 3,
child: new Container(
child: new Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Padding(
padding: const EdgeInsets.only(top: 30.0),