Merge pull request 'haroon_dev' (#184) from haroon_dev into master

Reviewed-on: https://34.17.182.140/Haroon6138/HMG_Patient_App_New/pulls/184
dev_aamir
Haroon6138 20 hours ago
commit d76bd2a295

@ -1528,7 +1528,7 @@
"prediction": "تنبؤ",
"prevention": "وقاية",
"disclaimer": "تنصل",
"thisAboveInfo": "المعلومات المذكورة أعلاه تم إنشاؤها بواسطة AI",
"thisAboveInfo": "المعلومات المذكورة أعلاه مُولّدة بواسطة AI بناءً على نتائج تحاليلك المخبرية، وهي لأغراض إعلامية فقط. لا ينبغي اعتبارها تشخيصًا طبيًا أو خطة علاجية. استشر طبيبك دائمًا للحصول على نصيحة طبية مُخصصة قبل اتخاذ أي قرارات تتعلق بصحتك.",
"aiDisclaimer": "سيتم مشاركة بيانات نتائج تحاليلك المخبرية بشكل آمن مع خدمة الذكاء الاصطناعي لدينا لتحليلها. يساعد هذا في تقديم رؤى صحية مُخصصة. هل ترغب في المتابعة؟",
"consent": "موافقة",
"bmiNormalDescription": "مؤشر كتلة جسمك ضمن المعدل الصحي. استمر في اتباع نظام غذائي متوازن، وممارسة النشاط البدني بانتظام، وإجراء الفحوصات الدورية للحفاظ على صحة جيدة. راقب أي تغييرات ملحوظة مع مرور الوقت.",
@ -1559,10 +1559,7 @@
"dietZoneDietDescription": "Zone Diet (~40% carbs / 30% protein / 30% fat): emphasizes hormonal balance and portion control. May improve body composition and energy for some, but requires planning; personalize with a nutrition professional.",
"contextDependent": "يعتمد السياق",
"calculatedValue": "القيمة المحسوبة",
"calculationFormula": "صيغة الحساب"
"calculationFormula": "صيغة الحساب",
"confirmYourLocation": "قم بتأكيد موقعك",
"confirmYourLocationDesc": "يرجى تأكيد موقعك الحالي لعرض الاتجاهات المناسبة.",
"insideHospital": "أنا داخل المستشفى",
@ -1571,5 +1568,8 @@
"servicePriceListDesc": "توضح قائمة أسعار الخدمات أدناه رسوم الخدمات الصحية المقدمة للمرضى بنظام الدفع النقدي. أما فيما يتعلق بالخدمات المشمولة بالتأمين، فسيتم تطبيق التغطية التأمينية والتحقق من الأهلية واحتساب نسب التحمل وفقًا لشروط وثيقة التأمين وجدول المنافع المعتمد لكل شركة تأمين.",
"servicePriceListRights": "يحق للمريض الحصول على متابعة مجانية في غضون 14 يومًا من الزيارة الأولى",
"serviceName": "اسم الخدمة",
"noFreeSlot": "لا توجد مواعيد متاحة في التاريخ المحدد. يرجى اختيار تاريخ آخر أو إعادة المحاولة لاحقاً."
"noFreeSlot": "لا توجد مواعيد متاحة في التاريخ المحدد. يرجى اختيار تاريخ آخر أو إعادة المحاولة لاحقاً.",
"noThanksIKnowTheClinic": "لا، شكراً. أنا أعرف العيادة.",
"unableToSendOTP": "تعذر إرسال رمز التحقق لمرة واحدة",
"loadingAIAnalysis": "جارٍ تحميل بياناتك وتحليلها، يُرجى التحلي بالصبر ودع الذكاء الاصطناعي يقوم بالمهمة. يُرجى التحلي بالصبر، فقد يستغرق هذا بعض الوقت."
}

