merge-update-with-lab-changes
Aamir Muhammad 6 months ago committed by haroon amjad
parent ff12e832ab
commit e64d1088a6

@ -21,8 +21,8 @@ var PACKAGES_ORDERS = '/api/orders';
var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_ORDER_HISTORY = '/api/orders/items';
var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara';
// var BASE_URL = 'http://10.50.100.198:2018/'; // var BASE_URL = 'http://10.50.100.198:2018/';
// var BASE_URL = 'https://uat.hmgwebservices.com/'; var BASE_URL = 'https://uat.hmgwebservices.com/';
var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/';
// var BASE_URL = 'http://10.201.204.103/'; // var BASE_URL = 'http://10.201.204.103/';
// var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/';
// var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/';

@ -2329,7 +2329,7 @@ const Map localizedValues = {
"clickPrivacyPolicy": {"en": "Please click here to view the privacy policy", "ar": "الرجاء الضغط هنا لعرض سياسة الخصوصية"}, "clickPrivacyPolicy": {"en": "Please click here to view the privacy policy", "ar": "الرجاء الضغط هنا لعرض سياسة الخصوصية"},
"welcomeToDrSulaiman": {"en": "Welcome to Dr. Sulaiman Al Habib Medical Group", "ar": "مرحباً بكم في مجموعة الدكتور سليمان الحبيب الطبية"}, "welcomeToDrSulaiman": {"en": "Welcome to Dr. Sulaiman Al Habib Medical Group", "ar": "مرحباً بكم في مجموعة الدكتور سليمان الحبيب الطبية"},
"dontHaveAccount": {"en": "Dont have an account?", "ar": "ليس لديك حساب؟"}, "dontHaveAccount": {"en": "Dont have an account?", "ar": "ليس لديك حساب؟"},
"loginByOTP": {"en": "Login By SMS", "ar":" تسجيل الدخول بواسطة الرسائل القصيرة"}, "loginByOTP": {"en": "Login By OTP", "ar":"تسجيل الدخول بواسطة OTP"},
"loginBy": {"en": "Login By", "ar":"تسجيل الدخول بواسطة"}, "loginBy": {"en": "Login By", "ar":"تسجيل الدخول بواسطة"},
"prepareToElevate": {"en": "Prepared to elevate your health and well-being?", "ar": "هل أنت مستعد لتحسين صحتك ورفاهتك؟"}, "prepareToElevate": {"en": "Prepared to elevate your health and well-being?", "ar": "هل أنت مستعد لتحسين صحتك ورفاهتك؟"},
"alreadyHaveAccount": {"en": "Already have an account?", "ar": "هل لديك حساب بالفعل؟"}, "alreadyHaveAccount": {"en": "Already have an account?", "ar": "هل لديك حساب بالفعل؟"},
@ -2363,6 +2363,8 @@ const Map localizedValues = {
"otpVerification": {"en": "OTP Verification", "ar":"التحقق من OTP"}, "otpVerification": {"en": "OTP Verification", "ar":"التحقق من OTP"},
"submiT": {"en": "Submit", "ar":"إرسال"}, "submiT": {"en": "Submit", "ar":"إرسال"},
"notice": {"en": "Notice", "ar":"إشعار"}, "notice": {"en": "Notice", "ar":"إشعار"},
"receiveOtpToast": {"en": "Where would you like to receive OTP?", "ar":"أين تود تلقي رمز التحقق OTP؟"},
"pleaseChooseOption": {"en": "Please select from the below options to receive OTP.", "ar":"الرجاء اختيار من الخيارات أدناه لتلقي رمز التحقق OTP."},

@ -93,7 +93,7 @@ class _ExceptionBottomSheetState extends State<ExceptionBottomSheet> {
), ),
Expanded( Expanded(
child: CustomButton( child: CustomButton(
text: TranslationBase.of(context).ok, text: widget.showCancel ? TranslationBase.of(context).confirm : TranslationBase.of(context).ok,
onPressed: widget.onOkPressed, onPressed: widget.onOkPressed,
backgroundColor: CustomColors.bgRedColor, backgroundColor: CustomColors.bgRedColor,
borderColor: CustomColors.bgRedBorderColor, borderColor: CustomColors.bgRedBorderColor,

@ -19,11 +19,9 @@ class GenericBottomSheet extends StatefulWidget {
final bool isEnableCountryDropdown; final bool isEnableCountryDropdown;
final bool isFromSavedLogin; final bool isFromSavedLogin;
Function(String?)? onChange; Function(String?)? onChange;
FocusNode? focusNode;
GenericBottomSheet( GenericBottomSheet(
{Key? key, {this.countryCode = "",
this.countryCode = "",
this.initialPhoneNumber = "", this.initialPhoneNumber = "",
required this.buttons, required this.buttons,
this.textController, this.textController,
@ -31,9 +29,7 @@ class GenericBottomSheet extends StatefulWidget {
this.onCountryChange, this.onCountryChange,
this.isEnableCountryDropdown = false, this.isEnableCountryDropdown = false,
this.isFromSavedLogin = false, this.isFromSavedLogin = false,
this.focusNode, this.onChange});
this.onChange})
: super(key: key);
@override @override
_GenericBottomSheetState createState() => _GenericBottomSheetState(); _GenericBottomSheetState createState() => _GenericBottomSheetState();
@ -64,50 +60,102 @@ class _GenericBottomSheetState extends State<GenericBottomSheet> {
// Only unfocus if the tap is not on the text field area // Only unfocus if the tap is not on the text field area
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
}, },
child: Builder(builder: (context) { child: Directionality(
// final isRtl = Directionality.of(context) == TextDirection.rtl; textDirection: Directionality.of(context),
return Directionality( child: Container(
textDirection: Directionality.of(context), padding: const EdgeInsets.all(24),
child: Container( decoration: BoxDecoration(
padding: const EdgeInsets.all(24), color: Color(0xFFF8F8FA),
decoration: BoxDecoration( borderRadius: const BorderRadius.vertical(top: Radius.circular(16)),
color: Color(0xFFF8F8FA), ),
borderRadius: const BorderRadius.vertical(top: Radius.circular(16)), child: Column(
), mainAxisSize: MainAxisSize.min,
child: Column( mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.start, children: [
crossAxisAlignment: CrossAxisAlignment.stretch, // Title
children: [ Row(
// Title mainAxisAlignment: MainAxisAlignment.spaceBetween,
Row( crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
children: [ Flexible(
AppText(widget.isForEmail ? TranslationBase.of(context).enterEmail : TranslationBase.of(context).enterPhoneNumber, child: AppText(
fontSize: 28, letterSpacing: -2, color: Color(0xFF2E3039), fontWeight: FontWeight.w600), widget.isFromSavedLogin
InkWell( ? TranslationBase.of(context).receiveOtpToast
onTap: () { : widget.isForEmail
Navigator.of(context).pop(); ? TranslationBase.of(context).enterEmail
}, : TranslationBase.of(context).enterPhoneNumber,
child: SvgPicture.asset("assets/images/svg/cross-circle.svg", width: 24, height: 24)), fontSize: 28,
], letterSpacing: -2,
), color: Color(0xFF2E3039),
const SizedBox(height: 10), fontWeight: FontWeight.w600),
// Subtitle ),
AppText(widget.isForEmail ? TranslationBase.of(context).enterEmailDesc : TranslationBase.of(context).enterPhoneDesc, InkWell(
fontSize: 16, color: Color(0xFF2E3039), fontWeight: FontWeight.w500), onTap: () {
const SizedBox(height: 10), Navigator.of(context).pop();
},
child: Padding(
padding: const EdgeInsets.only(top: 10),
child: SvgPicture.asset("assets/images/svg/cross-circle.svg", width: 24, height: 24),
)),
],
),
const SizedBox(height: 10),
// Subtitle
AppText(
widget.isFromSavedLogin
? TranslationBase.of(context).pleaseChooseOption
: widget.isForEmail
? TranslationBase.of(context).enterEmailDesc
: TranslationBase.of(context).enterPhoneDesc,
fontSize: 16,
color: Color(0xFF2E3039),
fontWeight: FontWeight.w500),
const SizedBox(height: 10),
if (widget.isFromSavedLogin)
...[]
else ...[
widget.textController != null widget.textController != null
? Column( ? Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
// Directionality(
// textDirection: TextDirection.ltr,
// child: newInputWidget(
// labelText: widget.isForEmail ? TranslationBase.of(context).email : TranslationBase.of(context).phoneNumber,
// hintText: widget.isForEmail ? "demo@gmail.com" : "5xxxxxxxx",
// controller: widget.textController,
// padding: const EdgeInsets.only(top: 8, bottom: 8, left: 8, right: 8),
// keyboardType: widget.isForEmail ? TextInputType.emailAddress : TextInputType.number,
// onChange: (value) {
// if (value != null) {
// widget.textController?.text = value;
// widget.onChange?.call(value);
// }
// },
// isEnable: true,
// autoFocus: true,
// keepFocus: true,
// refocusOnChange: true,
// isReadOnly: widget.isFromSavedLogin,
// prefix: widget.isForEmail ? null : widget.countryCode,
// hasSelection: false,
// isBorderAllowed: false,
// isAllowLeadingIcon: true,
// countryList: Country.values,
// isCountryDropDown: widget.isEnableCountryDropdown,
// onCountryChange: widget.onCountryChange,
// leadingIcon: widget.isForEmail ? "assets/images/svg/email.svg" : "assets/images/svg/smart-phone.svg",
// ),
// ),
Directionality( Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: newInputWidget( child: newInputWidget(
widget.isForEmail ? TranslationBase.of(context).email : TranslationBase.of(context).phoneNumber, widget.isForEmail ? TranslationBase.of(context).email : TranslationBase.of(context).phoneNumber,
widget.isForEmail ? "demo@gmail.com" : "5xxxxxxxx", widget.isForEmail ? "demo@gmail.com" : "5xxxxxxxx",
widget.textController!, widget.textController!,
focusNode: widget.focusNode!, // focusNode: widget.focusNode!,
padding: EdgeInsets.only(top: 8, bottom: 8, left: 8, right: 8), padding: EdgeInsets.only(top: 8, bottom: 8, left: 8, right: 8),
keyboardType: widget.isForEmail ? TextInputType.emailAddress : TextInputType.number, keyboardType: widget.isForEmail ? TextInputType.emailAddress : TextInputType.number,
onChange: (value) { onChange: (value) {
@ -134,13 +182,14 @@ class _GenericBottomSheetState extends State<GenericBottomSheet> {
], ],
) )
: SizedBox(), : SizedBox(),
SizedBox(height: 24),
...widget.buttons,
], ],
),
SizedBox(height: 24),
...widget.buttons,
],
), ),
); ),
}), ),
), ),
); );
} }

@ -548,31 +548,34 @@ class _RegisterNew extends State<RegisterNew> {
request.isRegister = true; request.isRegister = true;
request.dob = isHijri == 1 ? selectedDOB!.toString() : dateFormat.format(selectedDOB!); request.dob = isHijri == 1 ? selectedDOB!.toString() : dateFormat.format(selectedDOB!);
request.isHijri = isHijri ?? 0; request.isHijri = isHijri ?? 0;
this.checkPatientForRegisteration(registrationData: request, type: type); checkPatientForRegistration(registrationData: request, type: type);
// } // }
} }
checkPatientForRegisteration({required CheckPatientForRegistration registrationData, type}) { checkPatientForRegistration({required CheckPatientForRegistration registrationData, type}) {
int languageID = Provider.of<ProjectViewModel>(context, listen: false).isArabic ? 1 : 2; int languageID = Provider.of<ProjectViewModel>(context, listen: false).isArabic ? 1 : 2;
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
authService.checkPatientForRegisteration(registrationData, languageID).then((response) => {checkUserStatus(response, registrationData, type)}).catchError((err) { authService.checkPatientForRegisteration(registrationData, languageID).then((response) => {
// Keep loader active, continue to next step
checkUserStatus(response, registrationData, type)
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
ConfirmDialog dialog = ConfirmDialog(
context: context, context.showBottomSheet(
confirmMessage: err, child: ExceptionBottomSheet(
okText: TranslationBase.of(context).confirm, showCancel: true,
cancelText: TranslationBase.of(context).cancel_nocaps, message: err,
okFunction: () => { onOkPressed: () {
ConfirmDialog.closeAlertDialog(context), Navigator.of(context).pop();
Navigator.of(context).push(FadePage(page: RegisterNew())), Navigator.of(context).push(FadePage(page: RegisterNew()));
}, },
cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); ),
dialog.showAlertDialog(context); );
}); });
} }
checkUserStatus(response, CheckPatientForRegistration request, type) async { checkUserStatus(response, CheckPatientForRegistration request, type) async {
GifLoaderDialogUtils.hideDialog(context); // No loader shown here since it's already hidden in checkPatientForRegisteration
if (response is Map) { if (response is Map) {
var nRequest = request.toJson(); var nRequest = request.toJson();
nRequest['LogInTokenID'] = response['LogInTokenID']; nRequest['LogInTokenID'] = response['LogInTokenID'];
@ -609,20 +612,19 @@ class _RegisterNew extends State<RegisterNew> {
} else { } else {
// if (response['ErrorCode'] == '-986') { // if (response['ErrorCode'] == '-986') {
//AppToast.showErrorToast(message: response); //AppToast.showErrorToast(message: response);
AlertDialogBox( context.showBottomSheet(
context: context, child: ExceptionBottomSheet(
confirmMessage: response, message: response,
okText: TranslationBase.of(context).ok, onOkPressed: () {
okFunction: () {
AlertDialogBox.closeAlertDialog(context);
Navigator.of(context).pop(); Navigator.of(context).pop();
}).showAlertDialog(context); },
//} ),
);
} }
} }
chekUserData(loginToken, int type) { chekUserData(loginToken, int type) {
GifLoaderDialogUtils.showMyDialog(context); // Keep existing loader active, don't show new one
var request = CheckUserStatusRequest(); var request = CheckUserStatusRequest();
request.patientIdentificationID = nationalIDorFile.text; request.patientIdentificationID = nationalIDorFile.text;
request.dOB = isHijri == 1 ? selectedDOB!.toString() : dateFormat.format(selectedDOB!); request.dOB = isHijri == 1 ? selectedDOB!.toString() : dateFormat.format(selectedDOB!);
@ -630,19 +632,17 @@ class _RegisterNew extends State<RegisterNew> {
request.patientOutSA = selectedCountry.countryCode == '966' ? 0 : 1; request.patientOutSA = selectedCountry.countryCode == '966' ? 0 : 1;
this.authService.checkUserStatus(request).then((result) { this.authService.checkUserStatus(request).then((result) {
GifLoaderDialogUtils.hideDialog(context); // Keep loader active, continue to next step
if (result is Map) { if (result is Map) {
RegisterInfoResponse? resultSet; RegisterInfoResponse? resultSet;
CheckUserStatusResponse res = CheckUserStatusResponse.fromJson(result as Map<String, dynamic>); CheckUserStatusResponse res = CheckUserStatusResponse.fromJson(result as Map<String, dynamic>);
nHICData = res; nHICData = res;
sharedPref.setObject(NHIC_DATA, res.toJson()); sharedPref.setObject(NHIC_DATA, res.toJson());
resultSet = RegisterInfoResponse.fromJson(res.toJson()); resultSet = RegisterInfoResponse.fromJson(res.toJson());
// widget.changePageViewIndex!(1),
// Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex, fromRegistration: true))),
sendActivationCode(type, loginToken, resultSet, isSkipRegistration); sendActivationCode(type, loginToken, resultSet, isSkipRegistration);
} else { } else {
GifLoaderDialogUtils.hideDialog(context);
context.showBottomSheet( context.showBottomSheet(
child: ExceptionBottomSheet( child: ExceptionBottomSheet(
message: result != null ? result : TranslationBase.of(context).somethingWentWrong, message: result != null ? result : TranslationBase.of(context).somethingWentWrong,
@ -653,6 +653,17 @@ class _RegisterNew extends State<RegisterNew> {
), ),
); );
} }
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
context.showBottomSheet(
child: ExceptionBottomSheet(
message: err.toString(),
showCancel: false,
onOkPressed: () {
Navigator.of(context).pop();
},
),
);
}); });
} }
@ -666,13 +677,12 @@ class _RegisterNew extends State<RegisterNew> {
patientOutSA: selectedCountry.countryCode == "966" ? 0 : 1, patientOutSA: selectedCountry.countryCode == "966" ? 0 : 1,
loginTokenID: LoginTokenID, loginTokenID: LoginTokenID,
selectedOption: type, selectedOption: type,
type: type,
user: SelectDeviceIMEIRES()); user: SelectDeviceIMEIRES());
request.isRegister = true; request.isRegister = true;
request.dob = isHijri == 1 ? selectedDOB!.toString() : dateFormat.format(selectedDOB!); request.dob = isHijri == 1 ? selectedDOB!.toString() : dateFormat.format(selectedDOB!);
request.sMSSignature = await SMSOTP.getSignature(); request.sMSSignature = await SMSOTP.getSignature();
// print(request.oTPSendType); print("Otp Send Type =" + request.oTPSendType.toString());
// request.oTPSendType = type;
GifLoaderDialogUtils.showMyDialog(context);
if (selectedCountry.countryCode == "966" && !skipRegistration) { if (selectedCountry.countryCode == "966" && !skipRegistration) {
request.healthId = nHICData!.healthId; request.healthId = nHICData!.healthId;
@ -683,11 +693,13 @@ class _RegisterNew extends State<RegisterNew> {
request.patientIdentificationID = nationalIDorFile.text; request.patientIdentificationID = nationalIDorFile.text;
} }
request.isHijri = isHijri ?? 0; request.isHijri = isHijri ?? 0;
// request.oTPSendType = type;
if (skipRegistration) { if (skipRegistration) {
// Keep existing loader active, don't show new one
var req = getCommonRequest(type: type); var req = getCommonRequest(type: type);
req.logInTokenID = ""; req.logInTokenID = "";
var request = CheckPatientAuthenticationReq.fromJson(req.toJson()); var request = CheckPatientAuthenticationReq.fromJson(req.toJson());
authService.checkPatientAuthentication(request).then((value) async { authService.checkPatientAuthentication(request).then((value) async {
if (value['isSMSSent']) { if (value['isSMSSent']) {
sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']); sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']);
@ -700,6 +712,7 @@ class _RegisterNew extends State<RegisterNew> {
request.isHijri = 0; request.isHijri = 0;
await authService.sendActivationCode(request).then((result) { await authService.sendActivationCode(request).then((result) {
// Hide loader before navigation to SMS OTP
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (result != null && result['isSMSSent'] == true) { if (result != null && result['isSMSSent'] == true) {
startSMSService(request.loginType, skipRegistration); startSMSService(request.loginType, skipRegistration);
@ -718,7 +731,12 @@ class _RegisterNew extends State<RegisterNew> {
}); });
} else { } else {
if (value['IsAuthenticated']) { if (value['IsAuthenticated']) {
checkActivationCode(onWrongActivationCode: (String? message, bool? isReroute) {}); // Keep loader active and proceed to checkActivationCode
checkActivationCode(onWrongActivationCode: (String? message, bool? isReroute) {
GifLoaderDialogUtils.hideDialog(context);
});
} else {
GifLoaderDialogUtils.hideDialog(context);
} }
} }
}).catchError((err) { }).catchError((err) {
@ -736,11 +754,12 @@ class _RegisterNew extends State<RegisterNew> {
); );
}); });
} else { } else {
// Keep existing loader active, don't show new one
await this.authService.sendActivationCodeRegister(request).then((result) { await this.authService.sendActivationCodeRegister(request).then((result) {
// Hide loader before navigation to SMS OTP
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (result != null && result['isSMSSent'] == true) { if (result != null && result['isSMSSent'] == true) {
print(result); print(result);
// LoginTokenID = result["LogInTokenID"];
startSMSService(type, skipRegistration); startSMSService(type, skipRegistration);
} }
}).catchError((r) { }).catchError((r) {
@ -840,6 +859,7 @@ class _RegisterNew extends State<RegisterNew> {
result = await authService.checkActivationCodeRegister(req.toJson(), value); result = await authService.checkActivationCodeRegister(req.toJson(), value);
if (result is Map) { if (result is Map) {
final activation = CheckActivationCode.fromJson(result as Map<String, dynamic>); final activation = CheckActivationCode.fromJson(result as Map<String, dynamic>);
GifLoaderDialogUtils.hideDialog(context);
Navigator.of(context).push( Navigator.of(context).push(
FadePage(page: RegisterNewStep2(nHICData, req)), FadePage(page: RegisterNewStep2(nHICData, req)),
); );
@ -916,6 +936,7 @@ class _RegisterNew extends State<RegisterNew> {
startSMSService(type, skipRegistration) { startSMSService(type, skipRegistration) {
late SMSOTP smsOtp; late SMSOTP smsOtp;
smsOtp = SMSOTP( smsOtp = SMSOTP(
context, context,
type, type,

@ -191,9 +191,9 @@ class _SavedLogin extends State<SavedLogin> {
checkUserAuthentication(val); checkUserAuthentication(val);
} }
}, },
backgroundColor: Color(0xffFEE9EA), backgroundColor: Color(0xffED1C2B),
borderColor: Color(0xffFEE9EA), borderColor: Color(0xffFEE9EA),
textColor: Color(0xffED1C2B), textColor: Colors.white,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
borderRadius: 12, borderRadius: 12,
@ -217,37 +217,120 @@ class _SavedLogin extends State<SavedLogin> {
widget.savedLoginData.logInType != null && widget.savedLoginData.logInType != 1 widget.savedLoginData.logInType != null && widget.savedLoginData.logInType != 1
? Column( ? Column(
children: [ children: [
widget.savedLoginData.logInType !=1 ? CustomButton( widget.savedLoginData.logInType != 1
text: TranslationBase.of(context).loginByOTP, ? CustomButton(
onPressed: () { text: TranslationBase.of(context).loginByOTP,
widget.savedLoginData.logInType = 1; onPressed: () {
int? val = widget.savedLoginData.logInType!; showModalBottomSheet(
checkUserAuthentication(val); context: context,
}, isScrollControlled: true,
backgroundColor: Colors.white, isDismissible: false,
borderColor: Color(0xFF2E3039), useSafeArea: true,
textColor: Color(0xFF2E3039), backgroundColor: Colors.transparent,
borderWidth: 2, enableDrag: false,
padding: EdgeInsets.fromLTRB(0, 14, 0, 14), // Prevent dragging to avoid focus conflicts
icon: "assets/images/svg/password-validation.svg", builder: (bottomSheetContext) => StatefulBuilder(builder: (BuildContext context, StateSetter setModalState) {
) : Container(), return Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(bottomSheetContext).viewInsets.bottom),
child: SingleChildScrollView(
child: GenericBottomSheet(
countryCode: selectedCountry.countryCode,
initialPhoneNumber: phoneNumber != null ? phoneNumber : "",
textController: phoneController,
isFromSavedLogin: true,
isEnableCountryDropdown: true,
onCountryChange: (value) {
selectedCountry = value;
setModalState(() {});
},
onChange: (String? value) {
phoneNumber = value;
},
buttons: [
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: CustomButton(
text: TranslationBase.of(context).sendOTPSMS,
onPressed: () {
// int? val = Utils.onOtpBtnPressed(OTPType.sms, phoneNumber, context);
// if (val != null) checkUserAuthentication(val);
Navigator.of(context).pop();
widget.savedLoginData.logInType = 1;
int? val = widget.savedLoginData.logInType!;
checkUserAuthentication(val);
},
backgroundColor: CustomColors.bgRedColor,
borderColor: CustomColors.bgRedBorderColor,
textColor: Colors.white,
icon: "assets/images/svg/message.svg",
),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: AppText(
TranslationBase.of(context).oR,
fontSize: 16,
color: Color(0xFF2E3039),
fontWeight: FontWeight.w500,
),
),
],
),
Padding(
padding: const EdgeInsets.only(bottom: 10, top: 10),
child: CustomButton(
text: TranslationBase.of(context).sendOTPWHATSAPP,
onPressed: () {
Navigator.of(context).pop();
widget.savedLoginData.logInType = 4;
int? val = widget.savedLoginData.logInType!;
checkUserAuthentication(val);
// int? val = Utils.onOtpBtnPressed(OTPType.whatsapp, phoneNumber, context);
// if (val != null) checkUserAuthentication(val);
},
backgroundColor: Colors.white,
borderColor: Color(0xFF2E3039),
textColor: Color(0xFF2E3039),
icon: "assets/images/svg/whatsapp.svg",
),
),
],
),
),
);
}),
);
},
backgroundColor: Colors.white,
borderColor: Color(0xFF2E3039),
textColor: Color(0xFF2E3039),
borderWidth: 2,
padding: EdgeInsets.fromLTRB(0, 14, 0, 14),
icon: "assets/images/svg/password-validation.svg",
)
: Container(),
SizedBox( SizedBox(
height: 20, height: 20,
), ),
widget.savedLoginData.logInType !=4 ? CustomButton( // widget.savedLoginData.logInType !=4 ? CustomButton(
text: "${TranslationBase.of(context).loginBy} ${getType(4, context)}", // text: "${TranslationBase.of(context).loginBy} ${getType(4, context)}",
onPressed: () { // onPressed: () {
widget.savedLoginData.logInType = 4; // widget.savedLoginData.logInType = 4;
int? val = widget.savedLoginData.logInType!; // int? val = widget.savedLoginData.logInType!;
checkUserAuthentication(val); // checkUserAuthentication(val);
}, // },
backgroundColor: Colors.white, // backgroundColor: Colors.white,
borderColor: Color(0xFF2E3039), // borderColor: Color(0xFF2E3039),
textColor: Color(0xFF2E3039), // textColor: Color(0xFF2E3039),
borderWidth: 2, // borderWidth: 2,
padding: EdgeInsets.fromLTRB(0, 14, 0, 14), // padding: EdgeInsets.fromLTRB(0, 14, 0, 14),
icon: "assets/images/svg/whatsapp.svg", // icon: "assets/images/svg/whatsapp.svg",
) : Container(), // ) : Container(),
], ],
) )
: CustomButton( : CustomButton(
@ -276,33 +359,78 @@ class _SavedLogin extends State<SavedLogin> {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
TextButton( Expanded(
onPressed: () { child: Container(
Navigator.of(context).pushReplacement( height: 56,
MaterialPageRoute( child: CustomButton(
builder: (BuildContext context) => LandingPage(), text: TranslationBase.of(context).guest,
), onPressed: () {
); Navigator.of(context).pushReplacement(
}, MaterialPageRoute(builder: (BuildContext context) => LandingPage()),
child: Text( );
TranslationBase.of(context).guest, },
style: context.dynamicTextStyle(color: CustomColors.bgRedColor, fontSize: 16, fontWeight: FontWeight.w500, height: 16 / 26), backgroundColor: Color(0xffFEE9EA),
borderColor: Color(0xffFEE9EA),
textColor: Color(0xffED1C2B),
fontSize: 12,
fontWeight: FontWeight.w500,
borderRadius: 12,
padding: EdgeInsets.fromLTRB(0, 10, 0, 10),
// icon: "assets/images/svg/apple-finder.svg",
),
), ),
), ),
const SizedBox(width: 24), SizedBox(
TextButton( width: 24,
onPressed: () { ),
Navigator.of(context).pushReplacement( Expanded(
MaterialPageRoute( child: Container(
builder: (BuildContext context) => WelcomeLogin(), height: 56,
), child: CustomButton(
); text: TranslationBase.of(context).switchAccount,
}, onPressed: () {
child: Text( Navigator.of(context).pushReplacement(
TranslationBase.of(context).switchAccount, MaterialPageRoute(builder: (BuildContext context) => WelcomeLogin()),
style: context.dynamicTextStyle(color: CustomColors.bgRedColor, fontSize: 16, fontWeight: FontWeight.w500, height: 16 / 26), );
},
backgroundColor: Color(0xffFEE9EA),
borderColor: Color(0xffFEE9EA),
textColor: Color(0xffED1C2B),
fontSize: 12,
fontWeight: FontWeight.w500,
borderRadius: 12,
padding: EdgeInsets.fromLTRB(0, 10, 0, 10),
// icon: "assets/images/svg/apple-finder.svg",
),
), ),
), ),
// TextButton(
// onPressed: () {
// Navigator.of(context).pushReplacement(
// MaterialPageRoute(
// builder: (BuildContext context) => LandingPage(),
// ),
// );
// },
// child: Text(
// TranslationBase.of(context).guest,
// style: context.dynamicTextStyle(color: CustomColors.bgRedColor, fontSize: 16, fontWeight: FontWeight.w500, height: 16 / 26),
// ),
// ),
// const SizedBox(width: 24),
// TextButton(
// onPressed: () {
// Navigator.of(context).pushReplacement(
// MaterialPageRoute(
// builder: (BuildContext context) => WelcomeLogin(),
// ),
// );
// },
// child: Text(
// TranslationBase.of(context).switchAccount,
// style: context.dynamicTextStyle(color: CustomColors.bgRedColor, fontSize: 16, fontWeight: FontWeight.w500, height: 16 / 26),
// ),
// ),
], ],
), ),
const SizedBox(height: 20), const SizedBox(height: 20),

@ -90,19 +90,16 @@ class _WelcomeLogin extends State<WelcomeLogin> {
late int isHijri; late int isHijri;
var healthId; var healthId;
late FocusNode _focusNode;
@override @override
void initState() { void initState() {
isLoading = true; isLoading = true;
super.initState(); super.initState();
_focusNode = FocusNode();
phoneController = TextEditingController(); phoneController = TextEditingController();
} }
@override @override
void dispose() { void dispose() {
_focusNode.dispose();
super.dispose(); super.dispose();
} }
@ -210,7 +207,6 @@ class _WelcomeLogin extends State<WelcomeLogin> {
countryCode: selectedCountry.countryCode, countryCode: selectedCountry.countryCode,
initialPhoneNumber: phoneNumber != null ? phoneNumber : "", initialPhoneNumber: phoneNumber != null ? phoneNumber : "",
textController: phoneController, textController: phoneController,
focusNode: _focusNode,
isEnableCountryDropdown: true, isEnableCountryDropdown: true,
onCountryChange: (value) { onCountryChange: (value) {
selectedCountry = value; selectedCountry = value;
@ -218,15 +214,6 @@ class _WelcomeLogin extends State<WelcomeLogin> {
}, },
onChange: (String? value) { onChange: (String? value) {
phoneNumber = value; phoneNumber = value;
// WidgetsBinding.instance.addPostFrameCallback((_) {
// Future.delayed(Duration(milliseconds: 300), () {
// if (mounted && _focusNode.canRequestFocus) {
// _focusNode.requestFocus();
// }
// });
// });
FocusNode().requestFocus(_focusNode);
}, },
buttons: [ buttons: [
Padding( Padding(

@ -3510,6 +3510,8 @@ class TranslationBase {
String get otpVerfication => localizedValues["otpVerification"][locale.languageCode]; String get otpVerfication => localizedValues["otpVerification"][locale.languageCode];
String get submiT => localizedValues["submiT"][locale.languageCode]; String get submiT => localizedValues["submiT"][locale.languageCode];
String get notice => localizedValues["notice"][locale.languageCode]; String get notice => localizedValues["notice"][locale.languageCode];
String get receiveOtpToast => localizedValues["receiveOtpToast"][locale.languageCode];
String get pleaseChooseOption => localizedValues["pleaseChooseOption"][locale.languageCode];
String get readMore => localizedValues["readMore"][locale.languageCode]; String get readMore => localizedValues["readMore"][locale.languageCode];
String get showLess => localizedValues["showLess"][locale.languageCode]; String get showLess => localizedValues["showLess"][locale.languageCode];

@ -136,7 +136,7 @@ class SMSOTP {
child: OTPWidget( child: OTPWidget(
autoFocus: true, autoFocus: true,
controller: _pinPutController, controller: _pinPutController,
defaultBorderColor: Color(0xffE0E0E0), // Changed from white to light gray defaultBorderColor: Color(0xffffffff),
maxLength: 4, maxLength: 4,
onTextChanged: (text) {}, onTextChanged: (text) {},
pinBoxColor: Colors.white, pinBoxColor: Colors.white,

@ -165,26 +165,9 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
} }
} }
// Updated: Accept context to access MediaQuery // Updated: Always use full screen width for responsive design
double _width(BuildContext context) { double _width(BuildContext context) {
// For tablets, use full screen width return MediaQuery.of(context).size.width;
if (MediaQuery.of(context).size.shortestSide >= 600) {
return MediaQuery.of(context).size.width;
}
// For phones, use original fixed width
var width = 0.0;
for (var i = 0; i < widget.maxLength; i++) {
width += widget.pinBoxWidth;
if (i == 0) {
width += widget.pinBoxOuterPadding.left;
} else if (i + 1 == widget.maxLength) {
width += widget.pinBoxOuterPadding.right;
} else {
width += widget.pinBoxOuterPadding.left;
}
}
return width;
} }
@override @override
@ -298,31 +281,27 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
Widget _pinBoxRow(BuildContext context) { Widget _pinBoxRow(BuildContext context) {
_calculateStrList(); _calculateStrList();
// Determine if it's a tablet // Calculate dynamic width for all screen sizes to prevent scrolling
bool isTablet = MediaQuery.of(context).size.shortestSide >= 600; double screenWidth = MediaQuery.of(context).size.width;
double boxWidth = widget.pinBoxWidth; double totalHorizontalPadding = widget.pinBoxOuterPadding.left + widget.pinBoxOuterPadding.right;
double totalMargin = widget.maxLength * totalHorizontalPadding;
// Calculate dynamic width for tablets double availableWidth = screenWidth - totalMargin - 32; // 32 for additional safe padding
if (isTablet) { double boxWidth = (availableWidth / widget.maxLength).clamp(60.0, 200.0); // Reasonable limits
double screenWidth = MediaQuery.of(context).size.width;
double totalMargin = (widget.maxLength - 1) *
(widget.pinBoxOuterPadding.left + widget.pinBoxOuterPadding.right);
double availableWidth = screenWidth - totalMargin;
boxWidth = (availableWidth / widget.maxLength).clamp(100.0, 180.0); // Reasonable limits
}
List<Widget> pinCodes = List.generate(widget.maxLength, (int i) { List<Widget> pinCodes = List.generate(widget.maxLength, (int i) {
return _buildPinCode(i, context, boxWidth); // Pass dynamic width return Expanded(
child: Container(
margin: widget.pinBoxOuterPadding,
child: _buildPinCode(i, context, boxWidth),
),
);
}); });
return SingleChildScrollView( return Row(
scrollDirection: Axis.horizontal, children: pinCodes,
child: Row( mainAxisSize: MainAxisSize.max,
children: pinCodes, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
),
); );
} }
@ -353,14 +332,12 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
return Container( return Container(
key: ValueKey<String>("container$i"), key: ValueKey<String>("container$i"),
alignment: Alignment.center, alignment: Alignment.center,
margin: widget.pinBoxOuterPadding,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
decoration: BoxDecoration( decoration: BoxDecoration(
color: bgColor, color: bgColor,
border: Border.all(color: borderColor, width: 1), border: Border.all(color: borderColor, width: 1),
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
), ),
width: boxWidth, // Use dynamic width
height: widget.pinBoxHeight, height: widget.pinBoxHeight,
child: _animatedTextBox( child: _animatedTextBox(
strList[i], strList[i],

@ -40,7 +40,7 @@ dependencies:
url_launcher: ^6.3.1 url_launcher: ^6.3.1
url_launcher_ios: ^6.3.2 url_launcher_ios: ^6.3.2
shared_preferences: ^2.5.3 shared_preferences: ^2.5.3
# fluttertoast: ^8.0.8 # fluttertoast: ^8.0.8
fluttertoast: ^8.2.12 fluttertoast: ^8.2.12
flutter_progress_hud: ^2.0.2 flutter_progress_hud: ^2.0.2
@ -273,4 +273,4 @@ flutter:
- asset: assets/fonts/ge_ss_two/GE_SS_Two_Medium.otf - asset: assets/fonts/ge_ss_two/GE_SS_Two_Medium.otf
weight: 500 weight: 500
- asset: assets/fonts/ge_ss_two/GE_SS_Two_Light.otf - asset: assets/fonts/ge_ss_two/GE_SS_Two_Light.otf
weight: 400 weight: 400

Loading…
Cancel
Save