diff --git a/i18n/en.json b/i18n/en.json index b628f19..757d0be 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -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" } \ No newline at end of file diff --git a/i18n/hu.json b/i18n/hu.json index 9ef75df..2594d60 100644 --- a/i18n/hu.json +++ b/i18n/hu.json @@ -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" } \ No newline at end of file diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 99a862e..aa1d27c 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -362,7 +362,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 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 = ( diff --git a/lib/service/firebase_api.dart b/lib/service/firebase_api.dart index 521e25f..09747fa 100644 --- a/lib/service/firebase_api.dart +++ b/lib/service/firebase_api.dart @@ -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); diff --git a/lib/view/exercise_new_page.dart b/lib/view/exercise_new_page.dart index 295110c..f8b85e4 100644 --- a/lib/view/exercise_new_page.dart +++ b/lib/view/exercise_new_page.dart @@ -62,7 +62,6 @@ class _ExerciseNewPageState extends State 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 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 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, ), diff --git a/lib/view/login.dart b/lib/view/login.dart index 57315ba..74d95d7 100644 --- a/lib/view/login.dart +++ b/lib/view/login.dart @@ -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 with Common, Trans { final loginBloc = BlocProvider.of(context); return Scaffold( key: _scaffoldKey, + appBar: AppBarMin(), body: FormBlocListener( onSubmitting: (context, state) { LoadingDialog.show(context); @@ -53,18 +55,22 @@ class _LoginWidget extends State 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), - ), + ) ), ); })); diff --git a/lib/view/registration.dart b/lib/view/registration.dart index 587c2df..beb5645 100644 --- a/lib/view/registration.dart +++ b/lib/view/registration.dart @@ -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 with Common { final accountBloc = BlocProvider.of(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(context); + final registrationBloc = + BlocProvider.of(context); return Scaffold( key: _scaffoldKey, + appBar: AppBarMin(), body: FormBlocListener( onSubmitting: (context, state) { LoadingDialog.show(context); @@ -65,29 +67,33 @@ class _RegistrationWidget extends State 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: [ - 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: [ + 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 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: [ - new FlatButton( - child: Image.asset( - 'asset/image/WT_OK.png', - width: 100, - height: 100), - onPressed: () => { - registrationBloc.add(SubmitFormBloc()) - }), - ]), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - children: [ - new InkWell( - child: new Text(AppLocalizations.of(context) - .translate('Login')), - onTap: () => Navigator.of(context) - .pushNamed('login'), - ), - Spacer(flex: 1), - new InkWell( - child: new Text(AppLocalizations.of(context) - .translate('Privacy')), - onTap: () => - Navigator.of(context).pushNamed('gdpr'), - ), - Spacer(flex: 2), - ]), - //Spacer(flex:2), - ])), + 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: [ + new FlatButton( + child: Image.asset( + 'asset/image/WT_OK.png', + width: 100, + height: 100), + onPressed: () => { + registrationBloc + .add(SubmitFormBloc()) + }), + ]), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceAround, + children: [ + new InkWell( + child: new Text( + AppLocalizations.of(context) + .translate('Login')), + onTap: () => Navigator.of(context) + .pushNamed('login'), + ), + Spacer(flex: 1), + new InkWell( + child: new Text( + AppLocalizations.of(context) + .translate('Privacy')), + onTap: () => Navigator.of(context) + .pushNamed('gdpr'), + ), + Spacer(flex: 2), + ]), + //Spacer(flex:2), + ])), + ), ), ), ), diff --git a/lib/view/reset_password.dart b/lib/view/reset_password.dart index 4c452ae..3d35778 100644 --- a/lib/view/reset_password.dart +++ b/lib/view/reset_password.dart @@ -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(context); return Scaffold( key: _scaffoldKey, + appBar: AppBarMin(), body: FormBlocListener( 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: [ + padding: const EdgeInsets.only(left: 25, right: 50), + child: ListView( + shrinkWrap: false, + padding: EdgeInsets.only(top: 150.0), + children: [ 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)))); } - } diff --git a/lib/widgets/app_bar.dart b/lib/widgets/app_bar.dart index 9bb162d..0388d77 100644 --- a/lib/widgets/app_bar.dart +++ b/lib/widgets/app_bar.dart @@ -119,7 +119,7 @@ class _AppBarNav extends State 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, diff --git a/lib/widgets/app_bar_min.dart b/lib/widgets/app_bar_min.dart new file mode 100644 index 0000000..4a5cbbd --- /dev/null +++ b/lib/widgets/app_bar_min.dart @@ -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 with Common { + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + + return AppBar( + backgroundColor: Colors.black, + title: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + 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(); + } + +} diff --git a/lib/widgets/loading.dart b/lib/widgets/loading.dart index 974b39b..02ab2d8 100644 --- a/lib/widgets/loading.dart +++ b/lib/widgets/loading.dart @@ -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: [ new Expanded( flex: 3, child: new Container( child: new Column( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, children: [ new Padding( padding: const EdgeInsets.only(top: 30.0),