@ -1439,7 +1439,6 @@
"healthy": "Healthy",
"warning": "Warning",
"vitalSignDetails": "Vital Sign Details",
"resultOf": "Result of {date}",
"resultOfNoDate": "Result of --",
"referenceRangeBetween": "Reference range: {low} {high} {unit}",
"referenceRangeMin": "Reference range: ≥ {low} {unit}",
@ -1522,7 +1521,7 @@
"servicePriceListDesc": "Below is the services price list outline the healthcare services fees for cash payments, where the insurance coverage, eligibility, and co-payment deductions will be processed in accordance with the insurance policy terms and the table of benefits of each insurance providers:",
"servicePriceListRights": "The patient has the right to a free follow-up within 14 days of initial visit",
"serviceName": "Service Name",
"noFreeSlot": "No free slot available for the selected date. Please select another date or check back later."
"noFreeSlot": "No free slot available for the selected date. Please select another date or check back later.",
"noThanksIKnowTheClinic": "No, Thanks. I Know the clinic",
"unableToSendOTP": "Unable to send Verification OTP",
"aiOverView": "AI Overview",
@ -1531,8 +1530,8 @@
"prediction": "Prediction",
"prevention": "Prevention",
"disclaimer": "Disclaimer",
"thisAboveInfo": "The above information is generated by",
"aiDisclaimer": "Your lab result data will be securely shared with our AI service for analysis. This helps provide personalized health insights. Do you want to proceed?",
"thisAboveInfo": "The above information is generated by AI based on your lab results and is intended for informational purposes only. It should not be considered a medical diagnosis or treatment plan. Always consult with your healthcare provider for personalized medical advice and before making any health-related decisions.",
"aiDisclaimer": "Your lab result data will be securely shared with our AI Analyzer for analysis. This helps provide personalized health insights. Do you want to proceed?",
"consent": "Consent",
"bmiNormalDescription": "Your BMI is within the healthy range. Continue a balanced diet, regular physical activity, and routine checkups to maintain good health. Monitor any significant changes over time.",
"bmiUnderweightDescription": "BMI suggests you are underweight. Consider increasing calorie intake with nutrient-dense foods, include resistance training to build muscle, and consult a healthcare professional to check for underlying causes.",
@ -1562,8 +1561,6 @@
"dietZoneDietDescription": "Zone Diet (~40% carbs / 30% protein / 30% fat): emphasizes hormonal balance and portion control. May improve body composition and energy for some, but requires planning; personalize with a nutrition professional.",
"contextDependent": "Context Dependent",
"calculatedValue": "Calculated Value",
"calculationFormula": "Calculation Formula"
"calculationFormula": "Calculation Formula",
"loadingAIAnalysis": "Loading and analysing your data, Please be patient and let the AI do the magic. Please be patient, This might take some time."
}

@ -181,6 +181,16 @@ class ApiClientImp implements ApiClient {
body[_appState.isAuthenticated ? 'TokenID' : 'LogInTokenID'] = _appState.appAuthToken;
}
if (url.contains("HMGAI_Lab_Analyze_Orders_API")) {
url = "https://uat.hmgwebservices.com/Services/Patients.svc/REST/HMGAI_Lab_Analyze_Orders_API";
body['TokenID'] = "@dm!n";
}
if (url.contains("HMGAI_Lab_Analyzer_API")) {
url = "https://uat.hmgwebservices.com/Services/Patients.svc/REST/HMGAI_Lab_Analyzer_API";
body['TokenID'] = "@dm!n";
}
// body['TokenID'] = "@dm!n";
// body['PatientID'] = 4768663;
// body['PatientTypeID'] = 1;

