otp screen & register Uae & resend Activation Code.

pull/50/head
aamir-csol 1 month ago
parent 70023f680a
commit 17c47d093c

@ -847,5 +847,8 @@
"pleaseSelectAMaritalStatus": "يرجى اختيار الحالة الاجتماعية",
"pleaseSelectACountry": "يرجى اختيار الدولة",
"pleaseEnterEmail": "يرجى إدخال البريد الإلكتروني",
"pleaseEnterAValidEmailFormat": "يرجى إدخال تنسيق بريد إلكتروني صالح"
"pleaseEnterAValidEmailFormat": "يرجى إدخال تنسيق بريد إلكتروني صالح",
"selectCountry": "اختر الدولة",
"forLoginVerification": "للتحقق من تسجيل الدخول"
}

@ -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"
}

@ -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,
),

@ -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,
@ -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();
@ -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();
@ -885,9 +878,13 @@ 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: () {
_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: () {
},
onWhatsappPress: () {
checkUserAuthentication(otpTypeEnum: OTPTypeEnum.whatsapp);
});
},

@ -533,6 +533,7 @@ class _OTPVerificationScreenState extends State<OTPVerificationScreen> {
@override
Widget build(BuildContext context) {
AuthenticationViewModel authVM = context.read<AuthenticationViewModel>();
AppState appState = getIt<AppState>();
return Scaffold(
backgroundColor: AppColors.scaffoldBgColor,
appBar: CustomAppBar(
@ -552,14 +553,16 @@ class _OTPVerificationScreenState extends State<OTPVerificationScreen> {
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),
],
),

@ -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';
}

@ -43,7 +43,9 @@ class _RegisterNew extends State<RegisterNewStep2> {
@override
Widget build(BuildContext context) {
AppState appState = getIt.get<AppState>();
var name = appState.getLanguageCode() == "en"
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(
@ -57,7 +59,15 @@ class _RegisterNew extends State<RegisterNewStep2> {
onLanguageChanged: (lang) {},
hideLogoAndLang: true,
),
body: SingleChildScrollView(
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(
@ -65,9 +75,7 @@ class _RegisterNew extends State<RegisterNewStep2> {
children: <Widget>[
LocaleKeys.personalDetailsVerification.tr().toText26(color: AppColors.textColor, weight: FontWeight.w600, letterSpacing: -2),
SizedBox(height: 24.h),
Directionality(
textDirection: Directionality.of(context),
child: Container(
Container(
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(24)),
padding: EdgeInsets.only(left: 16.h, right: 16.h),
child: Column(
@ -81,6 +89,10 @@ class _RegisterNew extends State<RegisterNewStep2> {
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,
@ -263,7 +275,6 @@ class _RegisterNew extends State<RegisterNewStep2> {
],
),
),
),
SizedBox(height: 50.h),
Row(
children: [
@ -315,6 +326,8 @@ class _RegisterNew extends State<RegisterNewStep2> {
],
),
),
),
),
);
}

@ -72,7 +72,9 @@ class _SavedLogin extends State<SavedLogin> {
// 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<SavedLogin> {
// Last login info
("${LocaleKeys.lastLoginBy.tr()} ${loginType.displayName}").toText14(isBold: true, color: AppColors.greyTextColor, letterSpacing: -1),
(appState.getSelectDeviceByImeiRespModelElement!.createdOn != null
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),
.toText16(isBold: true, color: AppColors.textColor)
: SizedBox(),
Container(
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)),
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<SavedLogin> {
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,

@ -85,7 +85,8 @@ class _GenericBottomSheetState extends State<GenericBottomSheet> {
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<GenericBottomSheet> {
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,
)

@ -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(

@ -98,30 +98,33 @@ class _CustomCountryDropdownState extends State<CustomCountryDropdown> {
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,
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<CustomCountryDropdown> {
? 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),
),
],

@ -122,7 +122,9 @@ class DropdownWidget extends StatelessWidget {
.toList(),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
color: AppColors.scaffoldBgColor
);
if (selected != null && onChange != null) {

@ -42,6 +42,7 @@ class TextInputWidget extends StatelessWidget {
final bool? isWalletAmountInput;
final Widget? suffix;
final Color? labelColor;
final Function(String)? onSubmitted;
// final List<Country> 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,

Loading…
Cancel
Save