From 837ff69c8259c44ef672f2884f8c992ff7930087 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 23 May 2021 16:33:20 +0300 Subject: [PATCH] fix design --- lib/screens/auth/login_screen.dart | 299 ++++----- .../auth/verification_methods_screen.dart | 579 +++++++++--------- lib/widgets/auth/method_type_card.dart | 4 +- lib/widgets/auth/sms-popup.dart | 401 ++++++------ 4 files changed, 619 insertions(+), 664 deletions(-) diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index 9563b29c..9eccd1c1 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -2,14 +2,11 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/hospitals/get_hospitals_response_model.dart'; import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart'; -import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -26,7 +23,6 @@ class _LoginScreenState extends State { String platformImei; bool allowCallApi = true; - //TODO change AppTextFormField to AppTextFormFieldCustom final loginFormKey = GlobalKey(); var projectIdController = TextEditingController(); var userIdController = TextEditingController(); @@ -42,176 +38,146 @@ class _LoginScreenState extends State { return AppScaffold( isShowAppBar: false, backgroundColor: HexColor('#F8F8F8'), - body: SafeArea( - child: ListView(children: [ - Container( + body: SingleChildScrollView( + child: SafeArea( + child: Container( margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 30), alignment: Alignment.topLeft, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - //TODO Use App Text rather than text - Container( - - child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + //TODO Use App Text rather than text + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment + .start, + children: [ + SizedBox( + height: 30, + ), + ], + ), + Column( crossAxisAlignment: CrossAxisAlignment - .start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment - .start, - children: [ - SizedBox( - height: 30, - ), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment - .start, children: [ - SizedBox( - height: 10, - ), - Text( - TranslationBase - .of(context) - .welcomeTo, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight - .w600, - fontFamily: 'Poppins'), - ), - Text( - TranslationBase - .of(context) - .drSulaimanAlHabib, - style: TextStyle( - color:Color(0xFF2B353E), - fontWeight: FontWeight - .bold, - fontSize: SizeConfig - .isMobile - ? 24 - : SizeConfig - .realScreenWidth * - 0.029, - fontFamily: 'Poppins'), - ), + .start, children: [ + SizedBox( + height: 10, + ), + Text( + TranslationBase + .of(context) + .welcomeTo, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight + .w600, + fontFamily: 'Poppins'), + ), + Text( + TranslationBase + .of(context) + .drSulaimanAlHabib, + style: TextStyle( + color: Color(0xFF2B353E), + fontWeight: FontWeight + .bold, + fontSize: 24, + fontFamily: 'Poppins'), + ), - Text( - "Doctor App", - style: TextStyle( - fontSize: - SizeConfig.isMobile - ? 16 - : SizeConfig - .realScreenWidth * - 0.030, - fontWeight: FontWeight - .w600, - color: Color(0xFFD02127)), - ), - ]), - ], - )), - SizedBox( - height: 40, - ), - Form( - key: loginFormKey, - child: Column( - mainAxisAlignment: MainAxisAlignment - .spaceBetween, - children: [ - Container( - width: SizeConfig - .realScreenWidth * 0.90, - height: SizeConfig - .realScreenHeight * 0.65, - child: - Column( - crossAxisAlignment: CrossAxisAlignment - .start, children: [ + Text( + "Doctor App", + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight + .w600, + color: Color(0xFFD02127)), + ), + ]), + ], + )), + SizedBox( + height: 40, + ), + Form( + key: loginFormKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment + .start, children: [ - buildSizedBox(), - AppTextFieldCustom( - hintText: TranslationBase.of(context).enterId, - hasBorder: true, - controller: userIdController, - onChanged: (value){ - if (value != null) - setState(() { - authenticationViewModel.userInfo - .userID = - value - .trim(); - }); - }, - ), - buildSizedBox(), - AppTextFieldCustom( - hintText: TranslationBase.of(context).enterPassword, - hasBorder: true, - isSecure: true, - controller: passwordController, - onChanged: (value){ - if (value != null) - setState(() { - authenticationViewModel.userInfo - .password = - value - .trim(); - }); - // if(allowCallApi) { - this.getProjects( - authenticationViewModel.userInfo - .userID); - // setState(() { - // allowCallApi = false; - // }); - // } - }, - onClick: (){ + buildSizedBox(), + AppTextFieldCustom( + hintText: TranslationBase.of(context).enterId, + hasBorder: true, + controller: userIdController, + onChanged: (value){ + if (value != null) + setState(() { + authenticationViewModel.userInfo + .userID = + value + .trim(); + }); + }, + ), + buildSizedBox(), + AppTextFieldCustom( + hintText: TranslationBase.of(context).enterPassword, + hasBorder: true, + isSecure: true, + controller: passwordController, + onChanged: (value){ + if (value != null) + setState(() { + authenticationViewModel.userInfo + .password = + value + .trim(); + }); + this.getProjects( + authenticationViewModel.userInfo + .userID); + }, + onClick: (){ - }, - ), - buildSizedBox(), - AppTextFieldCustom( - hintText: TranslationBase.of(context).selectYourProject, - hasBorder: true, - controller: projectIdController, - isTextFieldHasSuffix: true, - enabled: false, - onClick: (){ - Helpers - .showCupertinoPicker( - context, - projectsList, - 'facilityName', - onSelectProject, - authenticationViewModel); - }, + }, + ), + buildSizedBox(), + AppTextFieldCustom( + hintText: TranslationBase.of(context).selectYourProject, + hasBorder: true, + controller: projectIdController, + isTextFieldHasSuffix: true, + enabled: false, + onClick: (){ + Helpers + .showCupertinoPicker( + context, + projectsList, + 'facilityName', + onSelectProject, + authenticationViewModel); + }, - ), - buildSizedBox() - ]), - ), - ], - ), - ) - ], - ) - ])) - ]), + ), + buildSizedBox(), + ]), + ), + SizedBox( + height: 40, + ), + ], + )), + ), ), bottomSheet: Container( - height: 90, + height: 85, width: double.infinity, child: Center( child: FractionallySizedBox( @@ -260,15 +226,6 @@ class _LoginScreenState extends State { } else { GifLoaderDialogUtils.hideDialog(context); authenticationViewModel.setUnverified(true,isFromLogin: true); - // Navigator.of(context).pushReplacement( - // MaterialPageRoute( - // builder: (BuildContext context) => - // VerificationMethodsScreen( - // password: authenticationViewModel.userInfo.password, - // isFromLogin: true, - // ), - // ), - // ); } } } diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index 8257ebf0..75d6782c 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -65,277 +65,223 @@ class _VerificationMethodsScreenState extends State { body: SingleChildScrollView( child: Center( child: FractionallySizedBox( - child: Container( - margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), - height: SizeConfig.realScreenHeight * .95, - width: SizeConfig.realScreenWidth, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - SizedBox( - height: 80, - ), - if(authenticationViewModel.isFromLogin) - InkWell( - onTap: (){ - authenticationViewModel.setUnverified(false,isFromLogin: false); - authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); - }, - child: Icon(Icons.arrow_back_ios,color: Color(0xFF2B353E),) - - ), - Container( - - child: Column( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SizedBox( + height: 40, + ), + if(authenticationViewModel.isFromLogin) + InkWell( + onTap: (){ + authenticationViewModel.setUnverified(false,isFromLogin: false); + authenticationViewModel.setAppStatus(APP_STATUS.UNAUTHENTICATED); + }, + child: Icon(Icons.arrow_back_ios,color: Color(0xFF2B353E),) + + ), + Column( + children: [ + SizedBox( + height: 20, + ), + authenticationViewModel.user != null && isMoreOption == false + ? Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, children: [ + + AppText( + TranslationBase.of(context).welcomeBack, + fontSize:12, + fontWeight: FontWeight.w700, + color: Color(0xFF2B353E), + ), + AppText( + Helpers.capitalize(authenticationViewModel.user.doctorName), + fontSize: 24, + color: Color(0xFF2B353E), + fontWeight: FontWeight.bold, + ), SizedBox( height: 20, ), - authenticationViewModel.user != null && isMoreOption == false - ? Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - AppText( - TranslationBase.of(context).welcomeBack, - fontSize:12, - fontWeight: FontWeight.w700, - color: Color(0xFF2B353E), - ), - AppText( - Helpers.capitalize(authenticationViewModel.user.doctorName), - fontSize: 24, - color: Color(0xFF2B353E), - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context).accountInfo , - fontSize: 16, - color: Color(0xFF2E303A), - fontWeight: FontWeight.w600, - ), - SizedBox( - height: 20, + AppText( + TranslationBase.of(context).accountInfo , + fontSize: 16, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w600, + ), + SizedBox( + height: 20, + ), + Container( + padding: EdgeInsets.all(15), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10), ), - Container( - padding: EdgeInsets.all(15), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10), - ), - border: Border.all( - color: HexColor('#707070'), - width: 0.1), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - children: [ - - Text( - TranslationBase.of(context) - .lastLoginAt, - overflow: - TextOverflow.ellipsis, - style: TextStyle( - fontFamily: 'Poppins', - fontSize: 16, - color: Color(0xFF2E303A), - fontWeight: FontWeight.w700,), + border: Border.all( + color: HexColor('#707070'), + width: 0.1), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + children: [ + + Text( + TranslationBase.of(context) + .lastLoginAt, + overflow: + TextOverflow.ellipsis, + style: TextStyle( + fontFamily: 'Poppins', + fontSize: 16, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700,), - ), - Row( - children: [ - AppText( - TranslationBase - .of(context) - .verifyWith, - fontSize: 14, - color: Color(0xFF575757), - fontWeight: FontWeight.w600, - ), - AppText( - authenticationViewModel.getType( - authenticationViewModel.user - .logInTypeID, - context), - fontSize: 14, - color: Color(0xFF2B353E), - - fontWeight: FontWeight.w700, - ), - ], - ) - ], - crossAxisAlignment: CrossAxisAlignment.start,), - Column(children: [ + ), + Row( + children: [ AppText( - authenticationViewModel.user.editedOn != - null - ? AppDateUtils.getDayMonthYearDateFormatted( - AppDateUtils.convertStringToDate( - authenticationViewModel.user - .editedOn)) - : authenticationViewModel.user.createdOn != - null - ? AppDateUtils.getDayMonthYearDateFormatted( - AppDateUtils.convertStringToDate(authenticationViewModel.user - .createdOn)) - : '--', - textAlign: - TextAlign.right, - fontSize: 13, - color: Color(0xFF2E303A), - fontWeight: FontWeight.w700, + TranslationBase + .of(context) + .verifyWith, + fontSize: 14, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, ), AppText( - authenticationViewModel.user.editedOn != - null - ? AppDateUtils.getHour( - AppDateUtils.convertStringToDate( - authenticationViewModel.user - .editedOn)) - : authenticationViewModel.user.createdOn != - null - ? AppDateUtils.getHour( - AppDateUtils.convertStringToDate(authenticationViewModel.user - .createdOn)) - : '--', - textAlign: - TextAlign.right, + authenticationViewModel.getType( + authenticationViewModel.user + .logInTypeID, + context), fontSize: 14, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ) - ], - crossAxisAlignment: CrossAxisAlignment.start, + color: Color(0xFF2B353E), - ) - ], - ), - ), - SizedBox( - height: 20, - ), - Row( - children: [ + fontWeight: FontWeight.w700, + ), + ], + ) + ], + crossAxisAlignment: CrossAxisAlignment.start,), + Column(children: [ AppText( - "Please Verify", - fontSize: 16, - color: Color(0xFF2B353E), - + authenticationViewModel.user.editedOn != + null + ? AppDateUtils.getDayMonthYearDateFormatted( + AppDateUtils.convertStringToDate( + authenticationViewModel.user + .editedOn)) + : authenticationViewModel.user.createdOn != + null + ? AppDateUtils.getDayMonthYearDateFormatted( + AppDateUtils.convertStringToDate(authenticationViewModel.user + .createdOn)) + : '--', + textAlign: + TextAlign.right, + fontSize: 13, + color: Color(0xFF2E303A), fontWeight: FontWeight.w700, ), + AppText( + authenticationViewModel.user.editedOn != + null + ? AppDateUtils.getHour( + AppDateUtils.convertStringToDate( + authenticationViewModel.user + .editedOn)) + : authenticationViewModel.user.createdOn != + null + ? AppDateUtils.getHour( + AppDateUtils.convertStringToDate(authenticationViewModel.user + .createdOn)) + : '--', + textAlign: + TextAlign.right, + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), + ) ], - ) + crossAxisAlignment: CrossAxisAlignment.start, + + ) + ], + ), + ), + SizedBox( + height: 20, + ), + Row( + children: [ + AppText( + "Please Verify", + fontSize: 16, + color: Color(0xFF2B353E), + + fontWeight: FontWeight.w700, + ), ], ) - : Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - this.onlySMSBox == false - ? Container( - margin: EdgeInsets.only(bottom: 20, top: 30), - child: AppText( - TranslationBase.of(context) - .verifyLoginWith, - fontSize: 18, - color: Color(0xFF2E303A), - fontWeight: FontWeight.bold, - textAlign: TextAlign.left, - ), - ) - : AppText( - TranslationBase.of(context) - .verifyFingerprint2, - fontSize: - SizeConfig.textMultiplier * 2.5, - textAlign: TextAlign.start, - ), - ]), - authenticationViewModel.user != null && isMoreOption == false - ? Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Expanded( - child: InkWell( - onTap: () => - { - // TODO check this logic it seem it will create bug to us - authenticateUser( - AuthMethodTypes - .Fingerprint, true) - }, - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: SelectedAuthMethodTypesService - .getMethodsTypeService( - authenticationViewModel.user - .logInTypeID), - authenticateUser: - (AuthMethodTypes - authMethodType, - isActive) => - authenticateUser( - authMethodType, - isActive), - )), - ), - Expanded( - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: - AuthMethodTypes.MoreOptions, - onShowMore: () { - setState(() { - isMoreOption = true; - }); - }, - )) - ]), - ]) - : Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - onlySMSBox == false - ? Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Expanded( - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: - AuthMethodTypes.Fingerprint, - authenticateUser: - (AuthMethodTypes - authMethodType, - isActive) => - authenticateUser( - authMethodType, - isActive), - )), - Expanded( + ], + ) + : Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + this.onlySMSBox == false + ? Container( + margin: EdgeInsets.only(bottom: 20, top: 30), + child: AppText( + TranslationBase.of(context) + .verifyLoginWith, + fontSize: 18, + color: Color(0xFF2E303A), + fontWeight: FontWeight.bold, + textAlign: TextAlign.left, + ), + ) + : AppText( + TranslationBase.of(context) + .verifyFingerprint2, + fontSize: + SizeConfig.textMultiplier * 2.5, + textAlign: TextAlign.start, + ), + ]), + authenticationViewModel.user != null && isMoreOption == false + ? Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + child: InkWell( + onTap: () => + { + // TODO check this logic it seem it will create bug to us + authenticateUser( + AuthMethodTypes + .Fingerprint, true) + }, child: VerificationMethodsList( authenticationViewModel:authenticationViewModel, - authMethodType: - AuthMethodTypes.FaceID, + authMethodType: SelectedAuthMethodTypesService + .getMethodsTypeService( + authenticationViewModel.user + .logInTypeID), authenticateUser: (AuthMethodTypes authMethodType, @@ -343,48 +289,95 @@ class _VerificationMethodsScreenState extends State { authenticateUser( authMethodType, isActive), - )) - ], - ) - : SizedBox(), - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Expanded( - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: AuthMethodTypes - .SMS, - authenticateUser: - ( - AuthMethodTypes authMethodType, - isActive) => - authenticateUser( - authMethodType, isActive), )), - Expanded( - child: VerificationMethodsList( - authenticationViewModel:authenticationViewModel, - authMethodType: - AuthMethodTypes.WhatsApp, - authenticateUser: - ( - AuthMethodTypes authMethodType, - isActive) => - authenticateUser( - authMethodType, isActive), - )) - ], - ), - ]), - - // ) - ], - ), - ), - ], - ), + ), + Expanded( + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: + AuthMethodTypes.MoreOptions, + onShowMore: () { + setState(() { + isMoreOption = true; + }); + }, + )) + ]), + ]) + : Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + onlySMSBox == false + ? Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: + AuthMethodTypes.Fingerprint, + authenticateUser: + (AuthMethodTypes + authMethodType, + isActive) => + authenticateUser( + authMethodType, + isActive), + )), + Expanded( + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: + AuthMethodTypes.FaceID, + authenticateUser: + (AuthMethodTypes + authMethodType, + isActive) => + authenticateUser( + authMethodType, + isActive), + )) + ], + ) + : SizedBox(), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: AuthMethodTypes + .SMS, + authenticateUser: + ( + AuthMethodTypes authMethodType, + isActive) => + authenticateUser( + authMethodType, isActive), + )), + Expanded( + child: VerificationMethodsList( + authenticationViewModel:authenticationViewModel, + authMethodType: + AuthMethodTypes.WhatsApp, + authenticateUser: + ( + AuthMethodTypes authMethodType, + isActive) => + authenticateUser( + authMethodType, isActive), + )) + ], + ), + ]), + + // ) + ], + ), + ], ), ), ), diff --git a/lib/widgets/auth/method_type_card.dart b/lib/widgets/auth/method_type_card.dart index 6d091756..6cdaabd8 100644 --- a/lib/widgets/auth/method_type_card.dart +++ b/lib/widgets/auth/method_type_card.dart @@ -31,7 +31,7 @@ class MethodTypeCard extends StatelessWidget { ), height: 170, child: Padding( - padding: EdgeInsets.fromLTRB(20, 15, 20, 15), + padding: EdgeInsets.fromLTRB(10, 15, 10, 15), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, @@ -50,7 +50,7 @@ class MethodTypeCard extends StatelessWidget { ), AppText( label, - fontSize: 14, + fontSize: 12, color: Color(0xFF2E303A), fontWeight: FontWeight.bold, ) diff --git a/lib/widgets/auth/sms-popup.dart b/lib/widgets/auth/sms-popup.dart index 0c374e58..528102b0 100644 --- a/lib/widgets/auth/sms-popup.dart +++ b/lib/widgets/auth/sms-popup.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/auth_method_types.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; @@ -48,6 +47,8 @@ class SMSOTP { String displayTime = ''; bool isClosed = false; displayDialog(BuildContext context) async { + double dialogWidth = MediaQuery.of(context).size.width * 0.84; + double dialogHeight = MediaQuery.of(context).size.height * 0.50; return showDialog( context: context, barrierColor: Colors.black.withOpacity(0.7), @@ -61,209 +62,213 @@ class SMSOTP { } return Container( color: Colors.white, - height: MediaQuery.of(context).size.height * 0.50, - width: MediaQuery.of(context).size.width * 0.84, + height: dialogHeight, + width: dialogWidth, child: Center( child: SingleChildScrollView( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.all(13), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - type == AuthMethodTypes.SMS - ? Padding( - child: Icon( - DoctorApp.verify_sms_1, - size: 50, - ), - padding: EdgeInsets.only(bottom: 20), - ) - : Padding( - child: Icon( - DoctorApp.verify_whtsapp, - size: 50, - ), - 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, right: 5), - child: AppText( - TranslationBase.of(context).verificationMessage + - ' XXXXXX' + - mobileNo - .toString() - .substring(mobileNo.toString().length - 3), - textAlign: TextAlign.start, - fontWeight: FontWeight.bold, - fontSize: 14, - maxLines: 2, - )), - Form( - key: verifyAccountForm, - child: Padding( - padding: EdgeInsets.only(top: 20), - child: Directionality( - textDirection: TextDirection.ltr, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - width: SizeConfig.realScreenWidth * 0.16, - margin: EdgeInsets.all(5), - child: TextFormField( - textInputAction: TextInputAction.next, - style: buildTextStyle(), - autofocus: true, - maxLength: 1, - controller: digit1, - textAlign: TextAlign.center, - keyboardType: TextInputType.number, - decoration: buildInputDecoration(context), - onSaved: (val) {}, - validator: validateCodeDigit, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD2); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD2); - verifyAccountFormValue['digit1'] = - val.trim(); - checkValue(); - } - }, - ), - ), - Container( - width: SizeConfig.realScreenWidth * 0.16, - margin: EdgeInsets.all(5), - child: TextFormField( - focusNode: focusD2, - textInputAction: TextInputAction.next, - maxLength: 1, - controller: digit2, - textAlign: TextAlign.center, - style: buildTextStyle(), - keyboardType: TextInputType.number, - decoration: buildInputDecoration(context), - onSaved: (val) {}, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD3); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD3); - verifyAccountFormValue['digit2'] = - val.trim(); - checkValue(); - } - }, - validator: validateCodeDigit), - ), - Container( - margin: EdgeInsets.all(5), - width: SizeConfig.realScreenWidth * 0.16, - child: TextFormField( - focusNode: focusD3, - textInputAction: TextInputAction.next, - maxLength: 1, - controller: digit3, - textAlign: TextAlign.center, - style: buildTextStyle(), - keyboardType: TextInputType.number, - decoration: - buildInputDecoration(context), - onSaved: (val) {}, - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD4); - }, - onChanged: (val) { - if (val.length == 1) { - FocusScope.of(context) - .requestFocus(focusD4); - verifyAccountFormValue['digit3'] = - val.trim(); - checkValue(); - } - }, - validator: validateCodeDigit)), - Container( - margin: EdgeInsets.all(5), - width: SizeConfig.realScreenWidth * 0.16, - child: TextFormField( - focusNode: focusD4, - maxLength: 1, - textAlign: TextAlign.center, - style: buildTextStyle(), - controller: digit4, - keyboardType: TextInputType.number, - decoration: - buildInputDecoration(context), - onFieldSubmitted: (_) { - FocusScope.of(context) - .requestFocus(focusD4); - }, - onChanged: (val) { - if (val.length == 1) { - verifyAccountFormValue['digit4'] = - val.trim(); - checkValue(); - } - }, - validator: validateCodeDigit)), - ], - )), - ), - ), - Padding( - padding: const EdgeInsets.all(12.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).validationMessage + - ' ', - fontWeight: FontWeight.w600, - fontSize: 14, + children: [ + Padding( + padding: EdgeInsets.all(13), + child: Row( + mainAxisAlignment: MainAxisAlignment + .spaceBetween, + children: [ + Padding( + child: Icon( + type == AuthMethodTypes.SMS + ? DoctorApp.verify_sms_1 + : DoctorApp.verify_whtsapp, + size: dialogWidth * 0.13, + ), + 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: dialogWidth * 0.13, + onPressed: () { + this.isClosed = true; + Navigator.pop(context); + this.onFailure(); + }, + )) + ], + ) + ])), + Padding( + padding: EdgeInsets.only(top: 5, right: 5), + child: AppText( + TranslationBase.of(context).verificationMessage + + ' XXXXXX' + + mobileNo + .toString() + .substring(mobileNo.toString().length - 3), + textAlign: TextAlign.start, + fontWeight: FontWeight.bold, + fontSize: 14, + maxLines: 2, + )), + Form( + key: verifyAccountForm, + child: Padding( + padding: EdgeInsets.only(top: 20), + child: Directionality( + textDirection: TextDirection.ltr, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + width: (dialogWidth / 4) - 20, + height: 100, + margin: EdgeInsets.all(5), + child: TextFormField( + textInputAction: TextInputAction + .next, + style: buildTextStyle(), + autofocus: true, + maxLength: 1, + controller: digit1, + textAlign: TextAlign.center, + keyboardType: TextInputType.number, + decoration: buildInputDecoration( + context), + onSaved: (val) {}, + validator: validateCodeDigit, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(focusD2); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD2); + verifyAccountFormValue['digit1'] = + val.trim(); + checkValue(); + } + }, + ), + ), + Container( + width: dialogWidth / 4 - 30, + margin: EdgeInsets.all(5), + child: TextFormField( + focusNode: focusD2, + textInputAction: TextInputAction + .next, + maxLength: 1, + controller: digit2, + textAlign: TextAlign.center, + style: buildTextStyle(), + keyboardType: TextInputType + .number, + decoration: buildInputDecoration( + context), + onSaved: (val) {}, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(focusD3); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD3); + verifyAccountFormValue['digit2'] = + val.trim(); + checkValue(); + } + }, + validator: validateCodeDigit), + ), + Container( + margin: EdgeInsets.all(5), + width: dialogWidth / 4 - 30, + child: TextFormField( + focusNode: focusD3, + textInputAction: TextInputAction + .next, + maxLength: 1, + controller: digit3, + textAlign: TextAlign.center, + style: buildTextStyle(), + keyboardType: TextInputType + .number, + decoration: + buildInputDecoration(context), + onSaved: (val) {}, + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(focusD4); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD4); + verifyAccountFormValue['digit3'] = + val.trim(); + checkValue(); + } + }, + validator: validateCodeDigit)), + Container( + margin: EdgeInsets.all(5), + width: dialogWidth / 4 - 30, + child: TextFormField( + focusNode: focusD4, + maxLength: 1, + textAlign: TextAlign.center, + style: buildTextStyle(), + controller: digit4, + keyboardType: TextInputType + .number, + decoration: + buildInputDecoration(context), + onFieldSubmitted: (_) { + FocusScope.of(context) + .requestFocus(focusD4); + }, + onChanged: (val) { + if (val.length == 1) { + verifyAccountFormValue['digit4'] = + val.trim(); + checkValue(); + } + }, + validator: validateCodeDigit)), + ], + )), + ), ), - AppText( - displayTime, - color: Colors.red, - textAlign: TextAlign.start, - fontWeight: FontWeight.bold, - fontSize: 14, + Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).validationMessage + + ' ', + fontWeight: FontWeight.w600, + fontSize: 14, + ), + AppText( + displayTime, + color: Colors.red, + textAlign: TextAlign.start, + fontWeight: FontWeight.bold, + fontSize: 14, + ) + ]), ) - ]), - ) - ], - ))), + ], + ))), ); }), );