@ -908,7 +908,8 @@ class ApiConsts {
static String getAiOverViewLabOrder = "Services/Patients.svc/REST/HMGAI_Lab_Analyzer_API";
// ************ static values for Api ****************
static final double appVersionID = 19.7;
// static final double appVersionID = 19.7;
static final double appVersionID = 50.7;
static final int appChannelId = 3;
static final String appIpAddress = "10.20.10.20";
static final String appGeneralId = "Cs2020@2016\$2958";

@ -38,7 +38,7 @@ class LoadingUtils {
child: Material(
child: Center(
child: isSuccessDialog ? Utils.getSuccessWidget(loadingText: loadingText) : Utils.getLoadingWidget(loadingText: loadingText),
),
).paddingSymmetrical(24.w, 0),
),
);
}).then((value) {

@ -423,11 +423,12 @@ extension DynamicTextStyleExtension on BuildContext {
Locale? locale,
TextBaseline? textBaseline,
FontStyle? fontStyle,
String? fontFamily,
bool isLanguageSwitcher = false}) {
AppState appState = getIt.get<AppState>();
final family = appState.getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins';
return TextStyle(
fontFamily: family,
fontFamily: fontFamily ?? family,
fontSize: fontSize,
fontWeight: fontWeight,
color: color,

@ -400,6 +400,10 @@ class LabViewModel extends ChangeNotifier {
lowRefenceValue = minY;
}
if (minY > lowRefenceValue) {
minY = lowRefenceValue - 25;
}
this.flagForHighReferenceRange = flagForHighReferenceRange;
this.flagForLowReferenceRange = flagForLowReferenceRange;
highTransformedReferenceValue = double.parse(transformValueInRange(highRefrenceValue, flagForHighReferenceRange ?? "").toStringAsFixed(1));
@ -728,8 +732,9 @@ class LabViewModel extends ChangeNotifier {
notifyListeners();
}
Future<void> getAiOverviewLabOrders({required PatientLabOrdersResponseModel labOrder}) async {
LoadingUtils.showFullScreenLoader(loadingText: "Loading and analysing your data,\nPlease be patient and let the AI do the magic");
Future<void> getAiOverviewLabOrders({required PatientLabOrdersResponseModel labOrder, required String loadingText}) async {
// LoadingUtils.showFullScreenLoader(loadingText: "Loading and analysing your data,\nPlease be patient and let the AI do the magic. \nPlease be patient, This might take some time.");
LoadingUtils.showFullScreenLoader(loadingText: loadingText);
List<Map<String, dynamic>> results = [];
Map<String, dynamic> orderData = {"order_date": labOrder.orderDate ?? "", "clinic": labOrder.clinicDescription ?? "", "doctor": labOrder.doctorName ?? "", "results": []};
List<Map<String, dynamic>> testResults = [];
@ -769,8 +774,8 @@ class LabViewModel extends ChangeNotifier {
LoadingUtils.hideFullScreenLoader();
}
Future<void> getAiOverviewSingleLabResult({required String langId, required LabResult recentLabResult}) async {
LoaderBottomSheet.showLoader();
Future<void> getAiOverviewSingleLabResult({required String langId, required LabResult recentLabResult, required String loadingText}) async {
LoaderBottomSheet.showLoader(loadingText: loadingText);
List<Map<String, dynamic>> results = [];
results.add({
"Description": recentLabResult.description ?? '',

@ -193,8 +193,8 @@ class PrescriptionsRepoImp implements PrescriptionsRepo {
"ProjectID": prescriptionsResponseModel.projectID,
"DischargeNo": prescriptionsResponseModel.dischargeNo,
"IsDownload": true,
// "To": Utils.appState.getAuthenticatedUser()!.emailAddress,
"To": "amjad.haroon@cloudsolutions.com.sa",
"To": Utils.appState.getAuthenticatedUser()!.emailAddress,
// "To": "amjad.haroon@cloudsolutions.com.sa",
"ClinicName": prescriptionsResponseModel.clinicDescription,
"DoctorName": prescriptionsResponseModel.doctorName,
};

@ -54,7 +54,7 @@ class PrescriptionsViewModel extends ChangeNotifier {
PrescriptionsViewModel({required this.prescriptionsRepo, required this.errorHandlerService, required this.navServices});
initPrescriptionsViewModel() {
if (isPrescriptionsDataNeedsReloading) {
// if (isPrescriptionsDataNeedsReloading) {
patientPrescriptionOrders.clear();
patientPrescriptionOrdersByClinic.clear();
patientPrescriptionOrdersByHospital.clear();
@ -62,7 +62,7 @@ class PrescriptionsViewModel extends ChangeNotifier {
prescriptionsOrderList.clear();
isPrescriptionsOrdersLoading = true;
getPatientPrescriptionOrders();
}
// }
isSortByClinic = true;
isPrescriptionsDeliveryOrdersLoading = true;
notifyListeners();
@ -102,9 +102,9 @@ class PrescriptionsViewModel extends ChangeNotifier {
}
Future<void> getPatientPrescriptionOrders({Function(dynamic)? onSuccess, Function(String)? onError}) async {
if (!isPrescriptionsDataNeedsReloading) {
return;
}
// if (!isPrescriptionsDataNeedsReloading) {
// return;
// }
final result = await prescriptionsRepo.getPatientPrescriptionOrders(patientId: "1231755");

@ -1513,8 +1513,6 @@ abstract class LocaleKeys {
static const trackerAndOthers = 'trackerAndOthers';
static const bmi = 'bmi';
static const yesPleaseINeedHelp = 'yesPleaseINeedHelp';
static const noThanksIKnowTheClinic = 'noThanksIKnowTheClinic';
static const unableToSendOTP = 'unableToSendOTP';
static const aiOverView = 'aiOverView';
static const generateAiAnalysis = 'generateAiAnalysis';
static const aiAnalysis = 'aiAnalysis';
@ -1562,5 +1560,8 @@ abstract class LocaleKeys {
static const servicePriceListRights = 'servicePriceListRights';
static const serviceName = 'serviceName';
static const noFreeSlot = 'noFreeSlot';
static const noThanksIKnowTheClinic = 'noThanksIKnowTheClinic';
static const unableToSendOTP = 'unableToSendOTP';
static const loadingAIAnalysis = 'loadingAIAnalysis';
}

@ -491,6 +491,7 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel,
onSuccess: (apiResponse) {
Future.delayed(Duration(milliseconds: 500), () {
myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
myAppointmentsViewModel.initAppointmentsViewModel();
myAppointmentsViewModel.getPatientAppointments(true, false);
LoaderBottomSheet.hideLoader();
@ -511,6 +512,7 @@ class _AppointmentPaymentPageState extends State<AppointmentPaymentPage> {
isFollowUp: myAppointmentsViewModel.patientAppointmentShareResponseModel!.isFollowup!,
onSuccess: (apiResponse) {
Future.delayed(Duration(milliseconds: 500), () {
myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
myAppointmentsViewModel.initAppointmentsViewModel();
myAppointmentsViewModel.getPatientAppointments(true, false);
LoaderBottomSheet.hideLoader();

@ -193,7 +193,7 @@ class AppointmentCard extends StatelessWidget {
? 'Cardiology'.toText10().toShimmer2(isShow: isLoading)
: "${DateUtil.formatDateToDate(DateUtil.convertStringToDate(patientAppointmentHistoryResponseModel.appointmentDate), false)} ${DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(patientAppointmentHistoryResponseModel.appointmentDate), false)}"
.toText10(isEnglishOnly: true),
),
).toShimmer2(isShow: isLoading),
),
// AppCustomChipWidget(

@ -87,7 +87,10 @@ class HabibWalletCard extends StatelessWidget {
fit: BoxFit.contain,
),
SizedBox(width: 8.h),
habibWalletVM.habibWalletAmount.toString().toText32(isBold: true, isEnglishOnly: true).toShimmer2(isShow: habibWalletVM.isWalletAmountLoading, radius: 12.h, width: 80.h, height: 40.h),
habibWalletVM.habibWalletAmount
.toString()
.toText32(isBold: true, isEnglishOnly: true)
.toShimmer2(isShow: habibWalletVM.isWalletAmountLoading, radius: 12.h, width: 80.h, height: 40.h),
],
);
}),

@ -50,7 +50,7 @@ class LabResultByClinic extends StatelessWidget {
cancelLabel: LocaleKeys.rejectView.tr(),
onOkPressed: () {
context.pop();
labViewModel.getAiOverviewLabOrders(labOrder: labOrder);
labViewModel.getAiOverviewLabOrders(labOrder: labOrder, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context));
},
onCancelPressed: () {
context.pop();

@ -62,6 +62,7 @@ class AiAnalysisWidget extends StatelessWidget {
SizedBox(height: 20.h),
],
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Icons.info_outline, color: AppColors.greyTextColor, size: 20.r),
SizedBox(width: 8.w),

@ -11,6 +11,7 @@ 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/buttons/custom_button.dart';
import 'package:provider/provider.dart';
import 'dart:ui' as ui;
class LabOrderResultItem extends StatelessWidget {
final VoidCallback onTap;
@ -43,49 +44,52 @@ class LabOrderResultItem extends StatelessWidget {
),
(tests!.packageShortDescription ?? "").toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight),
SizedBox(height: 12.h),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Flexible(
child: Text(
"${tests?.resultValue} ${tests?.uOM}",
style: TextStyle(
fontSize: 24.f,
fontWeight: FontWeight.w600,
fontFamily: 'Poppins',
color: tests!.checkIfGraphShouldBeDisplayed()
? context.read<LabViewModel>().getColor(
tests?.calculatedResultFlag ?? "",
)
: Colors.grey.shade700,
letterSpacing: -2,
),
),
),
SizedBox(width: 4.h,),
Visibility(
// visible: tests?.checkIfGraphShouldBeDisplayed() == true,
visible: true,
child: Expanded(
flex: 2,
child: Visibility(
visible: tests?.referanceRange != null,
Directionality(
textDirection: ui.TextDirection.ltr,
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Flexible(
child: Text(
"(${LocaleKeys.referenceRange.tr(context: context)}: ${tests?.referanceRange})",
"${tests?.resultValue} ${tests?.uOM}",
style: TextStyle(
fontSize: 12.f,
fontWeight: FontWeight.w500,
fontSize: 24.f,
fontWeight: FontWeight.w600,
fontFamily: 'Poppins',
color: AppColors.greyTextColor,
color: tests!.checkIfGraphShouldBeDisplayed()
? context.read<LabViewModel>().getColor(
tests?.calculatedResultFlag ?? "",
)
: Colors.grey.shade700,
letterSpacing: -2,
),
// overflow: TextOverflow.ellipsis,
// maxLines: 2,
softWrap: true,
),
),
),
)
],
SizedBox(width: 4.h,),
Visibility(
// visible: tests?.checkIfGraphShouldBeDisplayed() == true,
visible: true,
child: Expanded(
flex: 2,
child: Visibility(
visible: tests?.referanceRange != null,
child: Text(
"(${LocaleKeys.referenceRange.tr(context: context)}: ${tests?.referanceRange})",
style: TextStyle(
fontSize: 12.f,
fontWeight: FontWeight.w500,
fontFamily: 'Poppins',
color: AppColors.greyTextColor,
),
// overflow: TextOverflow.ellipsis,
// maxLines: 2,
softWrap: true,
),
),
),
)
],
),
),
SizedBox(height: 12.h),

@ -45,7 +45,7 @@ class LabResultDetails extends StatelessWidget {
cancelLabel: LocaleKeys.rejectView.tr(),
onOkPressed: () {
context.pop();
labViewModel.getAiOverviewSingleLabResult(langId: appState.getLanguageID().toString(), recentLabResult: recentLabResult);
labViewModel.getAiOverviewSingleLabResult(langId: appState.getLanguageID().toString(), recentLabResult: recentLabResult, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context));
},
onCancelPressed: () {
context.pop();

@ -341,7 +341,7 @@ class _LabAiAnalysisDetailedPageState extends State<LabAiAnalysisDetailedPage> {
case 'high':
return AppColors.primaryRedColor;
case 'medium' || 'moderate':
return AppColors.lightGreenColor;
return AppColors.textGreenColor;
case 'low':
return AppColors.alertColor;
default:
@ -361,7 +361,7 @@ class _LabAiAnalysisDetailedPageState extends State<LabAiAnalysisDetailedPage> {
case 'L': // Low
case 'LL': // Very Low
case 'CRITICAL LOW':
return AppColors.chipColorSeekMedicalAdvice;
return AppColors.chipColorSeekMedicalAdvice.withAlpha(75);
case 'N': // Normal
return AppColors.lightGreenButtonColor;
case 'A': // Abnormal
@ -379,7 +379,7 @@ class _LabAiAnalysisDetailedPageState extends State<LabAiAnalysisDetailedPage> {
case 'CRITICAL HIGH':
return AppColors.primaryRedColor;
case 'N':
return AppColors.lightGreenColor;
return AppColors.textGreenColor;
case 'L': // Low
case 'LL': // Very Low
case 'CRITICAL LOW':

@ -155,26 +155,26 @@ class PrescriptionItemView extends StatelessWidget {
],
).paddingSymmetrical(16.h, 0.h),
SizedBox(height: 14.h),
Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
Row(
children: [
Expanded(
child: CustomButton(
text: LocaleKeys.checkAvailability.tr(context: context),
onPressed: () {},
backgroundColor: AppColors.primaryRedColor.withOpacity(0.1),
borderColor: AppColors.primaryRedColor.withOpacity(0.0),
textColor: AppColors.primaryRedColor,
fontSize: 14.f,
fontWeight: FontWeight.w500,
borderRadius: 12.r,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
).toShimmer2(isShow: isLoading),
),
// SizedBox(width: 16.h),
],
).paddingSymmetrical(16.h, 16.h),
// Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
// Row(
// children: [
// Expanded(
// child: CustomButton(
// text: LocaleKeys.checkAvailability.tr(context: context),
// onPressed: () {},
// backgroundColor: AppColors.primaryRedColor.withOpacity(0.1),
// borderColor: AppColors.primaryRedColor.withOpacity(0.0),
// textColor: AppColors.primaryRedColor,
// fontSize: 14.f,
// fontWeight: FontWeight.w500,
// borderRadius: 12.r,
// padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
// height: 40.h,
// ).toShimmer2(isShow: isLoading),
// ),
// // SizedBox(width: 16.h),
// ],
// ).paddingSymmetrical(16.h, 16.h),
],
),
);

@ -205,7 +205,8 @@ class PossibleConditionsPage extends StatelessWidget {
final SymptomsCheckerViewModel symptomsCheckerViewModel = context.read<SymptomsCheckerViewModel>();
symptomsCheckerViewModel.reset(); // Clear all symptoms checker data
final navigationService = getIt.get<NavigationService>();
navigationService.replaceAllRoutesAndNavigateToLanding();
// navigationService.replaceAllRoutesAndNavigateToLanding();
navigationService.replaceAllRoutesAndNavigateToLandingAuth();
},
),
trailing: _buildTrailingSection(context),

@ -89,7 +89,8 @@ class _SymptomsSelectorPageState extends State<SymptomsSelectorPage> {
context.pop();
viewModel.reset(); // Clear all symptoms checker data
final navigationService = getIt.get<NavigationService>();
navigationService.replaceAllRoutesAndNavigateToLanding();
// navigationService.replaceAllRoutesAndNavigateToLanding();
navigationService.replaceAllRoutesAndNavigateToLandingAuth();
}),
child: viewModel.isBodySymptomsLoading
? _buildLoadingShimmer()

@ -316,7 +316,8 @@ class _TriagePageState extends State<TriagePage> {
context.pop();
viewModel.reset(); // Clear all symptoms checker data
final navigationService = getIt.get<NavigationService>();
navigationService.replaceAllRoutesAndNavigateToLanding();
// navigationService.replaceAllRoutesAndNavigateToLanding();
navigationService.replaceAllRoutesAndNavigateToLandingAuth();
},
),
callBackFunc: () {},

@ -34,6 +34,13 @@ class NavigationService {
);
}
void replaceAllRoutesAndNavigateToLandingAuth() {
navigatorKey.currentState?.pushNamedAndRemoveUntil(
AppRoutes.landingScreen,
(Route<dynamic> route) => false,
);
}
void pushAndReplace(String routeName) {
navigatorKey.currentState?.pushReplacementNamed(routeName);
}

@ -4,9 +4,14 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/int_extensions.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/features/emergency_services/emergency_services_view_model.dart';
import 'package:hmg_patient_app_new/features/immediate_livecare/immediate_livecare_view_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart';
import 'package:hmg_patient_app_new/features/todo_section/todo_section_view_model.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/buttons/custom_button.dart';
import 'package:provider/provider.dart';
class AppLanguageChange extends StatefulWidget {
AppLanguageChange({Key? key}) : super(key: key);
@ -20,6 +25,11 @@ class AppLanguageChange extends StatefulWidget {
class _AppLanguageChangeState extends State<AppLanguageChange> {
String? selectedValue;
late MyAppointmentsViewModel myAppointmentsViewModel;
late ImmediateLiveCareViewModel immediateLiveCareViewModel;
late EmergencyServicesViewModel emergencyServicesViewModel;
late TodoSectionViewModel todoSectionViewModel;
@override
void initState() {
super.initState();
@ -33,6 +43,12 @@ class _AppLanguageChangeState extends State<AppLanguageChange> {
@override
Widget build(BuildContext context) {
selectedValue ??= context.locale.languageCode;
myAppointmentsViewModel = Provider.of<MyAppointmentsViewModel>(context, listen: false);
immediateLiveCareViewModel = Provider.of<ImmediateLiveCareViewModel>(context, listen: false);
emergencyServicesViewModel = Provider.of<EmergencyServicesViewModel>(context, listen: false);
todoSectionViewModel = Provider.of<TodoSectionViewModel>(context, listen: false);
return Column(
spacing: 24.h,
children: [
@ -51,6 +67,18 @@ class _AppLanguageChangeState extends State<AppLanguageChange> {
text: LocaleKeys.save.tr(context: context),
onPressed: () {
context.setLocale(selectedValue == 'en' ? Locale('en', 'US') : Locale('ar', 'SA')).then((val) {
//Reload My Appointments Data
myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
myAppointmentsViewModel.initAppointmentsViewModel();
myAppointmentsViewModel.getPatientAppointments(true, false);
//Reload Immediate LiveCare Data
immediateLiveCareViewModel.initImmediateLiveCare();
immediateLiveCareViewModel.getPatientLiveCareHistory();
//Reload Emergency Services Data
emergencyServicesViewModel.checkPatientERAdvanceBalance();
Navigator.pop(context);
});
}),

@ -310,7 +310,7 @@ class _ScrollAnimatedTitleState extends State<ScrollAnimatedTitle> {
child: Container(
height: 40.h,
padding: EdgeInsets.all(8.w),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.transparent, borderRadius: 10.r, side: BorderSide(width: 1, color: AppColors.borderGrayColor)),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 8.r, side: BorderSide(width: 1, color: AppColors.borderGrayColor)),
child: ShaderMask(
blendMode: BlendMode.srcIn,
shaderCallback: (bounds) => AppColors.aiLinearGradient.createShader(bounds),
@ -326,7 +326,7 @@ class _ScrollAnimatedTitleState extends State<ScrollAnimatedTitle> {
style: context.dynamicTextStyle(
color: AppColors.primaryRedColor,
letterSpacing: -0.4,
fontSize: (12 - (2 * (1 - t))).f,
fontSize: (14 - (2 * (1 - t))).f,
fontWeight: FontWeight.lerp(
FontWeight.w400,
FontWeight.w500,

@ -59,14 +59,15 @@ class _LanguageSelectorState extends State<LanguageSelector> {
Utils.buildSvgWithAssets(icon: AppAssets.language),
SizedBox(width: 6.h),
Text(
currentLangData['name']?.toUpperCase() ?? 'EN',
// currentLangData['name']?.toUpperCase() ?? 'EN',
widget.currentLanguage == 'ar' ? "ENGLISH" : "العربية",
style: context.dynamicTextStyle(
fontWeight: FontWeight.w500,
fontSize: 14.f,
color: AppColors.primaryRedColor,
letterSpacing: 0.1,
isLanguageSwitcher: true,
),
fontFamily: widget.currentLanguage == 'ar' ? "Poppins" : "GESSTwo"),
),
],
),

@ -3,7 +3,9 @@ import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
class LoaderBottomSheet {
@ -31,7 +33,7 @@ class LoaderBottomSheet {
),
child: Center(
child: Utils.getLoadingWidget(loadingText: loadingText),
),
).paddingSymmetrical(24.w, 0),
);
},
).whenComplete(() {

Loading…
Cancel
Save