merge-update-with-lab-changes
Aamir Muhammad 3 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_TAMARA_OPT = '/api/orders/paymentoptions/tamara';
// var BASE_URL = 'http://10.50.100.198:2018/';
// var BASE_URL = 'https://uat.hmgwebservices.com/';
var BASE_URL = 'https://hmgwebservices.com/';
var BASE_URL = 'https://uat.hmgwebservices.com/';
// var BASE_URL = 'https://hmgwebservices.com/';
// var BASE_URL = 'http://10.201.204.103/';
// var BASE_URL = 'https://orash.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": "الرجاء الضغط هنا لعرض سياسة الخصوصية"},
"welcomeToDrSulaiman": {"en": "Welcome to Dr. Sulaiman Al Habib Medical Group", "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":"تسجيل الدخول بواسطة"},
"prepareToElevate": {"en": "Prepared to elevate your health and well-being?", "ar": "هل أنت مستعد لتحسين صحتك ورفاهتك؟"},
"alreadyHaveAccount": {"en": "Already have an account?", "ar": "هل لديك حساب بالفعل؟"},
@ -2363,6 +2363,8 @@ const Map localizedValues = {
"otpVerification": {"en": "OTP Verification", "ar":"التحقق من OTP"},
"submiT": {"en": "Submit", "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(
child: CustomButton(
text: TranslationBase.of(context).ok,
text: widget.showCancel ? TranslationBase.of(context).confirm : TranslationBase.of(context).ok,
onPressed: widget.onOkPressed,
backgroundColor: CustomColors.bgRedColor,
borderColor: CustomColors.bgRedBorderColor,

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

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

@ -191,9 +191,9 @@ class _SavedLogin extends State<SavedLogin> {
checkUserAuthentication(val);
}
},
backgroundColor: Color(0xffFEE9EA),
backgroundColor: Color(0xffED1C2B),
borderColor: Color(0xffFEE9EA),
textColor: Color(0xffED1C2B),
textColor: Colors.white,
fontSize: 12,
fontWeight: FontWeight.w500,
borderRadius: 12,
@ -217,37 +217,120 @@ class _SavedLogin extends State<SavedLogin> {
widget.savedLoginData.logInType != null && widget.savedLoginData.logInType != 1
? Column(
children: [
widget.savedLoginData.logInType !=1 ? CustomButton(
text: TranslationBase.of(context).loginByOTP,
onPressed: () {
widget.savedLoginData.logInType = 1;
int? val = widget.savedLoginData.logInType!;
checkUserAuthentication(val);
},
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(),
widget.savedLoginData.logInType != 1
? CustomButton(
text: TranslationBase.of(context).loginByOTP,
onPressed: () {
showModalBottomSheet(
context: context,
isScrollControlled: true,
isDismissible: false,
useSafeArea: true,
backgroundColor: Colors.transparent,
enableDrag: false,
// Prevent dragging to avoid focus conflicts
builder: (bottomSheetContext) => StatefulBuilder(builder: (BuildContext context, StateSetter setModalState) {
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(
height: 20,
),
widget.savedLoginData.logInType !=4 ? CustomButton(
text: "${TranslationBase.of(context).loginBy} ${getType(4, context)}",
onPressed: () {
widget.savedLoginData.logInType = 4;
int? val = widget.savedLoginData.logInType!;
checkUserAuthentication(val);
},
backgroundColor: Colors.white,
borderColor: Color(0xFF2E3039),
textColor: Color(0xFF2E3039),
borderWidth: 2,
padding: EdgeInsets.fromLTRB(0, 14, 0, 14),
icon: "assets/images/svg/whatsapp.svg",
) : Container(),
// widget.savedLoginData.logInType !=4 ? CustomButton(
// text: "${TranslationBase.of(context).loginBy} ${getType(4, context)}",
// onPressed: () {
// widget.savedLoginData.logInType = 4;
// int? val = widget.savedLoginData.logInType!;
// checkUserAuthentication(val);
// },
// backgroundColor: Colors.white,
// borderColor: Color(0xFF2E3039),
// textColor: Color(0xFF2E3039),
// borderWidth: 2,
// padding: EdgeInsets.fromLTRB(0, 14, 0, 14),
// icon: "assets/images/svg/whatsapp.svg",
// ) : Container(),
],
)
: CustomButton(
@ -276,33 +359,78 @@ class _SavedLogin extends State<SavedLogin> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
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),
Expanded(
child: Container(
height: 56,
child: CustomButton(
text: TranslationBase.of(context).guest,
onPressed: () {
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (BuildContext context) => LandingPage()),
);
},
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),
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),
SizedBox(
width: 24,
),
Expanded(
child: Container(
height: 56,
child: CustomButton(
text: TranslationBase.of(context).switchAccount,
onPressed: () {
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (BuildContext context) => WelcomeLogin()),
);
},
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),

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

@ -3510,6 +3510,8 @@ class TranslationBase {
String get otpVerfication => localizedValues["otpVerification"][locale.languageCode];
String get submiT => localizedValues["submiT"][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 showLess => localizedValues["showLess"][locale.languageCode];

@ -136,7 +136,7 @@ class SMSOTP {
child: OTPWidget(
autoFocus: true,
controller: _pinPutController,
defaultBorderColor: Color(0xffE0E0E0), // Changed from white to light gray
defaultBorderColor: Color(0xffffffff),
maxLength: 4,
onTextChanged: (text) {},
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) {
// For tablets, use full screen 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;
return MediaQuery.of(context).size.width;
}
@override
@ -298,31 +281,27 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
Widget _pinBoxRow(BuildContext context) {
_calculateStrList();
// Determine if it's a tablet
bool isTablet = MediaQuery.of(context).size.shortestSide >= 600;
double boxWidth = widget.pinBoxWidth;
// Calculate dynamic width for tablets
if (isTablet) {
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
}
// Calculate dynamic width for all screen sizes to prevent scrolling
double screenWidth = MediaQuery.of(context).size.width;
double totalHorizontalPadding = widget.pinBoxOuterPadding.left + widget.pinBoxOuterPadding.right;
double totalMargin = widget.maxLength * totalHorizontalPadding;
double availableWidth = screenWidth - totalMargin - 32; // 32 for additional safe padding
double boxWidth = (availableWidth / widget.maxLength).clamp(60.0, 200.0); // Reasonable limits
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(
scrollDirection: Axis.horizontal,
child: Row(
children: pinCodes,
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
),
return Row(
children: pinCodes,
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
);
}
@ -353,14 +332,12 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
return Container(
key: ValueKey<String>("container$i"),
alignment: Alignment.center,
margin: widget.pinBoxOuterPadding,
padding: EdgeInsets.zero,
decoration: BoxDecoration(
color: bgColor,
border: Border.all(color: borderColor, width: 1),
borderRadius: BorderRadius.circular(16),
),
width: boxWidth, // Use dynamic width
height: widget.pinBoxHeight,
child: _animatedTextBox(
strList[i],

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

Loading…
Cancel
Save