From 17c47d093c844c6c38e56c5c153ab60b6f96d366 Mon Sep 17 00:00:00 2001 From: aamir-csol Date: Thu, 18 Sep 2025 16:10:55 +0300 Subject: [PATCH] otp screen & register Uae & resend Activation Code. --- assets/langs/ar-SA.json | 5 +- assets/langs/en-US.json | 7 +- lib/extensions/widget_extensions.dart | 3 +- .../authentication_view_model.dart | 191 ++++--- .../widgets/otp_verification_screen.dart | 17 +- lib/generated/locale_keys.g.dart | 2 + .../authentication/register_step2.dart | 517 +++++++++--------- .../authentication/saved_login_screen.dart | 31 +- .../bottomsheet/generic_bottom_sheet.dart | 5 +- lib/widgets/buttons/custom_button.dart | 2 +- .../dropdown/country_dropdown_widget.dart | 25 +- lib/widgets/dropdown/dropdown_widget.dart | 2 + lib/widgets/input_widget.dart | 7 +- 13 files changed, 426 insertions(+), 388 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index ea6ad94..19111f7 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -847,5 +847,8 @@ "pleaseSelectAMaritalStatus": "يرجى اختيار الحالة الاجتماعية", "pleaseSelectACountry": "يرجى اختيار الدولة", "pleaseEnterEmail": "يرجى إدخال البريد الإلكتروني", - "pleaseEnterAValidEmailFormat": "يرجى إدخال تنسيق بريد إلكتروني صالح" + "pleaseEnterAValidEmailFormat": "يرجى إدخال تنسيق بريد إلكتروني صالح", + "selectCountry": "اختر الدولة", + "forLoginVerification": "للتحقق من تسجيل الدخول" + } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index b90557e..27609c8 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -803,7 +803,6 @@ "loginByOTP": "Login By OTP", "guest": "Guest", "switchAccount": "Switch Account", - "lastloginBy": "Last login by", "allSet": "All Set! Now you can login with Face ID or Biometric", "enableQuickLogin": "Enable Quick Login", "enableMsg": "Enabling the quick login will verify through your existing device Face ID / Biometric", @@ -843,6 +842,8 @@ "pleaseSelectAMaritalStatus": "Please select a marital status", "pleaseSelectACountry": "Please select a country", "pleaseEnterEmail": "Please enter email", - "pleaseEnterAValidEmailFormat": "Please enter a valid email format" - + "pleaseEnterAValidEmailFormat": "Please enter a valid email format", + "selectCountry": "Select Country", + "forLoginVerification": "for login verification", + "lastLoginBy": "Last login by" } \ No newline at end of file diff --git a/lib/extensions/widget_extensions.dart b/lib/extensions/widget_extensions.dart index 1136c32..26a1442 100644 --- a/lib/extensions/widget_extensions.dart +++ b/lib/extensions/widget_extensions.dart @@ -150,13 +150,14 @@ extension SmoothContainerExtension on ShapeBorder { bool isDisabled = false, Color? backgroundColor, BorderSide? side, + BorderRadius? customBorder, bool hasShadow = false, }) { final bgColor = backgroundColor ?? color; return ShapeDecoration( color: isDisabled ? bgColor.withOpacity(0.5) : bgColor, shape: SmoothRectangleBorder( - borderRadius: BorderRadius.circular(borderRadius ?? 0), + borderRadius: customBorder ?? BorderRadius.circular(borderRadius ?? 0), smoothness: 1, side: side ?? BorderSide.none, ), diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart index c0b20b5..11374b7 100644 --- a/lib/features/authentication/authentication_view_model.dart +++ b/lib/features/authentication/authentication_view_model.dart @@ -59,8 +59,7 @@ class AuthenticationViewModel extends ChangeNotifier { required NavigationService navigationService, required CacheService cacheService, required LocalAuthService localAuthService, - }) - : _navigationService = navigationService, + }) : _navigationService = navigationService, _dialogService = dialogService, _errorHandlerService = errorHandlerService, _appState = appState, @@ -205,13 +204,13 @@ class AuthenticationViewModel extends ChangeNotifier { final result = await _authenticationRepo.selectDeviceByImei(firebaseToken: firebaseToken); result.fold( - (failure) async { + (failure) async { // LoadingUtils.hideFullScreenLoader(); // await _errorHandlerService.handleError(failure: failure); LoaderBottomSheet.hideLoader(); _navigationService.pushPage(page: LoginScreen()); }, - (apiResponse) { + (apiResponse) { // LoadingUtils.hideFullScreenLoader(); log("apiResponse: ${apiResponse.data.toString()}"); log("messageStatus: ${apiResponse.messageStatus.toString()}"); @@ -301,8 +300,7 @@ class AuthenticationViewModel extends ChangeNotifier { final result = await _authenticationRepo.checkPatientAuthentication(checkPatientAuthenticationReq: checkPatientAuthenticationReq); result.fold( - (failure) async => - await _errorHandlerService.handleError( + (failure) async => await _errorHandlerService.handleError( failure: failure, onUnHandledFailure: (failure) async { LoaderBottomSheet.hideLoader(); @@ -316,7 +314,7 @@ class AuthenticationViewModel extends ChangeNotifier { _navigationService.pop(); }); }), - (apiResponse) async { + (apiResponse) async { if (apiResponse.messageStatus == 2) { LoaderBottomSheet.hideLoader(); await _dialogService.showErrorBottomSheet(message: apiResponse.errorMessage ?? "ErrorEmpty", onOkPressed: () {}); @@ -359,8 +357,8 @@ class AuthenticationViewModel extends ChangeNotifier { patientOutSA: isForRegister ? isPatientOutsideSA(request: payload) : selectedCountrySignup.countryCode == CountryEnum.saudiArabia - ? false - : true, + ? false + : true, payload: payload, ); @@ -374,8 +372,8 @@ class AuthenticationViewModel extends ChangeNotifier { final resultEither = await _authenticationRepo.sendActivationCodeRepo(sendActivationCodeReq: request, isRegister: checkIsUserComingForRegister(request: payload), languageID: 'er'); resultEither.fold( - (failure) async => await _errorHandlerService.handleError(failure: failure), - (apiResponse) async { + (failure) async => await _errorHandlerService.handleError(failure: failure), + (apiResponse) async { if (apiResponse.messageStatus == 2) { LoaderBottomSheet.hideLoader(); await _dialogService.showCommonBottomSheetWithoutH( @@ -409,27 +407,27 @@ class AuthenticationViewModel extends ChangeNotifier { bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true || _appState.getUserRegistrationPayload.patientOutSa == 1); final request = RequestUtils.getCommonRequestWelcome( - phoneNumber: phoneNumberController.text, - otpTypeEnum: otpTypeEnum, - deviceToken: _appState.deviceToken, - // patientOutSA: _appState.getUserRegistrationPayload.projectOutSa == 1 ? true : false, - patientOutSA: isForRegister - ? _appState.getUserRegistrationPayload.projectOutSa == true - ? true - : false - : _appState.getSelectDeviceByImeiRespModelElement != null - ? _appState.getSelectDeviceByImeiRespModelElement!.outSa! - : selectedCountrySignup == CountryEnum.saudiArabia - ? false - : true, - loginTokenID: _appState.appAuthToken, - registeredData: isForRegister ? _appState.getUserRegistrationPayload : null, - nationIdText: nationalIdController.text, - countryCode: _appState.getSelectDeviceByImeiRespModelElement != null && _appState.getSelectDeviceByImeiRespModelElement!.outSa == true - ? CountryEnum.unitedArabEmirates.countryCode - : selectedCountrySignup.countryCode, - //TODO: Error Here IN Zip Code. - loginType: loginTypeEnum.toInt) + phoneNumber: phoneNumberController.text, + otpTypeEnum: otpTypeEnum, + deviceToken: _appState.deviceToken, + // patientOutSA: _appState.getUserRegistrationPayload.projectOutSa == 1 ? true : false, + patientOutSA: isForRegister + ? _appState.getUserRegistrationPayload.projectOutSa == true + ? true + : false + : _appState.getSelectDeviceByImeiRespModelElement != null + ? _appState.getSelectDeviceByImeiRespModelElement!.outSa! + : selectedCountrySignup == CountryEnum.saudiArabia + ? false + : true, + loginTokenID: _appState.appAuthToken, + registeredData: isForRegister ? _appState.getUserRegistrationPayload : null, + nationIdText: nationalIdController.text, + countryCode: _appState.getSelectDeviceByImeiRespModelElement != null && _appState.getSelectDeviceByImeiRespModelElement!.outSa == true + ? CountryEnum.unitedArabEmirates.countryCode + : selectedCountrySignup.countryCode, + //TODO: Error Here IN Zip Code. + loginType: loginTypeEnum.toInt) .toJson(); LoaderBottomSheet.showLoader(); if (isForRegister) { @@ -445,8 +443,7 @@ class AuthenticationViewModel extends ChangeNotifier { LoaderBottomSheet.hideLoader(); resultEither.fold( - (failure) async => - await _errorHandlerService.handleError( + (failure) async => await _errorHandlerService.handleError( failure: failure, onUnHandledFailure: (failure) async { LoaderBottomSheet.hideLoader(); @@ -454,9 +451,6 @@ class AuthenticationViewModel extends ChangeNotifier { message: failure.message, label: LocaleKeys.notice.tr(), onOkPressed: () { - _navigationService.pushAndReplace(AppRoutes.register); - }, - onCancelPressed: () { _navigationService.pop(); }); }), (apiResponse) { @@ -473,8 +467,7 @@ class AuthenticationViewModel extends ChangeNotifier { final resultEither = await _authenticationRepo.checkActivationCodeRepo(newRequest: CheckActivationCodeRegisterReq.fromJson(request), activationCode: activationCode, isRegister: false); resultEither.fold( - (failure) async => - await _errorHandlerService.handleError( + (failure) async => await _errorHandlerService.handleError( failure: failure, onUnHandledFailure: (failure) async { LoaderBottomSheet.hideLoader(); @@ -658,15 +651,15 @@ class AuthenticationViewModel extends ChangeNotifier { bool isOutSidePatient = selectedCountrySignup.countryCode == CountryEnum.unitedArabEmirates.countryCode ? true : false; LoaderBottomSheet.showLoader(); final request = await RequestUtils.getPatientAuthenticationRequest( - phoneNumber: phoneNumberController.text, - nationId: nationalIdController.text, - patientOutSA: isOutSidePatient, - otpTypeEnum: otpTypeEnum, - isForRegister: true, - patientId: 0, - zipCode: selectedCountrySignup.countryCode, - calenderType: calenderType, - dob: dob) + phoneNumber: phoneNumberController.text, + nationId: nationalIdController.text, + patientOutSA: isOutSidePatient, + otpTypeEnum: otpTypeEnum, + isForRegister: true, + patientId: 0, + zipCode: selectedCountrySignup.countryCode, + calenderType: calenderType, + dob: dob) .toJson(); var nRequest = Map.from(request); @@ -802,22 +795,22 @@ class AuthenticationViewModel extends ChangeNotifier { Future insertPatientIMEIData(int loginType) async { final resultEither = await _authenticationRepo.insertPatientIMEIData( patientIMEIDataRequest: PatientInsertDeviceImei( - imei: _appState.deviceToken, - deviceTypeId: _appState.getDeviceTypeID(), - patientId: _appState.getAuthenticatedUser()!.patientId!, - patientIdentificationNo: _appState.getAuthenticatedUser()!.patientIdentificationNo!, - identificationNo: _appState.getAuthenticatedUser()!.patientIdentificationNo!, - firstName: _appState.getAuthenticatedUser()!.firstName!, - lastName: _appState.getAuthenticatedUser()!.lastName!, - patientTypeId: _appState.getAuthenticatedUser()!.patientType, - mobileNo: _appState.getAuthenticatedUser()!.mobileNumber!, - logInTypeId: loginType, - patientOutSa: _appState.getAuthenticatedUser()!.outSa!, - outSa: _appState.getAuthenticatedUser()!.outSa == 1 ? true : false, - biometricEnabled: loginType == 1 || loginType == 2 ? false : true, - firstNameN: _appState.getAuthenticatedUser()!.firstNameN, - lastNameN: _appState.getAuthenticatedUser()!.lastNameN, - ).toJson()); + imei: _appState.deviceToken, + deviceTypeId: _appState.getDeviceTypeID(), + patientId: _appState.getAuthenticatedUser()!.patientId!, + patientIdentificationNo: _appState.getAuthenticatedUser()!.patientIdentificationNo!, + identificationNo: _appState.getAuthenticatedUser()!.patientIdentificationNo!, + firstName: _appState.getAuthenticatedUser()!.firstName!, + lastName: _appState.getAuthenticatedUser()!.lastName!, + patientTypeId: _appState.getAuthenticatedUser()!.patientType, + mobileNo: _appState.getAuthenticatedUser()!.mobileNumber!, + logInTypeId: loginType, + patientOutSa: _appState.getAuthenticatedUser()!.outSa!, + outSa: _appState.getAuthenticatedUser()!.outSa == 1 ? true : false, + biometricEnabled: loginType == 1 || loginType == 2 ? false : true, + firstNameN: _appState.getAuthenticatedUser()!.firstNameN, + lastNameN: _appState.getAuthenticatedUser()!.lastNameN, + ).toJson()); resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async { if (apiResponse.messageStatus == 1) { log("Insert IMEI Success"); @@ -831,20 +824,20 @@ class AuthenticationViewModel extends ChangeNotifier { Future insertPatientDeviceData(int loginType) async { final resultEither = await _authenticationRepo.insertPatientDeviceData( patientDeviceDataRequest: InsertPatientMobileDeviceInfo( - deviceToken: _appState.deviceToken, - deviceTypeId: _appState.getDeviceTypeID(), - patientId: _appState.getAuthenticatedUser()!.patientId!, - patientTypeId: _appState.getAuthenticatedUser()!.patientType, - patientOutSa: _appState.getAuthenticatedUser()!.outSa!, - loginType: loginType, - languageId: _appState.getLanguageID(), - latitude: _appState.userLat, - longitude: _appState.userLong, - voipToken: "", - deviceType: _appState.deviceTypeID, - patientMobileNumber: _appState.getAuthenticatedUser()!.mobileNumber, - nationalId: _appState.getAuthenticatedUser()!.patientIdentificationNo, - gender: _appState.getAuthenticatedUser()!.gender) + deviceToken: _appState.deviceToken, + deviceTypeId: _appState.getDeviceTypeID(), + patientId: _appState.getAuthenticatedUser()!.patientId!, + patientTypeId: _appState.getAuthenticatedUser()!.patientType, + patientOutSa: _appState.getAuthenticatedUser()!.outSa!, + loginType: loginType, + languageId: _appState.getLanguageID(), + latitude: _appState.userLat, + longitude: _appState.userLong, + voipToken: "", + deviceType: _appState.deviceTypeID, + patientMobileNumber: _appState.getAuthenticatedUser()!.mobileNumber, + nationalId: _appState.getAuthenticatedUser()!.patientIdentificationNo, + gender: _appState.getAuthenticatedUser()!.gender) .toJson()); resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async { if (apiResponse.messageStatus == 1) { @@ -858,18 +851,18 @@ class AuthenticationViewModel extends ChangeNotifier { Future getPatientDeviceData(int loginType) async { final resultEither = await _authenticationRepo.getPatientDeviceData( patientDeviceDataRequest: GetUserMobileDeviceData( - deviceToken: _appState.deviceToken, - deviceTypeId: _appState.getDeviceTypeID(), - patientId: _appState.getSelectDeviceByImeiRespModelElement!.patientId!, - patientType: _appState.getSelectDeviceByImeiRespModelElement!.patientType, - patientOutSa: _appState.getSelectDeviceByImeiRespModelElement!.outSa == true ? 1 : 0, - loginType: loginType, - languageId: _appState.getLanguageID(), - latitude: _appState.userLat, - longitude: _appState.userLong, - mobileNo: _appState.getSelectDeviceByImeiRespModelElement!.mobile!, - patientMobileNumber: int.parse(_appState.getSelectDeviceByImeiRespModelElement!.mobile!), - nationalId: _appState.getSelectDeviceByImeiRespModelElement!.identificationNo) + deviceToken: _appState.deviceToken, + deviceTypeId: _appState.getDeviceTypeID(), + patientId: _appState.getSelectDeviceByImeiRespModelElement!.patientId!, + patientType: _appState.getSelectDeviceByImeiRespModelElement!.patientType, + patientOutSa: _appState.getSelectDeviceByImeiRespModelElement!.outSa == true ? 1 : 0, + loginType: loginType, + languageId: _appState.getLanguageID(), + latitude: _appState.userLat, + longitude: _appState.userLong, + mobileNo: _appState.getSelectDeviceByImeiRespModelElement!.mobile!, + patientMobileNumber: int.parse(_appState.getSelectDeviceByImeiRespModelElement!.mobile!), + nationalId: _appState.getSelectDeviceByImeiRespModelElement!.identificationNo) .toJson()); resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async { if (apiResponse.messageStatus == 1) { @@ -885,11 +878,15 @@ class AuthenticationViewModel extends ChangeNotifier { message: apiResponse.errorMessage ?? "", label: LocaleKeys.notice.tr(), onOkPressed: () { - _dialogService.showPhoneNumberPickerSheet(label:"Where would you like to receive OTP?", message:"Please select from the below options to receive OTP.", onSMSPress: () { - checkUserAuthentication(otpTypeEnum: OTPTypeEnum.sms); - }, onWhatsappPress: () { - checkUserAuthentication(otpTypeEnum: OTPTypeEnum.whatsapp); - }); + _dialogService.showPhoneNumberPickerSheet( + label: "Where would you like to receive OTP?", + message: "Please select from the below options to receive OTP.", + onSMSPress: () { + checkUserAuthentication(otpTypeEnum: OTPTypeEnum.sms); + }, + onWhatsappPress: () { + checkUserAuthentication(otpTypeEnum: OTPTypeEnum.whatsapp); + }); }, onCancelPressed: () { _navigationService.pop(); @@ -914,8 +911,8 @@ class AuthenticationViewModel extends ChangeNotifier { List projectDetailListModel = []; resultEither.fold( - (failure) async => await _errorHandlerService.handleError(failure: failure), - (apiResponse) async { + (failure) async => await _errorHandlerService.handleError(failure: failure), + (apiResponse) async { if (apiResponse.messageStatus == 2) { await _dialogService.showErrorBottomSheet(message: apiResponse.errorMessage ?? "ErrorEmpty"); } else { diff --git a/lib/features/authentication/widgets/otp_verification_screen.dart b/lib/features/authentication/widgets/otp_verification_screen.dart index 5f8cdf0..e7f8d72 100644 --- a/lib/features/authentication/widgets/otp_verification_screen.dart +++ b/lib/features/authentication/widgets/otp_verification_screen.dart @@ -533,6 +533,7 @@ class _OTPVerificationScreenState extends State { @override Widget build(BuildContext context) { AuthenticationViewModel authVM = context.read(); + AppState appState = getIt(); return Scaffold( backgroundColor: AppColors.scaffoldBgColor, appBar: CustomAppBar( @@ -552,14 +553,16 @@ class _OTPVerificationScreenState extends State { LocaleKeys.otpVerification.tr().toText24(isBold: true), SizedBox(height: 20.h), Wrap( - spacing: 4.h, - runSpacing: 8.0, + spacing: 2.h, + runSpacing: 2.h, children: [ - LocaleKeys.weHaveSendOTP.tr().toText16(color: AppColors.inputLabelTextColor), - _getMaskedPhoneNumber().toText16(color: AppColors.inputLabelTextColor, isBold: true), - LocaleKeys.via.tr().toText16(color: AppColors.inputLabelTextColor), - authVM.loginTypeEnum.displayName.toText16(color: AppColors.inputLabelTextColor), - LocaleKeys.forRegistrationVerification.tr().toText16(color: AppColors.inputLabelTextColor), + LocaleKeys.weHaveSendOTP.tr().toText15(color: AppColors.inputLabelTextColor, letterSpacing: -0.4), + _getMaskedPhoneNumber().toText15(color: AppColors.inputLabelTextColor, isBold: true), + LocaleKeys.via.tr().toText15(color: AppColors.inputLabelTextColor, letterSpacing: -0.4), + authVM.loginTypeEnum.displayName.toText15(color: AppColors.inputLabelTextColor, isBold: true, letterSpacing: -0.4), + appState.getUserRegistrationPayload.isRegister != null && appState.getUserRegistrationPayload.isRegister == true + ? LocaleKeys.forRegistrationVerification.tr().toText15(color: AppColors.inputLabelTextColor, letterSpacing: -0.4) + : LocaleKeys.forLoginVerification.tr().toText15(color: AppColors.inputLabelTextColor, letterSpacing: -0.4), ], ), diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 6445de8..a452959 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -846,5 +846,7 @@ abstract class LocaleKeys { static const pleaseSelectACountry = 'pleaseSelectACountry'; static const pleaseEnterEmail = 'pleaseEnterEmail'; static const pleaseEnterAValidEmailFormat = 'pleaseEnterAValidEmailFormat'; + static const selectCountry = 'selectCountry'; + static const forLoginVerification = 'forLoginVerification'; } diff --git a/lib/presentation/authentication/register_step2.dart b/lib/presentation/authentication/register_step2.dart index 8dbe8e8..3466497 100644 --- a/lib/presentation/authentication/register_step2.dart +++ b/lib/presentation/authentication/register_step2.dart @@ -43,9 +43,11 @@ class _RegisterNew extends State { @override Widget build(BuildContext context) { AppState appState = getIt.get(); - var name = appState.getLanguageCode() == "en" - ? ("${appState.getNHICUserData.firstNameEn!.toUpperCase()} ${appState.getNHICUserData.lastNameEn!.toUpperCase()}") - : ("${appState.getNHICUserData.firstNameAr!.toUpperCase()} ${appState.getNHICUserData.lastNameAr!.toUpperCase()}"); + var name = authVM!.isUserFromUAE() + ? "" + : appState.getLanguageCode() == "en" + ? ("${appState.getNHICUserData.firstNameEn!.toUpperCase()} ${appState.getNHICUserData.lastNameEn!.toUpperCase()}") + : ("${appState.getNHICUserData.firstNameAr!.toUpperCase()} ${appState.getNHICUserData.lastNameAr!.toUpperCase()}"); return Scaffold( backgroundColor: AppColors.bgScaffoldColor, appBar: CustomAppBar( @@ -57,262 +59,273 @@ class _RegisterNew extends State { onLanguageChanged: (lang) {}, hideLogoAndLang: true, ), - body: SingleChildScrollView( - reverse: false, - padding: EdgeInsets.only(left: 24.h, right: 24.h, top: 0.h), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - LocaleKeys.personalDetailsVerification.tr().toText26(color: AppColors.textColor, weight: FontWeight.w600, letterSpacing: -2), - SizedBox(height: 24.h), - Directionality( - textDirection: Directionality.of(context), - child: Container( - decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(24)), - padding: EdgeInsets.only(left: 16.h, right: 16.h), - child: Column( + body: GestureDetector( + onTap: () { + FocusScope.of(context).unfocus(); + }, + behavior: HitTestBehavior.translucent, // Ensures taps on empty space are detected + child: SizedBox( + width: double.infinity, + height: double.infinity, + child: SingleChildScrollView( + reverse: false, + padding: EdgeInsets.only(left: 24.h, right: 24.h, top: 0.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.personalDetailsVerification.tr().toText26(color: AppColors.textColor, weight: FontWeight.w600, letterSpacing: -2), + SizedBox(height: 24.h), + Container( + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(24)), + padding: EdgeInsets.only(left: 16.h, right: 16.h), + child: Column( + children: [ + TextInputWidget( + labelText: authVM!.isUserFromUAE() ? LocaleKeys.fullName.tr() : LocaleKeys.name.tr(), + hintText: authVM!.isUserFromUAE() ? LocaleKeys.enterNameHere.tr() : (name), + controller: authVM!.isUserFromUAE() ? authVM!.nameController : null, + isEnable: true, + prefix: null, + isAllowRadius: false, + isBorderAllowed: false, + keyboardType: TextInputType.text, + // textInputAction: TextInputAction.done, + onSubmitted: (value) { + FocusScope.of(context).unfocus(); + }, + isAllowLeadingIcon: true, + isReadOnly: authVM!.isUserFromUAE() ? false : true, + leadingIcon: AppAssets.user_circle, + labelColor: AppColors.textColor, + ).paddingSymmetrical(0.h, 16.h), + Divider(height: 1, color: AppColors.greyColor), + TextInputWidget( + labelText: LocaleKeys.nationalIdNumber.tr(), + hintText: authVM!.isUserFromUAE() ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : (appState.getNHICUserData.idNumber ?? ""), + controller: null, + isEnable: true, + prefix: null, + isAllowRadius: false, + isBorderAllowed: false, + isAllowLeadingIcon: true, + isReadOnly: true, + labelColor: AppColors.textColor, + leadingIcon: AppAssets.student_card) + .paddingSymmetrical(0.h, 16.h), + Divider(height: 1, color: AppColors.greyColor), + authVM!.isUserFromUAE() + ? Selector( + selector: (_, authViewModel) => authViewModel.genderType, + shouldRebuild: (previous, next) => previous != next, + builder: (context, genderType, child) { + final authVM = context.read(); + return DropdownWidget( + labelText: LocaleKeys.gender.tr(), + hintText: LocaleKeys.malE.tr(), + isEnable: true, + dropdownItems: GenderTypeEnum.values.map((e) => appState.isArabic() ? e.typeAr : e.type).toList(), + selectedValue: genderType != null ? (appState.isArabic() ? genderType.typeAr : genderType.type) : "", + onChange: authVM.onGenderChange, + isBorderAllowed: false, + hasSelectionCustomIcon: true, + isAllowRadius: false, + labelColor: AppColors.textColor, + padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), + selectionCustomIcon: AppAssets.arrow_down, + leadingIcon: AppAssets.user_full, + ).withVerticalPadding(8); + }) + : TextInputWidget( + labelText: LocaleKeys.gender.tr(), + hintText: (appState.getNHICUserData.gender ?? ""), + controller: null, + isEnable: true, + prefix: null, + isAllowRadius: false, + isBorderAllowed: false, + isAllowLeadingIcon: true, + isReadOnly: authVM!.isUserFromUAE() ? false : true, + leadingIcon: AppAssets.user_full, + labelColor: AppColors.textColor, + onChange: (value) {}) + .paddingSymmetrical(0.h, 16.h), + Divider(height: 1, color: AppColors.greyColor), + authVM!.isUserFromUAE() + ? Selector( + selector: (_, authViewModel) => authViewModel.maritalStatus, + shouldRebuild: (previous, next) => previous != next, + builder: (context, maritalStatus, child) { + final authVM = context.read(); // For onChange + return DropdownWidget( + labelText: LocaleKeys.maritalStatus.tr(), + hintText: LocaleKeys.married.tr(), + isEnable: true, + dropdownItems: MaritalStatusTypeEnum.values.map((e) => appState.isArabic() ? e.typeAr : e.type).toList(), + selectedValue: maritalStatus != null ? (appState.isArabic() ? maritalStatus.typeAr : maritalStatus.type) : "", + onChange: authVM.onMaritalStatusChange, + isBorderAllowed: false, + hasSelectionCustomIcon: true, + isAllowRadius: false, + labelColor: AppColors.textColor, + padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), + selectionCustomIcon: AppAssets.arrow_down, + leadingIcon: AppAssets.smart_phone, + ).withVerticalPadding(8); + }, + ) + : TextInputWidget( + labelText: LocaleKeys.maritalStatus.tr(), + hintText: appState.isArabic() + ? (MaritalStatusTypeExtension.fromValue(appState.getNHICUserData.maritalStatusCode)!.typeAr) + : (MaritalStatusTypeExtension.fromValue(appState.getNHICUserData.maritalStatusCode)!.type), + isEnable: true, + prefix: null, + isAllowRadius: false, + isBorderAllowed: false, + isAllowLeadingIcon: true, + isReadOnly: true, + labelColor: AppColors.textColor, + leadingIcon: AppAssets.smart_phone, + onChange: (value) {}) + .paddingSymmetrical(0.h, 16.h), + Divider(height: 1, color: AppColors.greyColor), + authVM!.isUserFromUAE() + ? Selector? countriesList, NationalityCountries? selectedCountry, bool isArabic})>( + selector: (context, authViewModel) { + final appState = getIt.get(); + return ( + countriesList: authViewModel.countriesList, + selectedCountry: authViewModel.pickedCountryByUAEUser, + isArabic: appState.isArabic(), + ); + }, + shouldRebuild: (previous, next) => previous.countriesList != next.countriesList || previous.selectedCountry != next.selectedCountry || previous.isArabic != next.isArabic, + builder: (context, data, child) { + final authVM = context.read(); + return DropdownWidget( + labelText: LocaleKeys.country.tr(), + hintText: LocaleKeys.uae.tr(), + isEnable: true, + dropdownItems: (data.countriesList ?? []).map((e) => data.isArabic ? e.nameN ?? "" : e.name ?? "").toList(), + selectedValue: data.selectedCountry != null + ? data.isArabic + ? data.selectedCountry!.nameN ?? "" + : data.selectedCountry!.name ?? "" + : "", + onChange: authVM.onUAEUserCountrySelection, + isBorderAllowed: false, + hasSelectionCustomIcon: true, + labelColor: AppColors.textColor, + isAllowRadius: false, + padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), + selectionCustomIcon: AppAssets.arrow_down, + leadingIcon: AppAssets.globe, + ).withVerticalPadding(8); + }, + ) + : TextInputWidget( + labelText: LocaleKeys.nationality.tr(), + hintText: appState.isArabic() + ? (authVM!.countriesList!.firstWhere((e) => e.id == (appState.getNHICUserData.nationalityCode ?? ""), orElse: () => NationalityCountries()).nameN ?? "") + : (authVM!.countriesList!.firstWhere((e) => e.id == (appState.getNHICUserData.nationalityCode ?? ""), orElse: () => NationalityCountries()).name ?? ""), + isEnable: true, + prefix: null, + isAllowRadius: false, + isBorderAllowed: false, + isAllowLeadingIcon: true, + isReadOnly: true, + labelColor: AppColors.textColor, + leadingIcon: AppAssets.globe, + onChange: (value) {}) + .paddingSymmetrical(0.h, 16.h), + Divider( + height: 1, + color: AppColors.greyColor, + ), + TextInputWidget( + labelText: LocaleKeys.mobileNumber.tr(), + hintText: (appState.getUserRegistrationPayload.patientMobileNumber.toString() ?? ""), + controller: null, + isEnable: false, + prefix: null, + isAllowRadius: false, + isBorderAllowed: false, + isAllowLeadingIcon: true, + labelColor: AppColors.textColor, + isReadOnly: true, + leadingIcon: AppAssets.call) + .paddingSymmetrical(0.h, 16.h), + Divider( + height: 1, + color: AppColors.greyColor, + ), + TextInputWidget( + labelText: LocaleKeys.dob.tr(), + hintText: authVM!.isUserFromUAE() ? appState.getUserRegistrationPayload.dob! : appState.getNHICUserData.dateOfBirth ?? "", + controller: authVM!.isUserFromUAE() ? authVM!.dobController : null, + isEnable: false, + prefix: null, + isBorderAllowed: false, + isAllowLeadingIcon: true, + isReadOnly: true, + labelColor: AppColors.textColor, + leadingIcon: AppAssets.birthday_cake, + selectionType: null, + ).paddingSymmetrical(0.h, 16.h), + ], + ), + ), + SizedBox(height: 50.h), + Row( children: [ - TextInputWidget( - labelText: authVM!.isUserFromUAE() ? LocaleKeys.fullName.tr() : LocaleKeys.name.tr(), - hintText: authVM!.isUserFromUAE() ? LocaleKeys.enterNameHere.tr() : (name), - controller: authVM!.isUserFromUAE() ? authVM!.nameController : null, - isEnable: true, - prefix: null, - isAllowRadius: false, - isBorderAllowed: false, - keyboardType: TextInputType.text, - isAllowLeadingIcon: true, - isReadOnly: authVM!.isUserFromUAE() ? false : true, - leadingIcon: AppAssets.user_circle, - labelColor: AppColors.textColor, - ).paddingSymmetrical(0.h, 16.h), - Divider(height: 1, color: AppColors.greyColor), - TextInputWidget( - labelText: LocaleKeys.nationalIdNumber.tr(), - hintText: authVM!.isUserFromUAE() ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : (appState.getNHICUserData.idNumber ?? ""), - controller: null, - isEnable: true, - prefix: null, - isAllowRadius: false, - isBorderAllowed: false, - isAllowLeadingIcon: true, - isReadOnly: true, - labelColor: AppColors.textColor, - leadingIcon: AppAssets.student_card) - .paddingSymmetrical(0.h, 16.h), - Divider(height: 1, color: AppColors.greyColor), - authVM!.isUserFromUAE() - ? Selector( - selector: (_, authViewModel) => authViewModel.genderType, - shouldRebuild: (previous, next) => previous != next, - builder: (context, genderType, child) { - final authVM = context.read(); - return DropdownWidget( - labelText: LocaleKeys.gender.tr(), - hintText: LocaleKeys.malE.tr(), - isEnable: true, - dropdownItems: GenderTypeEnum.values.map((e) => appState.isArabic() ? e.typeAr : e.type).toList(), - selectedValue: genderType != null ? (appState.isArabic() ? genderType.typeAr : genderType.type) : "", - onChange: authVM.onGenderChange, - isBorderAllowed: false, - hasSelectionCustomIcon: true, - isAllowRadius: false, - labelColor: AppColors.textColor, - padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), - selectionCustomIcon: AppAssets.arrow_down, - leadingIcon: AppAssets.user_full, - ).withVerticalPadding(8); - }) - : TextInputWidget( - labelText: LocaleKeys.gender.tr(), - hintText: (appState.getNHICUserData.gender ?? ""), - controller: null, - isEnable: true, - prefix: null, - isAllowRadius: false, - isBorderAllowed: false, - isAllowLeadingIcon: true, - isReadOnly: authVM!.isUserFromUAE() ? false : true, - leadingIcon: AppAssets.user_full, - labelColor: AppColors.textColor, - onChange: (value) {}) - .paddingSymmetrical(0.h, 16.h), - Divider(height: 1, color: AppColors.greyColor), - authVM!.isUserFromUAE() - ? Selector( - selector: (_, authViewModel) => authViewModel.maritalStatus, - shouldRebuild: (previous, next) => previous != next, - builder: (context, maritalStatus, child) { - final authVM = context.read(); // For onChange - return DropdownWidget( - labelText: LocaleKeys.maritalStatus.tr(), - hintText: LocaleKeys.married.tr(), - isEnable: true, - dropdownItems: MaritalStatusTypeEnum.values.map((e) => appState.isArabic() ? e.typeAr : e.type).toList(), - selectedValue: maritalStatus != null ? (appState.isArabic() ? maritalStatus.typeAr : maritalStatus.type) : "", - onChange: authVM.onMaritalStatusChange, - isBorderAllowed: false, - hasSelectionCustomIcon: true, - isAllowRadius: false, - labelColor: AppColors.textColor, - padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), - selectionCustomIcon: AppAssets.arrow_down, - leadingIcon: AppAssets.smart_phone, - ).withVerticalPadding(8); - }, - ) - : TextInputWidget( - labelText: LocaleKeys.maritalStatus.tr(), - hintText: appState.isArabic() - ? (MaritalStatusTypeExtension.fromValue(appState.getNHICUserData.maritalStatusCode)!.typeAr) - : (MaritalStatusTypeExtension.fromValue(appState.getNHICUserData.maritalStatusCode)!.type), - isEnable: true, - prefix: null, - isAllowRadius: false, - isBorderAllowed: false, - isAllowLeadingIcon: true, - isReadOnly: true, - labelColor: AppColors.textColor, - leadingIcon: AppAssets.smart_phone, - onChange: (value) {}) - .paddingSymmetrical(0.h, 16.h), - Divider(height: 1, color: AppColors.greyColor), - authVM!.isUserFromUAE() - ? Selector? countriesList, NationalityCountries? selectedCountry, bool isArabic})>( - selector: (context, authViewModel) { - final appState = getIt.get(); - return ( - countriesList: authViewModel.countriesList, - selectedCountry: authViewModel.pickedCountryByUAEUser, - isArabic: appState.isArabic(), - ); - }, - shouldRebuild: (previous, next) => previous.countriesList != next.countriesList || previous.selectedCountry != next.selectedCountry || previous.isArabic != next.isArabic, - builder: (context, data, child) { - final authVM = context.read(); - return DropdownWidget( - labelText: LocaleKeys.country.tr(), - hintText: LocaleKeys.uae.tr(), - isEnable: true, - dropdownItems: (data.countriesList ?? []).map((e) => data.isArabic ? e.nameN ?? "" : e.name ?? "").toList(), - selectedValue: data.selectedCountry != null - ? data.isArabic - ? data.selectedCountry!.nameN ?? "" - : data.selectedCountry!.name ?? "" - : "", - onChange: authVM.onUAEUserCountrySelection, - isBorderAllowed: false, - hasSelectionCustomIcon: true, - labelColor: AppColors.textColor, - isAllowRadius: false, - padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), - selectionCustomIcon: AppAssets.arrow_down, - leadingIcon: AppAssets.globe, - ).withVerticalPadding(8); - }, - ) - : TextInputWidget( - labelText: LocaleKeys.nationality.tr(), - hintText: appState.isArabic() - ? (authVM!.countriesList!.firstWhere((e) => e.id == (appState.getNHICUserData.nationalityCode ?? ""), orElse: () => NationalityCountries()).nameN ?? "") - : (authVM!.countriesList!.firstWhere((e) => e.id == (appState.getNHICUserData.nationalityCode ?? ""), orElse: () => NationalityCountries()).name ?? ""), - isEnable: true, - prefix: null, - isAllowRadius: false, - isBorderAllowed: false, - isAllowLeadingIcon: true, - isReadOnly: true, - labelColor: AppColors.textColor, - leadingIcon: AppAssets.globe, - onChange: (value) {}) - .paddingSymmetrical(0.h, 16.h), - Divider( - height: 1, - color: AppColors.greyColor, + Expanded( + child: CustomButton( + text: LocaleKeys.cancel.tr(), + icon: AppAssets.cancel, + onPressed: () { + Navigator.of(context).pop(); + // authVM!.clearDefaultInputValues(); + }, + backgroundColor: AppColors.secondaryLightRedColor, + borderColor: AppColors.secondaryLightRedColor, + textColor: AppColors.primaryRedColor, + iconColor: AppColors.primaryRedColor, + ), ), - TextInputWidget( - labelText: LocaleKeys.mobileNumber.tr(), - hintText: (appState.getUserRegistrationPayload.patientMobileNumber.toString() ?? ""), - controller: null, - isEnable: false, - prefix: null, - isAllowRadius: false, - isBorderAllowed: false, - isAllowLeadingIcon: true, - labelColor: AppColors.textColor, - isReadOnly: true, - leadingIcon: AppAssets.call) - .paddingSymmetrical(0.h, 16.h), - Divider( - height: 1, - color: AppColors.greyColor, + SizedBox( + width: 16, ), - TextInputWidget( - labelText: LocaleKeys.dob.tr(), - hintText: authVM!.isUserFromUAE() ? appState.getUserRegistrationPayload.dob! : appState.getNHICUserData.dateOfBirth ?? "", - controller: authVM!.isUserFromUAE() ? authVM!.dobController : null, - isEnable: false, - prefix: null, - isBorderAllowed: false, - isAllowLeadingIcon: true, - isReadOnly: true, - labelColor: AppColors.textColor, - leadingIcon: AppAssets.birthday_cake, - selectionType: null, - ).paddingSymmetrical(0.h, 16.h), + Expanded( + child: CustomButton( + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + text: LocaleKeys.confirm.tr(), + icon: AppAssets.confirm, + iconColor: AppColors.whiteColor, + onPressed: () { + if (appState.getUserRegistrationPayload.zipCode != CountryEnum.saudiArabia.countryCode) { + if (ValidationUtils.validateUaeRegistration( + name: authVM!.nameController.text, + gender: authVM!.genderType, + country: authVM!.pickedCountryByUAEUser, + maritalStatus: authVM!.maritalStatus, + onOkPress: () { + Navigator.of(context).pop(); + })) { + showModel(context: context); + } + } else { + showModel(context: context); + } + }, + ), + ) ], ), - ), - ), - SizedBox(height: 50.h), - Row( - children: [ - Expanded( - child: CustomButton( - text: LocaleKeys.cancel.tr(), - icon: AppAssets.cancel, - onPressed: () { - Navigator.of(context).pop(); - // authVM!.clearDefaultInputValues(); - }, - backgroundColor: AppColors.secondaryLightRedColor, - borderColor: AppColors.secondaryLightRedColor, - textColor: AppColors.primaryRedColor, - iconColor: AppColors.primaryRedColor, - ), - ), - SizedBox( - width: 16, - ), - Expanded( - child: CustomButton( - backgroundColor: AppColors.primaryRedColor, - borderColor: AppColors.primaryRedColor, - textColor: AppColors.whiteColor, - text: LocaleKeys.confirm.tr(), - icon: AppAssets.confirm, - iconColor: AppColors.whiteColor, - onPressed: () { - if (appState.getUserRegistrationPayload.zipCode != CountryEnum.saudiArabia.countryCode) { - if (ValidationUtils.validateUaeRegistration( - name: authVM!.nameController.text, - gender: authVM!.genderType, - country: authVM!.pickedCountryByUAEUser, - maritalStatus: authVM!.maritalStatus, - onOkPress: () { - Navigator.of(context).pop(); - })) { - showModel(context: context); - } - } else { - showModel(context: context); - } - }, - ), - ) ], ), - ], + ), ), ), ); diff --git a/lib/presentation/authentication/saved_login_screen.dart b/lib/presentation/authentication/saved_login_screen.dart index 073ff8b..65b1828 100644 --- a/lib/presentation/authentication/saved_login_screen.dart +++ b/lib/presentation/authentication/saved_login_screen.dart @@ -72,7 +72,9 @@ class _SavedLogin extends State { // Welcome back text LocaleKeys.welcomeBack.tr().toText16(color: AppColors.inputLabelTextColor), SizedBox(height: 16.h), - appState.getSelectDeviceByImeiRespModelElement!.name!.toCamelCase.toText26(isBold: true, height: 26 / 36, color: AppColors.textColor), + appState.getSelectDeviceByImeiRespModelElement != null + ? appState.getSelectDeviceByImeiRespModelElement!.name!.toCamelCase.toText26(isBold: true, height: 26 / 36, color: AppColors.textColor) + : SizedBox(), SizedBox(height: 24.h), Container( padding: EdgeInsets.all(16.h), @@ -89,15 +91,22 @@ class _SavedLogin extends State { // Last login info ("${LocaleKeys.lastLoginBy.tr()} ${loginType.displayName}").toText14(isBold: true, color: AppColors.greyTextColor, letterSpacing: -1), - (appState.getSelectDeviceByImeiRespModelElement!.createdOn != null - ? DateUtil.getFormattedDate(DateUtil.convertStringToDate(appState.getSelectDeviceByImeiRespModelElement!.createdOn!), "d MMMM, y 'at' HH:mm") - : '--') - .toText16(isBold: true, color: AppColors.textColor), + appState.getSelectDeviceByImeiRespModelElement != null + ? (appState.getSelectDeviceByImeiRespModelElement!.createdOn != null + ? DateUtil.getFormattedDate(DateUtil.convertStringToDate(appState.getSelectDeviceByImeiRespModelElement!.createdOn!), "d MMMM, y 'at' HH:mm") + : '--') + .toText16(isBold: true, color: AppColors.textColor) + : SizedBox(), - Container( - margin: EdgeInsets.all(16.h), - child: Utils.buildSvgWithAssets( - icon: getTypeIcons(appState.getSelectDeviceByImeiRespModelElement!.logInType!), height: 54, width: 54, iconColor: loginType.toInt == 4 ? null : AppColors.primaryRedColor)), + appState.getSelectDeviceByImeiRespModelElement != null + ? Container( + margin: EdgeInsets.all(16.h), + child: Utils.buildSvgWithAssets( + icon: getTypeIcons(appState.getSelectDeviceByImeiRespModelElement!.logInType!), + height: 54, + width: 54, + iconColor: loginType.toInt == 4 ? null : AppColors.primaryRedColor)) + : SizedBox(), // Face ID login button SizedBox( height: 45, @@ -110,8 +119,8 @@ class _SavedLogin extends State { authVm.checkUserAuthentication(otpTypeEnum: loginType == LoginTypeEnum.sms ? OTPTypeEnum.sms : OTPTypeEnum.whatsapp); } }, - backgroundColor: Color(0xffED1C2B), - borderColor: Color(0xffFEE9EA), + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, textColor: Colors.white, fontSize: 12, fontWeight: FontWeight.w500, diff --git a/lib/widgets/bottomsheet/generic_bottom_sheet.dart b/lib/widgets/bottomsheet/generic_bottom_sheet.dart index 05275fa..cf7697d 100644 --- a/lib/widgets/bottomsheet/generic_bottom_sheet.dart +++ b/lib/widgets/bottomsheet/generic_bottom_sheet.dart @@ -85,7 +85,8 @@ class _GenericBottomSheetState extends State { textDirection: Directionality.of(context), child: Container( padding: EdgeInsets.all(24.h), - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.bgScaffoldColor, borderRadius: 16), + decoration: RoundedRectangleBorder() + .toSmoothCornerDecoration(color: AppColors.bgScaffoldColor, borderRadius: 16, customBorder: BorderRadius.only(topLeft: Radius.circular(16), topRight: Radius.circular(16))), child: Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, @@ -151,7 +152,7 @@ class _GenericBottomSheetState extends State { prefix: widget.isForEmail ? null : widget.countryCode, isBorderAllowed: false, isAllowLeadingIcon: true, - fontSize: 12.h, + fontSize: 13.h, isCountryDropDown: widget.isEnableCountryDropdown, leadingIcon: widget.isForEmail ? AppAssets.email : AppAssets.smart_phone, ) diff --git a/lib/widgets/buttons/custom_button.dart b/lib/widgets/buttons/custom_button.dart index 30e4e5d..7df7dfb 100644 --- a/lib/widgets/buttons/custom_button.dart +++ b/lib/widgets/buttons/custom_button.dart @@ -53,7 +53,7 @@ class CustomButton extends StatelessWidget { color: isDisabled ? Colors.transparent : backgroundColor, borderRadius: borderRadius, side: BorderSide( - width: borderWidth, + width: borderWidth.h, color: isDisabled ? borderColor.withOpacity(0.5) : borderColor, )), child: Row( diff --git a/lib/widgets/dropdown/country_dropdown_widget.dart b/lib/widgets/dropdown/country_dropdown_widget.dart index 772bf39..f002f24 100644 --- a/lib/widgets/dropdown/country_dropdown_widget.dart +++ b/lib/widgets/dropdown/country_dropdown_widget.dart @@ -98,30 +98,33 @@ class _CustomCountryDropdownState extends State { children: [ Text( LocaleKeys.phoneNumber.tr(), - style: TextStyle(fontSize: 12.fSize, height: 21 / 12, fontWeight: FontWeight.w500, letterSpacing: -1), + style: TextStyle(fontSize: 12.fSize, height: 1.2.h, fontWeight: FontWeight.w500, letterSpacing: -1), ), ], ), Row( crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, children: [ Text( selectedCountry!.countryCode, - style: TextStyle(fontSize: 12.fSize, height: 23 / 18, fontWeight: FontWeight.w600, letterSpacing: -1), + style: TextStyle(fontSize: 12.fSize, fontWeight: FontWeight.w600, letterSpacing: -0.4, height: 1.5), ), SizedBox(width: 4.h), if (widget.isEnableTextField) SizedBox( - height: 20, - width: 200, - // color: Colors.red, - child: TextField( + height: 20.h, + width: 200.h, + child: Align( + alignment: Alignment.centerLeft, + child: TextField( focusNode: textFocusNode, - style: TextStyle(fontSize: 12.fSize, height: 23 / 18, fontWeight: FontWeight.w600, letterSpacing: -1), - decoration: InputDecoration(hintText: "", isDense: false, border: InputBorder.none), + style: TextStyle(fontSize: 12.fSize, fontWeight: FontWeight.w600, letterSpacing: -0.4, height: 1.5), + decoration: InputDecoration(hintText: "", isDense: true, border: InputBorder.none, contentPadding: EdgeInsets.zero), keyboardType: TextInputType.phone, - onChanged: widget.onPhoneNumberChanged), + onChanged: widget.onPhoneNumberChanged, + ), + ), ), ], ) @@ -134,7 +137,7 @@ class _CustomCountryDropdownState extends State { ? appState.getLanguageCode() == "ar" ? selectedCountry!.nameArabic : selectedCountry!.displayName - : "Select Country", + : LocaleKeys.selectCountry.tr(), style: TextStyle(fontSize: 14.fSize, height: 21 / 14, fontWeight: FontWeight.w500, letterSpacing: -0.2), ), ], diff --git a/lib/widgets/dropdown/dropdown_widget.dart b/lib/widgets/dropdown/dropdown_widget.dart index f093f0b..d4c1c5f 100644 --- a/lib/widgets/dropdown/dropdown_widget.dart +++ b/lib/widgets/dropdown/dropdown_widget.dart @@ -122,7 +122,9 @@ class DropdownWidget extends StatelessWidget { .toList(), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), + ), + color: AppColors.scaffoldBgColor ); if (selected != null && onChange != null) { diff --git a/lib/widgets/input_widget.dart b/lib/widgets/input_widget.dart index a527054..4a2322c 100644 --- a/lib/widgets/input_widget.dart +++ b/lib/widgets/input_widget.dart @@ -42,6 +42,7 @@ class TextInputWidget extends StatelessWidget { final bool? isWalletAmountInput; final Widget? suffix; final Color? labelColor; + final Function(String)? onSubmitted; // final List countryList; // final Function(Country)? onCountryChange; @@ -72,7 +73,8 @@ class TextInputWidget extends StatelessWidget { this.fontSize = 14, this.isWalletAmountInput = false, this.suffix, - this.labelColor + this.labelColor, + this.onSubmitted // this.countryList = const [], // this.onCountryChange, }); @@ -239,7 +241,8 @@ class TextInputWidget extends StatelessWidget { onTapOutside: (event) { FocusManager.instance.primaryFocus?.unfocus(); }, - style: TextStyle(fontSize: fontSize!.fSize, height: isWalletAmountInput! ? 1 / 4 : 21 / 14, fontWeight: FontWeight.w500, color: AppColors.textColor, letterSpacing: -0.2), + onSubmitted: onSubmitted, + style: TextStyle(fontSize: fontSize!.fSize, height: isWalletAmountInput! ? 1 / 4 : 0, fontWeight: FontWeight.w500, color: AppColors.textColor, letterSpacing: -1), decoration: InputDecoration( isDense: true, hintText: hintText, -- 2.30.2