From 90ad95bd6385ebdb31242f14d8c0d77b8c2580a3 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 12 Apr 2021 17:57:30 +0300 Subject: [PATCH] login fixes --- lib/screens/auth/login_screen.dart | 2 +- lib/widgets/auth/login_form.dart | 447 +++++++++++++++-------------- lib/widgets/otp/sms-popup.dart | 69 +++-- 3 files changed, 265 insertions(+), 253 deletions(-) diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index 957dcc66..465ef71e 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -119,7 +119,7 @@ class _LoginsreenState extends State { children: [ AuthHeader(loginType.knownUser), SizedBox( - height: 60, + height: 40, ), LoginForm( changeLoadingStata: changeLoadingStata, diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart index b4062853..487f6be9 100644 --- a/lib/widgets/auth/login_form.dart +++ b/lib/widgets/auth/login_form.dart @@ -69,231 +69,232 @@ class _LoginFormState extends State { return Form( key: loginFormKey, - child: Container( - width: SizeConfig.realScreenWidth * 0.90, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - buildSizedBox(), - Padding( - child: AppText( - TranslationBase.of(context).enterCredentials, - fontSize: 18, - fontWeight: FontWeight.bold, - ), - padding: EdgeInsets.only(top: 10, bottom: 10)), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"), - ), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 10, top: 10), - child: AppText( - TranslationBase.of(context).enterId, - fontWeight: FontWeight.w800, - fontSize: 14, - )), - AppTextFormField( - labelText: '', - borderColor: Colors.white, - // keyboardType: TextInputType.number, - textInputAction: TextInputAction.next, - // decoration: buildInputDecoration( - // context, - // TranslationBase.of(context).enterId, - // 'assets/images/user_id_icon.png'), - validator: (value) { - if (value != null && value.isEmpty) { - return TranslationBase.of(context) - .pleaseEnterYourID; - } - return null; - }, - onSaved: (value) { - if (value != null) userInfo.userID = value.trim(); - }, - onChanged: (value) { - if (value != null) userInfo.userID = value.trim(); - }, - onFieldSubmitted: (_) { - focusPass.nextFocus(); - }, - // onEditingComplete: () {}, - // autofocus: false, - ) - ])), - buildSizedBox(), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"), - ), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 10, top: 10), - child: AppText( - TranslationBase.of(context).enterPassword, - fontWeight: FontWeight.w800, - fontSize: 14, - )), - AppTextFormField( - focusNode: focusPass, - obscureText: true, - borderColor: Colors.white, - textInputAction: TextInputAction.next, - // decoration: buildInputDecoration( - // context, - // TranslationBase.of(context).enterPassword, - // 'assets/images/password_icon.png'), - validator: (value) { - if (value != null && value.isEmpty) { - return TranslationBase.of(context) - .pleaseEnterPassword; - } - return null; - }, - onSaved: (value) { - userInfo.password = value; - }, - onFieldSubmitted: (_) { - focusPass.nextFocus(); - helpers.showCupertinoPicker(context, projectsList, - 'facilityName', onSelectProject); - }, - onTap: () { - this.getProjects(userInfo.userID); - }, - ) - ])), - buildSizedBox(), - projectsList.length > 0 - ? Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"), - ), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 10, top: 10), - child: AppText( - TranslationBase.of(context).selectYourProject, - fontWeight: FontWeight.w600, - )), - AppTextFormField( - focusNode: focusProject, - controller: projectIdController, - borderColor: Colors.white, - suffixIcon: Icons.arrow_drop_down, - onTap: () { - helpers.showCupertinoPicker( - context, - projectsList, - 'facilityName', - onSelectProject); - }, - // showCursor: false, - // //readOnly: true, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: SizeConfig.realScreenWidth * 0.90, + height: SizeConfig.realScreenHeight * 0.65, + child: + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + buildSizedBox(), + Padding( + child: AppText( + TranslationBase.of(context).enterCredentials, + fontSize: 18, + fontWeight: FontWeight.bold, + ), + padding: EdgeInsets.only(top: 10, bottom: 10)), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"), + ), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(left: 10, top: 10), + child: AppText( + TranslationBase.of(context).enterId, + fontWeight: FontWeight.w800, + fontSize: 14, + )), + AppTextFormField( + labelText: '', + borderColor: Colors.white, + // keyboardType: TextInputType.number, + textInputAction: TextInputAction.next, + // decoration: buildInputDecoration( + // context, + // TranslationBase.of(context).enterId, + // 'assets/images/user_id_icon.png'), + validator: (value) { + if (value != null && value.isEmpty) { + return TranslationBase.of(context) + .pleaseEnterYourID; + } + return null; + }, + onSaved: (value) { + if (value != null) userInfo.userID = value.trim(); + }, + onChanged: (value) { + if (value != null) userInfo.userID = value.trim(); + }, + onFieldSubmitted: (_) { + focusPass.nextFocus(); + }, + // onEditingComplete: () {}, + // autofocus: false, + ) + ])), + buildSizedBox(), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"), + ), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(left: 10, top: 10), + child: AppText( + TranslationBase.of(context).enterPassword, + fontWeight: FontWeight.w800, + fontSize: 14, + )), + AppTextFormField( + focusNode: focusPass, + obscureText: true, + borderColor: Colors.white, + textInputAction: TextInputAction.next, + // decoration: buildInputDecoration( + // context, + // TranslationBase.of(context).enterPassword, + // 'assets/images/password_icon.png'), + validator: (value) { + if (value != null && value.isEmpty) { + return TranslationBase.of(context) + .pleaseEnterPassword; + } + return null; + }, + onSaved: (value) { + userInfo.password = value; + }, + onFieldSubmitted: (_) { + focusPass.nextFocus(); + helpers.showCupertinoPicker(context, projectsList, + 'facilityName', onSelectProject); + }, + onTap: () { + this.getProjects(userInfo.userID); + }, + ) + ])), + buildSizedBox(), + projectsList.length > 0 + ? Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"), + ), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(left: 10, top: 10), + child: AppText( + TranslationBase.of(context).selectYourProject, + fontWeight: FontWeight.w600, + )), + AppTextFormField( + focusNode: focusProject, + controller: projectIdController, + borderColor: Colors.white, + suffixIcon: Icons.arrow_drop_down, + onTap: () { + helpers.showCupertinoPicker( + context, + projectsList, + 'facilityName', + onSelectProject); + }, + // showCursor: false, + // //readOnly: true, + // decoration: buildInputDecoration( + // context, + // TranslationBase.of(context).selectYourProject, + // 'assets/images/password_icon.png'), + validator: (value) { + if (value != null && value.isEmpty) { + return TranslationBase.of(context) + .pleaseEnterYourProject; + } + return null; + }) + ])) + : Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"), + ), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(left: 10, top: 10), + child: AppText( + TranslationBase.of(context).selectYourProject, + fontWeight: FontWeight.w800, + fontSize: 14, + )), + AppTextFormField( + readOnly: true, borderColor: Colors.white, + prefix: IconButton( + icon: Icon(Icons.arrow_drop_down), + iconSize: 30, + padding: EdgeInsets.only(bottom: 30), + ), + // decoration: buildInputDecoration( // context, - // TranslationBase.of(context).selectYourProject, - // 'assets/images/password_icon.png'), - validator: (value) { - if (value != null && value.isEmpty) { - return TranslationBase.of(context) - .pleaseEnterYourProject; - } - return null; - }) - ])) - : Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"), - ), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(left: 10, top: 10), - child: AppText( - TranslationBase.of(context).selectYourProject, - fontWeight: FontWeight.w800, - fontSize: 14, - )), - AppTextFormField( - readOnly: true, borderColor: Colors.white, - prefix: IconButton( - icon: Icon(Icons.arrow_drop_down), - iconSize: 30, - padding: EdgeInsets.only(bottom: 30), - ), - - // decoration: buildInputDecoration( - // context, - // TranslationBase.of(context) - // .pleaseEnterYourProject, - // 'assets/images/password_icon.png') - ) - ])), - SizedBox( - height: 100, - ), - - Row( - children: [ - Expanded( - child: Button( - title: TranslationBase.of(context).login, - color: Colors.red[700], - onTap: () { - login(context, authProv, widget.changeLoadingStata); - }, - )), - ], - ) - // Row( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - // RaisedButton( - // onPressed: () { - // login(context, authProv, widget.changeLoadingStata); - // }, - // textColor: Colors.white, - // elevation: 0.0, - // padding: const EdgeInsets.all(0.0), - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(10), - // side: BorderSide(width: 0.5, color: HexColor('#CCCCCC'))), - // child: Container( - // padding: const EdgeInsets.all(10.0), - // height: 50, - // width: SizeConfig.realScreenWidth * 0.35, - // child: ), - // ) - // ], - // ), - ], - ), + // TranslationBase.of(context) + // .pleaseEnterYourProject, + // 'assets/images/password_icon.png') + ) + ])), + ]), + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Expanded( + child: Button( + title: TranslationBase.of(context).login, + color: HexColor('#D02127'), + onTap: () { + login(context, authProv, widget.changeLoadingStata); + }, + )), + ], + ) + // Row( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // RaisedButton( + // onPressed: () { + // login(context, authProv, widget.changeLoadingStata); + // }, + // textColor: Colors.white, + // elevation: 0.0, + // padding: const EdgeInsets.all(0.0), + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(10), + // side: BorderSide(width: 0.5, color: HexColor('#CCCCCC'))), + // child: Container( + // padding: const EdgeInsets.all(10.0), + // height: 50, + // width: SizeConfig.realScreenWidth * 0.35, + // child: ), + // ) + // ], + // ), + ], ), ); } diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart index a79fcdff..b60ebeb1 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/otp/sms-popup.dart @@ -60,20 +60,8 @@ class SMSOTP { builder: (context) { projectProvider = Provider.of(context); return AlertDialog( - contentPadding: EdgeInsets.fromLTRB(24.0, 20.0, 0.0, 24.0), - title: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - IconButton( - icon: Icon(Icons.close), - onPressed: () { - this.isClosed = true; - Navigator.pop(context); - this.onFailure(); - }, - ) - ], - ), + contentPadding: EdgeInsets.fromLTRB(24.0, 0.0, 0.0, 24.0), + // shape: RoundedRectangleBorder( // borderRadius: BorderRadius.all(Radius.circular(10.0))), content: StatefulBuilder(builder: (context, setState) { @@ -89,21 +77,44 @@ class SMSOTP { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - type == 1 - ? Padding( - child: Icon( - DoctorApp.verify_sms_1, - size: 40, - ), - padding: EdgeInsets.only(bottom: 20), - ) - : Padding( - child: Icon( - DoctorApp.verify_whtsapp, - size: 40, - ), - padding: EdgeInsets.only(bottom: 20), - ), + Padding( + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + type == 1 + ? Padding( + child: Icon( + DoctorApp.verify_sms_1, + size: 40, + ), + padding: EdgeInsets.only(bottom: 20), + ) + : Padding( + child: Icon( + DoctorApp.verify_whtsapp, + size: 40, + ), + padding: EdgeInsets.only(bottom: 20), + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Padding( + padding: EdgeInsets.only( + left: 10, right: 10, bottom: 20), + child: IconButton( + icon: Icon(Icons.close), + iconSize: 40, + onPressed: () { + this.isClosed = true; + Navigator.pop(context); + this.onFailure(); + }, + )) + ], + ) + ])), Padding( padding: EdgeInsets.only(top: 5), child: AppText(