diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 16373bf..ebcee14 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -782,7 +782,8 @@ "enterPhoneNumber": "أدخل رقم الهاتف", "enterEmailDesc": "أدخل عنوان بريدك الإلكتروني لإكمال عملية إنشاء ملف طبي", "enterPhoneDesc": "أدخل رقم هاتفك لتلقي رمز التحقق ", - "pleaseChooseOption": "الرجاء اختيار من الخيارات أدناه لتلقي رمز التحقق OTP" + "pleaseChooseOption": "الرجاء اختيار من الخيارات أدناه لتلقي رمز التحقق OTP", + "prepareToElevate": "هل أنت مستعد لتحسين صحتك ورفاهتك؟" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 1c78177..b45c697 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -778,5 +778,6 @@ "enterPhoneDesc": "Enter your phone number to receive OTP verification code", "pleaseChooseOption": "Please select from the below options to receive OTP" "dontHaveAccount": "Don't have an account?", - "loginOrRegister": "Login or Register" + "loginOrRegister": "Login or Register", + "prepareToElevate": "Prepared to elevate your health and well-being?" } \ No newline at end of file diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index b9d4ba8..ec9ff99 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -1,3 +1,4 @@ +import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/cupertino.dart'; @@ -219,6 +220,13 @@ extension EmailValidator on String { style: TextStyle(height: 23 / 24, color: color ?? AppColors.blackColor, fontSize: 24.fSize, letterSpacing: -0.4, fontWeight: isBold ? FontWeight.bold : FontWeight.normal), ); + Widget toText28({Color? color, bool isBold = false, bool isCenter = false, TextScaler? textScaler}) => Text( + this, + textAlign: isCenter ? TextAlign.center : null, + textScaler: textScaler, + style: TextStyle(height: 40 / 28, color: color ?? AppColors.blackColor, fontSize: 28.fSize, letterSpacing: -1, fontWeight: isBold ? FontWeight.w600 : FontWeight.normal), + ); + Widget toText32({Color? color, bool isBold = false, bool isCenter = false}) => Text( this, textAlign: isCenter ? TextAlign.center : null, @@ -365,3 +373,56 @@ class FontUtils { return isArabic ? 'Cairo' : 'Poppins'; } } + + +extension CountryExtension on Country { + String get displayName { + switch (this) { + case Country.saudiArabia: + return "Kingdom Of Saudi Arabia"; + case Country.unitedArabEmirates: + return "United Arab Emirates"; + } + } + + String get nameArabic { + switch (this) { + case Country.saudiArabia: + return "المملكة العربية السعودية"; + case Country.unitedArabEmirates: + return "الإمارات العربية المتحدة"; + } + } + + String get iconPath { + switch (this) { + case Country.saudiArabia: + return "assets/images/svg/ksa.svg"; + case Country.unitedArabEmirates: + return "assets/images/svg/uae.svg"; + } + } + + String get countryCode { + switch (this) { + case Country.saudiArabia: + return "966"; + case Country.unitedArabEmirates: + return "971"; + } + } + + static Country fromDisplayName(String name) { + switch (name) { + case "Kingdom Of Saudi Arabia": + case "المملكة العربية السعودية": + return Country.saudiArabia; + case "United Arab Emirates": + case "الإمارات العربية المتحدة": + return Country.unitedArabEmirates; + default: + throw Exception("Invalid country name"); + } + } +} + diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index e818aa4..819fb22 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -774,12 +774,13 @@ abstract class LocaleKeys { static const validPassportNumber = 'validPassportNumber'; static const continuePlan = 'continuePlan'; static const aboutApp = 'aboutApp'; + static const loginOrRegister = 'loginOrRegister'; static const dontHaveAccount = 'dontHaveAccount'; static const receiveOtpToast = 'receiveOtpToast'; static const enterPhoneNumber = 'enterPhoneNumber'; static const enterEmailDesc = 'enterEmailDesc'; static const enterPhoneDesc = 'enterPhoneDesc'; static const pleaseChooseOption = 'pleaseChooseOption'; - static const loginOrRegister = 'loginOrRegister'; + static const prepareToElevate = 'prepareToElevate'; } diff --git a/lib/presentation/authantication/login.dart b/lib/presentation/authantication/login.dart index 3e9273b..3ac0d63 100644 --- a/lib/presentation/authantication/login.dart +++ b/lib/presentation/authantication/login.dart @@ -3,16 +3,16 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; -import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/size_utils.dart' hide Sizer; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart'; -import 'package:hmg_patient_app_new/widgets/bottomsheet/generic_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/input_widget.dart'; +import 'package:sizer/sizer.dart'; class LoginScreen extends StatefulWidget { @override @@ -41,8 +41,7 @@ class _LoginScreen extends State { // Navigator.of(context).pop(); }, onLanguageChanged: (String value) { - print(value); - context.setLocale(value == 'en' ? Locale('ar', 'SA') : Locale('en', 'US')); + // context.setLocale(value == 'en' ? Locale('ar', 'SA') : Locale('en', 'US')); }, ), body: GestureDetector( @@ -51,13 +50,13 @@ class _LoginScreen extends State { }, child: SingleChildScrollView( child: Padding( - padding: EdgeInsets.only(left: 6.w, right: 6.w), + padding: EdgeInsets.only(left: 6.sp, right: 6.sp), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Utils.showLottie(context: context, assetPath: AppAnimations.login, width: 45.w, height: 22.h, repeat: true, fit: BoxFit.cover), - SizedBox(height: 19.h), // Adjusted to sizer unit + Utils.showLottie(context: context, assetPath: AppAnimations.login, width: 45.w, height: 22.sp, repeat: true, fit: BoxFit.cover), + SizedBox(height: 19.sp), // Adjusted to sizer unit LocaleKeys.welcomeToDrSulaiman.tr().toText22(isBold: true, color: AppColors.textColor), // Text( // LocaleKeys.welcomeToDrSulaiman.tr(), @@ -69,7 +68,7 @@ class _LoginScreen extends State { // height: 40 / 28, // ), // ), - SizedBox(height: 4.h), // Adjusted to sizer unit (approx 32px) + SizedBox(height: 4.sp), // Adjusted to sizer unit (approx 32px) TextInputWidget( labelText: "${LocaleKeys.nationalId.tr()} / ${LocaleKeys.fileNo.tr()}", hintText: "xxxxxxxxx", @@ -80,19 +79,19 @@ class _LoginScreen extends State { autoFocus: true, isBorderAllowed: false, isAllowLeadingIcon: true, - padding: EdgeInsets.symmetric(vertical: 1.h, horizontal: 2.w), + padding: EdgeInsets.symmetric(vertical: 1.sp, horizontal: 2.w), leadingIcon: AppAssets.student_card, errorMessage: "Please enter a valid national ID or file number", hasError: true, ), - SizedBox(height: 2.h), // Adjusted to sizer unit (approx 16px) + SizedBox(height: 2.sp), // Adjusted to sizer unit (approx 16px) CustomButton( text: LocaleKeys.login.tr(), icon: AppAssets.login1, iconColor: Colors.white, onPressed: () {}, ), - SizedBox(height: 1.8.h), // Adjusted to sizer unit (approx 14px) + SizedBox(height: 2.sp), // Adjusted to sizer unit (approx 14px) Center( child: RichText( textAlign: TextAlign.center, @@ -118,7 +117,7 @@ class _LoginScreen extends State { ), ], ), - ).withVerticalPadding(2.h), // Adjusted to sizer unit + ).withVerticalPadding(2.sp), // Adjusted to sizer unit ), ], ), diff --git a/lib/presentation/authantication/register.dart b/lib/presentation/authantication/register.dart index bd4cb78..9b900b5 100644 --- a/lib/presentation/authantication/register.dart +++ b/lib/presentation/authantication/register.dart @@ -1,385 +1,579 @@ -import 'dart:convert'; -import 'package:easy_localization/easy_localization.dart'; -import 'package:flutter/material.dart'; -import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; -import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart'; -import 'package:hmg_patient_app_new/widgets/input_widget.dart'; -import 'package:provider/provider.dart'; - -class Register extends StatefulWidget { - final Function? changePageViewIndex; - - const Register({Key? key, this.changePageViewIndex}) : super(key: key); - - @override - _Register createState() => _Register(); -} - -class _Register extends State { - @override - void initState() { - getPatientOccupationList(); - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: CustomAppBar( - onBackPressed: () {}, - onLanguageChanged: (String value) {}, - ), - body: Column( - children: [ - Expanded( - child: ListView( - padding: EdgeInsets.all(21), - physics: BouncingScrollPhysics(), - children: [ - SizedBox(height: 10), - Padding( - padding: EdgeInsets.all(10), - child: Text( - LocaleKeys.enterNationalId.tr(), - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64, height: 23 / 16), - )), - SizedBox(height: 10), - PhoneNumberSelectorWidget(onNumberChange: (value) => {}, onCountryChange: (value) => ), - SizedBox(height: 12), - TextInputWidget(labelText: LocaleKeys.nationalIdNumber.tr(), hintText: "Xxxxxxxxx", controller: TextEditingController()), - SizedBox(height: 20), - Row( - children: [ - Expanded( - child: Row( - children: [ - Radio( - value: 1, - groupValue: isHijri, - onChanged: (value) { - }, - ), - Text(LocaleKeys.hijriDate.tr()), - ], - ), - ), - Expanded( - child: Row( - children: [ - Radio( - value: 0, - groupValue: isHijri, - onChanged: (value) { - }, - ), - Text(LocaleKeys.gregorianDate.tr()), - ], - ), - ), - ], - ), - Row(children: [ - Container( - width: SizeConfig.realScreenWidth! * .89, - child: isHijri == 1 - ? Directionality( - textDirection: TextDirection.ltr, - child: inputWidget(TranslationBase.of(context).dob, "DD/MM/YYYYY", dob, - isNumber: false, - suffix: Icon( - Icons.calendar_today, - size: 16, - ))) - : Container( - child: InkWell( - onTap: () { - if (isHijri != null) _selectDate(context); - }, - child: Directionality( - textDirection: TextDirection.ltr, - child: inputWidget(TranslationBase.of(context).dob, "DD/MM/YYYYY", dobEn, - isNumber: false, - isEnable: false, - suffix: Icon( - Icons.calendar_today, - size: 16, - )))))), - ]) - ], - ), - ), - Container( - width: double.maxFinite, - // height: 80.0, - color: Colors.white, - // margin: EdgeInsets.only(bottom: 50.0), - child: Row( - children: [ - Expanded( - child: Padding( - padding: EdgeInsets.all(10), - child: DefaultButton(TranslationBase.of(context).cancel, () { - Navigator.of(context).pop(); - locator().loginRegistration.registration_cancel(step: 'enter details'); - }, textColor: Colors.white, color: Color(0xffD02127))), - ), - Expanded( - child: Padding( - padding: EdgeInsets.all(10), - child: DefaultButton(TranslationBase.of(context).next, () { - startRegistration(); - locator().loginRegistration.registration_enter_details(); - }, textColor: Colors.white, color: isButtonDisabled == true ? Colors.grey : Color(0xff359846))), - ), - ], - ), - ) - ], - ), - ); - } - - Future _selectDate(BuildContext context) async { - DatePicker.showDatePicker( - context, - showTitleActions: true, - minTime: DateTime(DateTime.now().year - 100, 1, 1), - maxTime: DateTime.now(), - onConfirm: (date) { - selectedDate = date; - setState(() { - final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy'); - dobEn.text = dateFormat.format(date); - }); - }, - currentTime: DateTime.now(), - ); - } - - Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String? prefix, bool isEnable = true, bool hasSelection = false, bool isNumber = true, Icon? suffix}) { - return Container( - padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - color: Colors.white, - border: Border.all( - color: Color(0xffefefef), - width: 1, - ), - ), - child: InkWell( - onTap: hasSelection ? () {} : null, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _labelText, - style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.w600, - color: Color(0xff2B353E), - letterSpacing: -0.44, - ), - ), - TextField( - enabled: isEnable, - scrollPadding: EdgeInsets.zero, - keyboardType: isNumber ? TextInputType.numberWithOptions(signed: true) : TextInputType.datetime, - controller: _controller, - onChanged: (value) => {validateForm()}, - style: TextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w400, - color: Color(0xff2B353E), - letterSpacing: -0.44, - ), - decoration: InputDecoration( - isDense: true, - hintText: _hintText, - hintStyle: TextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w400, - color: Color(0xff575757), - letterSpacing: -0.56, - ), - prefixIconConstraints: BoxConstraints(minWidth: 50), - prefixIcon: prefix == null - ? null - : Text( - "+" + prefix, - style: TextStyle( - fontSize: 14, - height: 21 / 14, - fontWeight: FontWeight.w500, - color: Color(0xff2E303A), - letterSpacing: -0.56, - ), - ), - contentPadding: EdgeInsets.zero, - border: InputBorder.none, - focusedBorder: InputBorder.none, - enabledBorder: InputBorder.none, - ), - ), - ], - ), - ), - if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), - if (suffix != null) suffix - ], - ), - ), - ); - } - - startRegistration() { - final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy'); - if (isButtonDisabled == false) { - var request = CheckPatientForRegistration(); - request.patientMobileNumber = int.parse(mobileNo); - request.zipCode = countryCode; - request.patientOutSA = countryCode == '966' ? 0 : 1; - - request.patientIdentificationID = int.parse(nationalIDorFile.text); - request.patientID = 0; - request.isRegister = true; - request.dob = isHijri == 1 ? dob.text : dateFormat.format(selectedDate); - request.isHijri = isHijri; - this.checkPatientForRegisteration(request); - } - } - - checkPatientForRegisteration(request) { - int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; - GifLoaderDialogUtils.showMyDialog(context); - this.authService.checkPatientForRegisteration(request, languageID).then((response) => {checkUserStatus(response, request)}).catchError((err) { - GifLoaderDialogUtils.hideDialog(context); - ConfirmDialog dialog = new 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: Register())), - }, - cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); - dialog.showAlertDialog(context); - }); - } - - void validateForm() { - if (util.validateIDBox(nationalIDorFile.text, loginType) == true && - mobileNo.length >= 9 && - util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true && - isHijri != null && - (dobEn.text != null || dob.text != null)) { - setState(() { - isButtonDisabled = false; - }); - } else { - setState(() { - isButtonDisabled = true; - }); - } - } - - checkUserStatus(response, CheckPatientForRegistration request) async { - GifLoaderDialogUtils.hideDialog(context); - if (response is Map) { - var nRequest = request.toJson(); - nRequest['LogInTokenID'] = response['LogInTokenID']; - if (response['hasFile'] == true) { - ConfirmDialog dialog = new ConfirmDialog( - context: context, - confirmMessage: response['ErrorEndUserMessage'], - okText: TranslationBase.of(context).ok, - cancelText: TranslationBase.of(context).cancel, - okFunction: () { - AlertDialogBox.closeAlertDialog(context); - sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest); - LoginRegistration.loginMethod = 1; // 1=NationalID, by default from Registration - Navigator.of(context).push(FadePage(page: Login())); - }, - cancelFunction: () {}) - .showAlertDialog(context); - } else { - final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy'); - nRequest['forRegister'] = true; - nRequest['isRegister'] = true; - nRequest["PatientIdentificationID"] = nRequest["PatientIdentificationID"].toString(); - nRequest['dob'] = isHijri == 1 ? dob.text : dateFormat.format(selectedDate); - nRequest['isHijri'] = isHijri; - sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, nRequest); - sharedPref.setString(LOGIN_TOKEN_ID, response['LogInTokenID']); - if (request.patientOutSA == 0) { - this.chekUserData(response['LogInTokenID']); - } else { - Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex, fromRegistration: true, isDubai: true))); - } - } - } else { - // if (response['ErrorCode'] == '-986') { - //AppToast.showErrorToast(message: response); - AlertDialogBox( - context: context, - confirmMessage: response, - okText: TranslationBase.of(context).ok, - okFunction: () { - AlertDialogBox.closeAlertDialog(context); - Navigator.of(context).pop(); - }).showAlertDialog(context); - //} - } - } - - chekUserData(loginToken) { - // let m = hijri(this.dateOfBirth).locale('en'); - // // const dateHijri = m.format('iDD/iMM/iYYYY'); - // const request = { - // PatientIdentificationID: this.id.toString(), - // // TokenID: token, - // DOB: this.dateOption === '1' ? this.dateOfBirth : moment(this.dateOfBirth).format('DD/MM/YYYY'), - // IsHijri: Number(this.dateOption) - // } - - final intl.DateFormat dateFormat = intl.DateFormat('dd/MM/yyyy'); - GifLoaderDialogUtils.showMyDialog(context); - var request = CheckUserStatusRequest(); - request.patientIdentificationID = nationalIDorFile.text; - request.dOB = isHijri == 1 ? dob.text : dateFormat.format(selectedDate); - request.isHijri = isHijri; - request.patientOutSA = countryCode == '966' ? 0 : 1; - this.authService.checkUserStatus(request).then((result) => { - GifLoaderDialogUtils.hideDialog(context), - if (result is Map) - { - result = CheckUserStatusResponse.fromJson(result as Map), - sharedPref.setObject(NHIC_DATA, result), - // widget.changePageViewIndex!(1), - Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex, fromRegistration: true))), - } - else - { - AppToast.showErrorToast(message: result != null ? result : TranslationBase.of(context).somethingWentWrong), - } - }); - } - - getPatientOccupationList() async { - patientOccupationList.clear(); - await authService.getPatientOccupationList().then((result) { - sharedPref.setString(PATIENT_OCCUPATION_LIST, json.encode(result['GetOccupationLst'])); - }).catchError((err) { - AppToast.showErrorToast(message: err); - }); - } -} +// import'dart:convert'; +// +// import 'package:easy_localization/easy_localization.dart'; +// import 'package:flutter/gestures.dart'; +// import 'package:flutter_svg/flutter_svg.dart'; +// import 'package:hijri_gregorian_calendar/hijri_gregorian_calendar.dart'; +// import 'package:hmg_patient_app/config/config.dart'; +// import 'package:hmg_patient_app/config/shared_pref_kay.dart'; +// import 'package:hmg_patient_app/config/size_config.dart'; +// import 'package:hmg_patient_app/core/service/client/base_app_client.dart'; +// import 'package:hmg_patient_app/core/viewModels/project_view_model.dart'; +// import 'package:hmg_patient_app/models/Appointments/toDoCountProviderModel.dart'; +// import 'package:hmg_patient_app/models/Authentication/check_activation_code_response.dart'; +// import 'package:hmg_patient_app/models/Authentication/check_paitent_authentication_req.dart'; +// import 'package:hmg_patient_app/models/Authentication/check_user_status_reponse.dart'; +// import 'package:hmg_patient_app/models/Authentication/check_user_status_req.dart'; +// import 'package:hmg_patient_app/models/Authentication/checkpatient_for_registration.dart'; +// import 'package:hmg_patient_app/models/Authentication/register_info_response.dart'; +// import 'package:hmg_patient_app/models/Authentication/send_activation_request.dart'; +// import 'package:hmg_patient_app/new_ui/new_ext.dart'; +// import 'package:hmg_patient_app/new_ui/otp/otp_validation_bootmsheet_widget.dart'; +// import 'package:hmg_patient_app/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart'; +// import 'package:hmg_patient_app/pages/login/login-type.dart'; +// import 'package:hmg_patient_app/pages/login/register-info.dart'; +// import 'package:hmg_patient_app/pages/login/register.dart'; +// import 'package:hmg_patient_app/pages/login/register_new_step_2.dart'; +// import 'package:hmg_patient_app/pages/login/user-login-agreement-page.dart'; +// import 'package:hmg_patient_app/pages/login/welcome.dart'; +// import 'package:hmg_patient_app/services/authentication/auth_provider.dart'; +// import 'package:hmg_patient_app/theme/colors.dart'; +// import 'package:hmg_patient_app/uitl/app_shared_preferences.dart'; +// import 'package:hmg_patient_app/uitl/app_toast.dart'; +// import 'package:hmg_patient_app/uitl/font_utils.dart'; +// import 'package:hmg_patient_app/uitl/gif_loader_dialog_utils.dart'; +// import 'package:hmg_patient_app/uitl/translations_delegate_base.dart'; +// import 'package:hmg_patient_app/uitl/utils.dart'; +// import 'package:hmg_patient_app/uitl/utils_new.dart'; +// import 'package:hmg_patient_app/widgets/drawer/langauge_picker.dart'; +// import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart'; +// import 'package:flutter/material.dart'; +// import 'package:hmg_patient_app/widgets/otp/sms-popup.dart'; +// import 'package:hmg_patient_app/widgets/text/app_texts_widget.dart'; +// import 'package:hmg_patient_app_new/core/app_state.dart'; +// import 'package:hmg_patient_app_new/core/enums.dart'; +// import 'package:hmg_patient_app_new/core/utils/utils.dart'; +// import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +// import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +// import 'package:hmg_patient_app_new/widgets/dropdown_widget.dart'; +// import 'package:hmg_patient_app_new/widgets/input_widget.dart'; +// import 'package:provider/provider.dart'; +// +// import '../../core/viewModels/appointment_rate_view_model.dart'; +// import '../../locator.dart'; +// import '../../models/Authentication/authenticated_user.dart'; +// import '../../models/Authentication/select_device_imei_res.dart'; +// import '../../models/InPatientServices/get_admission_info_response_model.dart'; +// import '../../models/InPatientServices/get_admission_request_info_response_model.dart'; +// import '../../new_ui/exception_widget/ExceptionBottomSheet.dart'; +// import '../../services/clinic_services/get_clinic_service.dart'; +// import '../../widgets/dialogs/alert_dialog.dart'; +// import '../../widgets/dialogs/confirm_dialog.dart'; +// import '../../widgets/transitions/fade_page.dart'; +// import 'package:intl/intl.dart' as intl; +// +// import '../landing/landing_page.dart'; +// import '../rateAppointment/rate_appointment_doctor.dart'; +// +// class RegisterNew extends StatefulWidget { +// @override +// _RegisterNew createState() => _RegisterNew(); +// } +// +// class _RegisterNew extends State { +// @override +// void initState() { +// super.initState(); +// } +// +// @override +// void dispose() { +// super.dispose(); +// } +// +// @override +// Widget build(BuildContext context) { +// +// AppState appState = getIt.get(); +// return Scaffold( +// body: GestureDetector( +// onTap: () { +// FocusScope.of(context).unfocus(); +// }, +// child: ScrollConfiguration( +// behavior: ScrollConfiguration.of(context).copyWith(overscroll: false, physics: const ClampingScrollPhysics()), +// child: NotificationListener( +// onNotification: (notification) { +// notification.disallowIndicator(); +// return true; +// }, +// child: SingleChildScrollView( +// physics: ClampingScrollPhysics(), +// padding: EdgeInsets.only( +// left: 24, +// right: 24, +// ), +// child: Column( +// mainAxisSize: MainAxisSize.min, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Utils.showLottie( +// context: context, +// assetPath: 'assets/animations/lottie/register.json', +// width: MediaQuery +// .of(context) +// .size +// .width * 0.45, +// height: MediaQuery +// .of(context) +// .size +// .height * 0.22, +// fit: BoxFit.cover, +// repeat: true), +// SizedBox(height: 8), +// LocaleKeys.prepareToElevate.tr().toText28( +// textScaler: TextScaler.linear(MediaQuery.textScalerOf(context).scale(1)), +// ), +// SizedBox(height: 24), +// Directionality( +// textDirection: Directionality.of(context), +// child: Container( +// decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(24)), +// padding: EdgeInsets.only(left: 16, right: 16, top: 0, bottom: 0), +// child: Column( +// children: [ +// DropdownWidget( +// labelText: LocaleKeys.country.tr(), +// hintText: LocaleKeys.ksa.tr(), +// isEnable: true, +// selectedValue: AppStat.selectedLanguage == "ar" ? selectedCountry.nameArabic : selectedCountry.displayName, +// dropdownItems: Country.values.map((e) => "ar" ? e.displayName : e.displayName).toList(), +// +// // dropdownItems: Country.values.map((e) => (e.name).first).toList(), +// // dropdownItems: Country.values.map((e) => "ar" ? e.nameArabic : e.displayName).toList(), +// // selectedValue: context.selectedLanguage == "ar" ? selectedCountry.nameArabic : selectedCountry.displayName, +// // selectionType: SelectionType.dropdown, +// onChange: (val) { +// if (val != null) { +// } +// }, +// isBorderAllowed: false, +// isAllowLeadingIcon: true, +// hasSelectionCustomIcon: true, +// removePadding: true, +// isLeadingCountry: true, +// isAllowRadius: false, +// padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), +// selectionCustomIcon: "assets/images/svg/arrow-down.svg", +// leadingIcon: selectedCountry.iconPath, +// ).withVerticalPadding(8), +// Divider(height: 1), +// Directionality( +// textDirection: TextDirection.ltr, +// child: newInputWidget(TranslationBase +// .of(context) +// .nationalIdNumber, "xxxxxxxxx", nationalIDorFile, +// isEnable: true, +// prefix: null, +// removePadding: true, +// isAllowRadius: false, +// hasSelection: false, +// isBorderAllowed: false, +// isAllowLeadingIcon: true, +// autoFocus: true, +// padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), +// leadingIcon: "assets/images/svg/student-card.svg", +// onChange: (value) { +// print(value); +// }).withVerticalPadding(8), +// ), +// Divider(height: 1), +// Directionality( +// textDirection: TextDirection.ltr, +// child: newInputWidget(TranslationBase +// .of(context) +// .dob, "11 July, 1994", nationalIDorFile, +// isEnable: true, +// prefix: null, +// hasSelection: true, +// removePadding: true, +// isBorderAllowed: false, +// isAllowLeadingIcon: true, +// hasSelectionCustomIcon: true, +// selectionType: SelectionType.calendar, +// selectedValue: selectedDOB != null +// ? isHijri == 1 +// ? Utils.formatHijriDateToDisplay(selectedDOB!.toIso8601String()) +// : Utils.formatDateToDisplay(selectedDOB.toString()) +// : null, +// selectionCustomIcon: "assets/images/svg/calendar.svg", +// lang: context.selectedLanguage, +// padding: const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0), +// leadingIcon: "assets/images/svg/birthday-cake.svg", +// onChange: (value) { +// selectedDOB = DateTime.parse(value!); +// if (isHijri == 1) { +// var hijriDate = HijriGregConverter.gregorianToHijri(DateTime.parse(value)); +// selectedDOB = DateTime(hijriDate.year, hijriDate.month, hijriDate.day); +// } else { +// selectedDOB = DateTime.parse(value); +// } +// print(selectedDOB!.toIso8601String()); +// setState(() {}); +// }, +// onCalendarTypeChanged: (bool value) { +// if (value) { +// isHijri = 0; +// } else { +// isHijri = 1; +// } +// }).withVerticalPadding(8), +// ), +// ], +// ), +// ), +// ), +// SizedBox(height: 25), +// GestureDetector( +// onTap: () { +// setState(() { +// isTermsAccepted = !isTermsAccepted; +// }); +// }, +// child: Row( +// children: [ +// AnimatedContainer( +// duration: const Duration(milliseconds: 200), +// height: 24, +// width: 24, +// decoration: BoxDecoration( +// color: isTermsAccepted ? const Color(0xFFE92227) : Colors.transparent, +// borderRadius: BorderRadius.circular(6), +// border: Border.all( +// color: isTermsAccepted ? const Color(0xFFE92227) : Colors.grey, +// width: 2, +// ), +// ), +// child: isTermsAccepted ? const Icon(Icons.check, size: 16, color: Colors.white) : null, +// ), +// SizedBox(width: 12), +// Expanded( +// child: Text( +// TranslationBase +// .of(context) +// .iAcceptTermsConditions, +// style: context.dynamicTextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Color(0xFF2E3039)), +// ), +// ), +// ], +// ), +// ), +// SizedBox(height: 25), +// CustomButton( +// text: TranslationBase +// .of(context) +// .register, +// icon: "assets/images/svg/note-edit.svg", +// onPressed: () { +// // bool isValid = Utils.validateIqama(nationalIDorFile.text); +// if (nationalIDorFile == null || nationalIDorFile.text.isEmpty) { +// context.showBottomSheet( +// child: ExceptionBottomSheet( +// message: TranslationBase +// .of(context) +// .pleaseEnterNationalId, +// showCancel: false, +// onOkPressed: () { +// Navigator.of(context).pop(); +// }, +// ), +// ); +// // Utils.showErrorToast(TranslationBase.of(context).pleaseEnterNationalId); +// return; +// } +// if ((!Utils.validateIqama(nationalIDorFile.text) && selectedCountry.countryCode == '966') || +// (!Utils.validateUaeNationalId(nationalIDorFile.text) && selectedCountry.countryCode == '971')) { +// context.showBottomSheet( +// child: ExceptionBottomSheet( +// message: TranslationBase +// .of(context) +// .incorrectNationalId, +// showCancel: false, +// onOkPressed: () { +// Navigator.of(context).pop(); +// }, +// ), +// ); +// return; +// } +// if (selectedCountry == null || selectedCountry.countryCode.isEmpty) { +// context.showBottomSheet( +// child: ExceptionBottomSheet( +// message: TranslationBase +// .of(context) +// .pleaseSelectCountry, +// showCancel: false, +// onOkPressed: () { +// Navigator.of(context).pop(); +// }, +// ), +// ); +// return; +// } +// +// if (selectedDOB == null) { +// context.showBottomSheet( +// child: ExceptionBottomSheet( +// message: TranslationBase +// .of(context) +// .pleaseSelectDOB, +// showCancel: false, +// onOkPressed: () { +// Navigator.of(context).pop(); +// }, +// ), +// ); +// return; +// } +// if (!isTermsAccepted) { +// context.showBottomSheet( +// child: ExceptionBottomSheet( +// message: TranslationBase +// .of(context) +// .pleaseAcceptTermsConditions, +// showCancel: false, +// onOkPressed: () { +// Navigator.of(context).pop(); +// }, +// ), +// ); +// return; +// } +// +// if (phoneController != null) { +// phoneController.clear(); +// } +// showModalBottomSheet( +// context: context, +// isScrollControlled: true, +// isDismissible: false, +// backgroundColor: Colors.transparent, +// builder: (bottomSheetContext) => +// Padding( +// padding: EdgeInsets.only(bottom: MediaQuery +// .of(bottomSheetContext) +// .viewInsets +// .bottom), +// child: SingleChildScrollView( +// child: GenericBottomSheet( +// countryCode: selectedCountry.countryCode, +// initialPhoneNumber: "", +// textController: phoneController, +// onChange: (String? value) { +// mobileNo = value!; +// }, +// buttons: [ +// Padding( +// padding: const EdgeInsets.only(bottom: 10), +// child: CustomButton( +// text: TranslationBase +// .of(context) +// .sendOTPSMS, +// onPressed: () { +// if (mobileNo.isEmpty) { +// context.showBottomSheet( +// child: ExceptionBottomSheet( +// message: TranslationBase +// .of(context) +// .pleaseEnterMobile, +// showCancel: false, +// onOkPressed: () { +// Navigator.of(context).pop(); +// }, +// ), +// ); +// } else if (!Utils.validateMobileNumber(mobileNo)) { +// context.showBottomSheet( +// child: ExceptionBottomSheet( +// message: TranslationBase +// .of(context) +// .pleaseEnterValidMobile, +// showCancel: false, +// onOkPressed: () { +// Navigator.of(context).pop(); +// }, +// ), +// ); +// } else { +// registerUser(1); +// } +// }, +// 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, +// fontFamily: context.fontFamily, +// color: Color(0xFF2E3039), +// fontWeight: FontWeight.w500, +// ), +// ), +// ], +// ), +// Padding( +// padding: const EdgeInsets.only(bottom: 10, top: 10), +// child: CustomButton( +// text: TranslationBase +// .of(context) +// .sendOTPWHATSAPP, +// onPressed: () { +// if (mobileNo.isEmpty) { +// context.showBottomSheet( +// child: ExceptionBottomSheet( +// message: TranslationBase +// .of(context) +// .pleaseEnterMobile, +// showCancel: false, +// onOkPressed: () { +// Navigator.of(context).pop(); +// }, +// ), +// ); +// } else if (!Utils.validateMobileNumber(mobileNo)) { +// context.showBottomSheet( +// child: ExceptionBottomSheet( +// message: TranslationBase +// .of(context) +// .pleaseEnterValidMobile, +// showCancel: false, +// onOkPressed: () { +// Navigator.of(context).pop(); +// }, +// ), +// ); +// } else { +// registerUser(4); +// } +// // int? val = Utils.onOtpBtnPressed(OTPType.whatsapp, mobileNo, context); +// // registerUser(val); +// }, +// backgroundColor: Colors.white, +// borderColor: Color(0xFF2E3039), +// textColor: Color(0xFF2E3039), +// icon: "assets/images/svg/whatsapp.svg", +// ), +// ), +// ], +// myFocusNode: myFocusNode, +// ), +// ), +// ), +// ); +// Future.delayed(Duration(milliseconds: 500), () { +// myFocusNode.requestFocus(); +// }); +// }, +// fontFamily: context.fontFamily, +// ), +// SizedBox(height: 14), +// Center( +// child: RichText( +// textAlign: TextAlign.center, +// text: TextSpan( +// style: context.dynamicTextStyle( +// color: Colors.black, +// fontSize: 16, +// height: 26 / 16, +// fontWeight: FontWeight.w500, +// ), +// children: [ +// TextSpan(text: TranslationBase +// .of(context) +// .alreadyHaveAccount, style: context.dynamicTextStyle()), +// TextSpan(text: " "), +// TextSpan( +// text: TranslationBase +// .of(context) +// .loginNow, +// style: context.dynamicTextStyle( +// color: CustomColors.bgRedColor, +// fontSize: 16, +// height: 26 / 16, +// fontWeight: FontWeight.w500, +// ), +// recognizer: TapGestureRecognizer() +// ..onTap = () { +// Navigator.of(context).pop(); +// }, +// ), +// ], +// ), +// ), +// ), +// SizedBox(height: 30), +// ], +// ), +// ), +// ), +// ),) +// ); +// } +// +// Widget showProgress({String? title, String? status, Color? color, bool isNeedBorder = true}) { +// return Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Row( +// children: [ +// Container( +// width: 26, +// height: 26, +// decoration: containerRadius(color!, 200), +// child: Icon( +// Icons.done, +// color: Colors.white, +// size: 16, +// ), +// ), +// if (isNeedBorder) +// Expanded( +// child: Padding( +// padding: const EdgeInsets.all(8.0), +// child: mDivider(Colors.grey), +// )), +// ], +// ), +// mHeight(8), +// Text( +// title!, +// style: TextStyle( +// fontSize: 11, +// fontWeight: FontWeight.w600, +// letterSpacing: -0.44, +// ), +// ), +// mHeight(2), +// Container( +// padding: EdgeInsets.all(5), +// decoration: containerRadius(color.withOpacity(0.2), 4), +// child: Text( +// status!, +// style: TextStyle( +// fontSize: 8, +// fontWeight: FontWeight.w600, +// letterSpacing: -0.32, +// color: color, +// ), +// ), +// ), +// ], +// ) +// ], +// ); +// } +// } diff --git a/lib/providers/authentication_view_model.dart b/lib/providers/authentication_view_model.dart index af542ac..ecc3e04 100644 --- a/lib/providers/authentication_view_model.dart +++ b/lib/providers/authentication_view_model.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_state.dart'; class AuthenticationViewModel extends ChangeNotifier { - // Add properties and methods related to authentication here -} \ No newline at end of file +// Add properties and methods related to authentication here +}