pull/199/head
haroon amjad 10 hours ago
parent 4a3d66f01a
commit 1709b80e84

@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18.5 7.5C18.5 8.60457 17.6046 9.5 16.5 9.5C15.3954 9.5 14.5 8.60457 14.5 7.5C14.5 6.39543 15.3954 5.5 16.5 5.5C17.6046 5.5 18.5 6.39543 18.5 7.5Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9255 1.5H12.0745C14.2504 1.49998 15.9852 1.49996 17.3453 1.68282C18.7497 1.87164 19.9035 2.27175 20.8159 3.18414C21.7283 4.09653 22.1284 5.25033 22.3172 6.65471C22.5 8.01485 22.5 9.74959 22.5 11.9256V12.0744C22.5 14.2504 22.5 15.9851 22.3172 17.3453C22.1284 18.7497 21.7283 19.9035 20.8159 20.8159C19.9035 21.7283 18.7497 22.1284 17.3453 22.3172C15.9851 22.5 14.2504 22.5 12.0744 22.5H11.9256C9.74959 22.5 8.01485 22.5 6.65471 22.3172C5.25033 22.1284 4.09653 21.7283 3.18414 20.8159C2.27175 19.9035 1.87164 18.7497 1.68282 17.3453C1.49996 15.9852 1.49998 14.2504 1.5 12.0745V11.9255C1.49998 9.74958 1.49996 8.01484 1.68282 6.65471C1.87164 5.25033 2.27175 4.09653 3.18414 3.18414C4.09653 2.27175 5.25033 1.87164 6.65471 1.68282C8.01485 1.49996 9.74958 1.49998 11.9255 1.5ZM6.92121 3.66499C5.73861 3.82399 5.0772 4.1195 4.59835 4.59835C4.1195 5.0772 3.82399 5.73861 3.66499 6.92121C3.50213 8.13258 3.5 9.73256 3.5 12C3.5 12.2688 3.50003 12.5282 3.50036 12.7786C3.78795 12.7608 4.07624 12.7521 4.36474 12.7527C7.17775 12.6952 9.92747 13.572 12.124 15.2364C13.9124 16.5915 15.2416 18.3991 15.9596 20.4377C16.3674 20.4138 16.7385 20.3808 17.0788 20.335C17.2221 20.3157 17.3578 20.2945 17.4864 20.2711C16.9795 18.6882 16.1544 17.2258 15.0687 15.9582C14.8393 15.6904 14.9291 15.27 15.2648 15.1622C16.122 14.887 16.9998 14.7468 17.8878 14.7501C18.7607 14.7494 19.6259 14.889 20.4723 15.162C20.4994 14.2767 20.5 13.2378 20.5 12C20.5 9.73256 20.4979 8.13258 20.335 6.92121C20.176 5.73861 19.8805 5.0772 19.4017 4.59835C18.9228 4.1195 18.2614 3.82399 17.0788 3.66499C15.8674 3.50213 14.2674 3.5 12 3.5C9.73256 3.5 8.13258 3.50213 6.92121 3.66499Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -1589,5 +1589,7 @@
"insuranceRequestSubmittedSuccessfully": "تم إرسال طلب تحديث بيانات التأمين بنجاح. سيتم إعلامك بمجرد الانتهاء.",
"updatingEmailAddress": "جارٍ تحديث عنوان البريد الإلكتروني، يرجى الانتظار...",
"verifyInsurance": "التحقق من التأمين",
"tests": "تحليل"
"tests": "تحليل",
"calendarPermissionAlert": "يرجى منح إذن الوصول إلى التقويم من إعدادات التطبيق لضبط تذكير تناول الدواء.",
"sortByLocation": "الترتيب حسب الموقع"
}

@ -1583,5 +1583,7 @@
"insuranceRequestSubmittedSuccessfully": "Your insurance update request has been successfully submitted. You will be notified once completed.",
"updatingEmailAddress": "Updating email address, Please wait...",
"verifyInsurance": "Verify Insurance",
"tests": "tests"
"tests": "tests",
"calendarPermissionAlert": "Please grant calendar access permission from app settings to set medication reminder.",
"sortByLocation": "Sort by location"
}

@ -336,6 +336,7 @@ class AppAssets {
static const String aiOverView = '$svgBasePath/ai_overview.svg';
static const String darkModeIcon = '$svgBasePath/dark_mode_icon.svg';
static const String biometricLockIcon = '$svgBasePath/biometric_lock_icon.svg';
static const String imageIcon = '$svgBasePath/image_icon.svg';
// PNGS //
static const String hmgLogo = '$pngBasePath/hmg_logo.png';

@ -94,7 +94,27 @@ class LocationUtils {
permissionGranted = await Geolocator.requestPermission();
if (permissionGranted != LocationPermission.whileInUse && permissionGranted != LocationPermission.always) {
appState.resetLocation();
onFailure?.call();
if (onFailure == null && isShowConfirmDialog) {
showCommonBottomSheetWithoutHeight(
title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!),
navigationService.navigatorKey.currentContext!,
child: Utils.getWarningWidget(
loadingText: "Please grant location permission from app settings to see better results",
isShowActionButtons: true,
onCancelTap: () {
navigationService.pop();
},
onConfirmTap: () async {
navigationService.pop();
openAppSettings();
}),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
} else {
onFailure?.call();
}
return;
}
} else if (permissionGranted == LocationPermission.deniedForever) {

@ -1,9 +1,16 @@
import 'dart:async';
import 'package:device_calendar_plus/device_calendar_plus.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:get_it/get_it.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
import 'package:jiffy/jiffy.dart' show Jiffy;
import 'package:manage_calendar_events/manage_calendar_events.dart' hide Calendar;
import 'package:permission_handler/permission_handler.dart';
class CalenderUtilsNew {
final DeviceCalendar calender = DeviceCalendar.instance;
@ -17,7 +24,26 @@ class CalenderUtilsNew {
Future<void> getCalenders() async {
CalendarPermissionStatus result = await DeviceCalendar.instance.hasPermissions();
if (result != CalendarPermissionStatus.granted) await DeviceCalendar.instance.requestPermissions();
if (result != CalendarPermissionStatus.granted) {
// await DeviceCalendar.instance.requestPermissions();
showCommonBottomSheetWithoutHeight(
title: LocaleKeys.notice.tr(context: GetIt.instance<NavigationService>().navigatorKey.currentContext!),
GetIt.instance<NavigationService>().navigatorKey.currentContext!,
child: Utils.getWarningWidget(
loadingText: LocaleKeys.calendarPermissionAlert.tr(),
isShowActionButtons: true,
onCancelTap: () {
GetIt.instance<NavigationService>().pop();
},
onConfirmTap: () async {
GetIt.instance<NavigationService>().pop();
openAppSettings();
}),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
}
var calenders = await calender.listCalendars();
calenders.forEach((calender) {
if (!calender.readOnly) {

@ -12,6 +12,7 @@ import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_p
import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_status_coc_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
import 'package:permission_handler/permission_handler.dart';
class ContactUsViewModel extends ChangeNotifier {
ContactUsRepo contactUsRepo;
@ -22,6 +23,7 @@ class ContactUsViewModel extends ChangeNotifier {
bool isHMGHospitalsListSelected = true;
bool isLiveChatProjectsListLoading = false;
bool isSendFeedbackTabSelected = true;
bool hasLocationEnabled = false;
List<GetHMGLocationsModel> hmgHospitalsLocationsList = [];
List<GetHMGLocationsModel> hmgPharmacyLocationsList = [];
@ -52,11 +54,12 @@ class ContactUsViewModel extends ChangeNotifier {
ContactUsViewModel({required this.contactUsRepo, required this.errorHandlerService, required this.appState});
initContactUsViewModel() {
initContactUsViewModel() async {
isHMGLocationsListLoading = true;
isHMGHospitalsListSelected = true;
isLiveChatProjectsListLoading = true;
isCOCItemsListLoading = true;
hasLocationEnabled = false;
hmgHospitalsLocationsList.clear();
hmgPharmacyLocationsList.clear();
liveChatProjectsList.clear();
@ -65,6 +68,18 @@ class ContactUsViewModel extends ChangeNotifier {
selectedFeedbackType = FeedbackType(id: 5, nameEN: "Not classified", nameAR: 'غير محدد');
setPatientFeedbackSelectedAppointment(null);
getHMGLocations();
if (await Permission.location.isGranted) {
setHasLocationEnabled(true);
} else {
setHasLocationEnabled(false);
}
notifyListeners();
}
setHasLocationEnabled(bool hasLocationEnabled) {
this.hasLocationEnabled = hasLocationEnabled;
notifyListeners();
}
@ -128,6 +143,19 @@ class ContactUsViewModel extends ChangeNotifier {
hmgPharmacyLocationsList.add(location);
}
}
if (hmgHospitalsLocationsList.first.distanceInKilometers != 0) {
hmgHospitalsLocationsList.sort((a, b) => a.distanceInKilometers.compareTo(b.distanceInKilometers));
} else {
hmgHospitalsLocationsList.sort((a, b) => a.locationName!.compareTo(b.locationName!));
}
if (hmgPharmacyLocationsList.first.distanceInKilometers != 0) {
hmgPharmacyLocationsList.sort((a, b) => a.distanceInKilometers.compareTo(b.distanceInKilometers));
} else {
hmgPharmacyLocationsList.sort((a, b) => a.locationName!.compareTo(b.locationName!));
}
isHMGLocationsListLoading = false;
notifyListeners();
if (onSuccess != null) {

@ -163,7 +163,7 @@ class PrescriptionsViewModel extends ChangeNotifier {
} else if (apiResponse.messageStatus == 1) {
prescriptionDetailsList = apiResponse.data!;
prescriptionDetailsList.forEach((element) async {
await checkIfReminderExistForPrescription(prescriptionDetailsList.indexOf(element));
// await checkIfReminderExistForPrescription(prescriptionDetailsList.indexOf(element));
});
isPrescriptionsDetailsLoading = false;
notifyListeners();

@ -68,17 +68,17 @@ class RadiologyViewModel extends ChangeNotifier {
filteredRadiologyOrders = List.from(patientRadiologyOrders);
tempRadiologyOrders = [...patientRadiologyOrders];
final clinicMap = <String, List<PatientRadiologyResponseModel>>{};
final hospitalMap = <String, List<PatientRadiologyResponseModel>>{};
for (var order in patientRadiologyOrders) {
final clinicKey = (order.clinicDescription ?? 'Unknown').trim();
clinicMap.putIfAbsent(clinicKey, () => []).add(order);
final hospitalKey = (order.projectName ?? order.projectID ?? 'Unknown').toString().trim();
hospitalMap.putIfAbsent(hospitalKey, () => []).add(order);
}
patientRadiologyOrdersByClinic = clinicMap.values.toList();
patientRadiologyOrdersByHospital = hospitalMap.values.toList();
patientRadiologyOrdersViewList = isSortByClinic ? patientRadiologyOrdersByClinic : patientRadiologyOrdersByHospital;
// final clinicMap = <String, List<PatientRadiologyResponseModel>>{};
// final hospitalMap = <String, List<PatientRadiologyResponseModel>>{};
// for (var order in patientRadiologyOrders) {
// final clinicKey = (order.clinicDescription ?? 'Unknown').trim();
// clinicMap.putIfAbsent(clinicKey, () => []).add(order);
// final hospitalKey = (order.projectName ?? order.projectID ?? 'Unknown').toString().trim();
// hospitalMap.putIfAbsent(hospitalKey, () => []).add(order);
// }
// patientRadiologyOrdersByClinic = clinicMap.values.toList();
// patientRadiologyOrdersByHospital = hospitalMap.values.toList();
// patientRadiologyOrdersViewList = isSortByClinic ? patientRadiologyOrdersByClinic : patientRadiologyOrdersByHospital;
isRadiologyOrdersLoading = false;
filterSuggestions();
@ -173,7 +173,7 @@ class RadiologyViewModel extends ChangeNotifier {
}
filterSuggestions() {
final List<String> labels = patientRadiologyOrders.map((detail) => detail.description).whereType<String>().toList();
final List<String> labels = patientRadiologyOrders.map((detail) => detail.procedureName.toString().trim()).whereType<String>().toList();
_radiologySuggestionsList = labels.toSet().toList();
notifyListeners();
}
@ -193,7 +193,7 @@ class RadiologyViewModel extends ChangeNotifier {
patientRadiologyOrdersByHospital = hospitalMap.values.toList();
patientRadiologyOrdersViewList = isSortByClinic ? patientRadiologyOrdersByClinic : patientRadiologyOrdersByHospital;
} else {
filteredRadiologyOrders = filteredRadiologyOrders.where((desc) => (desc.description ?? "").toLowerCase().contains(query.toLowerCase())).toList();
filteredRadiologyOrders = filteredRadiologyOrders.where((desc) => (desc.procedureName ?? "").toLowerCase().contains(query.toLowerCase())).toList();
final clinicMap = <String, List<PatientRadiologyResponseModel>>{};
final hospitalMap = <String, List<PatientRadiologyResponseModel>>{};
@ -206,6 +206,8 @@ class RadiologyViewModel extends ChangeNotifier {
patientRadiologyOrdersByClinic = clinicMap.values.toList();
patientRadiologyOrdersByHospital = hospitalMap.values.toList();
patientRadiologyOrdersViewList = isSortByClinic ? patientRadiologyOrdersByClinic : patientRadiologyOrdersByHospital;
patientRadiologyOrders = filteredRadiologyOrders;
}
notifyListeners();
}

@ -1584,5 +1584,7 @@ abstract class LocaleKeys {
static const updatingEmailAddress = 'updatingEmailAddress';
static const verifyInsurance = 'verifyInsurance';
static const tests = 'tests';
static const calendarPermissionAlert = 'calendarPermissionAlert';
static const sortByLocation = 'sortByLocation';
}

@ -57,6 +57,7 @@ class ContactUs extends StatelessWidget {
),
);
}, onFailure: () {
contactUsViewModel.initContactUsViewModel();
Navigator.pop(context);
Navigator.of(context).push(
CustomPageRoute(
@ -64,6 +65,7 @@ class ContactUs extends StatelessWidget {
),
);
}, onLocationDeniedForever: () {
contactUsViewModel.initContactUsViewModel();
Navigator.pop(context);
Navigator.of(context).push(
CustomPageRoute(

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/location_util.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
@ -20,15 +21,27 @@ class FindUsPage extends StatelessWidget {
late AppState appState;
late ContactUsViewModel contactUsViewModel;
late LocationUtils locationUtils;
@override
Widget build(BuildContext context) {
contactUsViewModel = Provider.of<ContactUsViewModel>(context);
appState = getIt.get<AppState>();
locationUtils = getIt.get<LocationUtils>();
locationUtils.isShowConfirmDialog = true;
return Scaffold(
backgroundColor: AppColors.bgScaffoldColor,
body: CollapsingListView(
title: LocaleKeys.location.tr(),
location: contactUsViewModel.hasLocationEnabled
? null
: () {
locationUtils.getCurrentLocation(
onSuccess: (value) {
contactUsViewModel.initContactUsViewModel();
},
onFailure: () {},);
},
child: Consumer<ContactUsViewModel>(builder: (context, contactUsVM, child) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,

@ -69,13 +69,15 @@ class FindUsItemCard extends StatelessWidget {
Widget get distanceInfo => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AppCustomChipWidget(
labelText: "${getHMGLocationsModel.distanceInKilometers ?? ""} km",
icon: AppAssets.location_red,
getHMGLocationsModel.distanceInKilometers != 0
? AppCustomChipWidget(
labelText: "${getHMGLocationsModel.distanceInKilometers ?? ""} km",
icon: AppAssets.location_red,
iconColor: AppColors.primaryRedColor,
backgroundColor: AppColors.secondaryLightRedColor,
textColor: AppColors.errorColor,
),
)
: SizedBox.shrink(),
Row(
children: [
AppCustomChipWidget(

File diff suppressed because one or more lines are too long

@ -4,6 +4,8 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
@ -63,8 +65,9 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
Expanded(
child: CollapsingListView(
title: LocaleKeys.prescriptions.tr(context: context),
instructions: () async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionPDFPleaseWait.tr(context: context));
instructions: widget.prescriptionsResponseModel.isInOutPatient!
? () async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionPDFPleaseWait.tr(context: context));
await prescriptionsViewModel.getPrescriptionInstructionsPDF(widget.prescriptionsResponseModel, onSuccess: (val) {
LoaderBottomSheet.hideLoader();
if (prescriptionsViewModel.prescriptionInstructionsPDFLink.isNotEmpty) {
@ -89,7 +92,8 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
isCloseButtonVisible: true,
);
});
},
}
: null,
child: SingleChildScrollView(
child: Consumer<PrescriptionsViewModel>(builder: (context, prescriptionVM, child) {
return Column(
@ -107,6 +111,13 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppCustomChipWidget(
labelText:
"${getIt.get<AppState>().isArabic() ? widget.prescriptionsResponseModel.isInOutPatientDescriptionN : widget.prescriptionsResponseModel.isInOutPatientDescription}",
backgroundColor: widget.prescriptionsResponseModel.isInOutPatient! ? AppColors.primaryRedColor.withOpacity(0.1) : AppColors.warningColorYellow.withOpacity(0.1),
textColor: widget.prescriptionsResponseModel.isInOutPatient! ? AppColors.primaryRedColor : AppColors.warningColorYellow,
),
SizedBox(height: 16.h),
Row(
mainAxisSize: MainAxisSize.min,
children: [
@ -241,7 +252,7 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
});
}
},
backgroundColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.greyF7Color,
backgroundColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.15),
borderColor: AppColors.successColor.withOpacity(0.01),
textColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? Colors.white : AppColors.textColor.withOpacity(0.35),
fontSize: 16,

@ -103,55 +103,60 @@ class PrescriptionItemView extends StatelessWidget {
Switch(
activeColor: AppColors.successColor,
activeTrackColor: AppColors.successColor.withValues(alpha: .15),
value: isLoading ? false : prescriptionVM.prescriptionDetailsList[index].hasReminder!,
// value: isLoading ? false : prescriptionVM.prescriptionDetailsList[index].hasReminder!,
value: prescriptionVM.prescriptionDetailsList[index].hasReminder!,
onChanged: (newValue) async {
CalenderUtilsNew calender = CalenderUtilsNew.instance;
if (prescriptionVM.prescriptionDetailsList[index].hasReminder ?? false) {
LoaderBottomSheet.showLoader(loadingText: "Removing Reminders");
bool resultValue = await calender.checkAndRemoveMultipleItems(id: prescriptionVM.prescriptionDetailsList[index].itemID.toString());
if (await prescriptionVM.checkIfReminderExistForPrescription(index)) {
prescriptionVM.prescriptionDetailsList[index].hasReminder = true;
} else {
if (prescriptionVM.prescriptionDetailsList[index].hasReminder ?? false) {
LoaderBottomSheet.showLoader(loadingText: "Removing Reminders");
bool resultValue = await calender.checkAndRemoveMultipleItems(id: prescriptionVM.prescriptionDetailsList[index].itemID.toString());
prescriptionVM.setPrescriptionItemReminder(newValue, prescriptionVM.prescriptionDetailsList[index]);
LoaderBottomSheet.hideLoader();
return;
}
prescriptionVM.setPrescriptionItemReminder(newValue, prescriptionVM.prescriptionDetailsList[index]);
LoaderBottomSheet.hideLoader();
return;
}
DateTime startDate = DateTime.now();
DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionVM.prescriptionDetailsList[index].days!.toInt());
BottomSheetUtils().showReminderBottomSheet(
context,
endDate,
"",
prescriptionVM.prescriptionDetailsList[index].itemID.toString(),
"",
"",
title: "${prescriptionVM.prescriptionDetailsList[index].itemDescription} Prescription Reminder",
description:
"${prescriptionVM.prescriptionDetailsList[index].itemDescription} ${prescriptionVM.prescriptionDetailsList[index].frequency} ${prescriptionVM.prescriptionDetailsList[index].route} ",
onSuccess: () {},
isMultiAllowed: true,
onMultiDateSuccess: (int selectedIndex) async {
bool isEventAdded = await calender.createMultipleEvents(
reminderMinutes: selectedIndex,
frequencyNumber: prescriptionVM.prescriptionDetailsList[index].frequencyNumber?.toInt(),
days: prescriptionVM.prescriptionDetailsList[index].days!.toInt(),
orderDate: prescriptionVM.prescriptionDetailsList[index].orderDate!,
itemDescriptionN: prescriptionVM.prescriptionDetailsList[index].itemDescription!,
route: prescriptionVM.prescriptionDetailsList[index].route!,
onFailure: (errorMessage) => prescriptionVM.showError(errorMessage),
prescriptionNumber: prescriptionVM.prescriptionDetailsList[index].itemID.toString(),
);
prescriptionVM.setPrescriptionItemReminder(isEventAdded, prescriptionVM.prescriptionDetailsList[index]);
// setCalender(context,
// eventId: prescriptionVM.prescriptionDetailsList[index].itemID.toString(),
// selectedMinutes: selectedIndex,
// frequencyNumber: prescriptionVM.prescriptionDetailsList[index].frequencyNumber?.toInt(),
// days: prescriptionVM.prescriptionDetailsList[index].days!.toInt(),
// orderDate: prescriptionVM.prescriptionDetailsList[index].orderDate!,
// itemDescriptionN: prescriptionVM.prescriptionDetailsList[index].itemDescription!,
// route: prescriptionVM.prescriptionDetailsList[index].route!);
},
);
DateTime startDate = DateTime.now();
DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionVM.prescriptionDetailsList[index].days!.toInt());
BottomSheetUtils().showReminderBottomSheet(
context,
endDate,
"",
prescriptionVM.prescriptionDetailsList[index].itemID.toString(),
"",
"",
title: "${prescriptionVM.prescriptionDetailsList[index].itemDescription} Prescription Reminder",
description:
"${prescriptionVM.prescriptionDetailsList[index].itemDescription} ${prescriptionVM.prescriptionDetailsList[index].frequency} ${prescriptionVM.prescriptionDetailsList[index].route} ",
onSuccess: () {},
isMultiAllowed: true,
onMultiDateSuccess: (int selectedIndex) async {
bool isEventAdded = await calender.createMultipleEvents(
reminderMinutes: selectedIndex,
frequencyNumber: prescriptionVM.prescriptionDetailsList[index].frequencyNumber?.toInt(),
days: prescriptionVM.prescriptionDetailsList[index].days!.toInt(),
orderDate: prescriptionVM.prescriptionDetailsList[index].orderDate!,
itemDescriptionN: prescriptionVM.prescriptionDetailsList[index].itemDescription!,
route: prescriptionVM.prescriptionDetailsList[index].route!,
onFailure: (errorMessage) => prescriptionVM.showError(errorMessage),
prescriptionNumber: prescriptionVM.prescriptionDetailsList[index].itemID.toString(),
);
prescriptionVM.setPrescriptionItemReminder(isEventAdded, prescriptionVM.prescriptionDetailsList[index]);
// setCalender(context,
// eventId: prescriptionVM.prescriptionDetailsList[index].itemID.toString(),
// selectedMinutes: selectedIndex,
// frequencyNumber: prescriptionVM.prescriptionDetailsList[index].frequencyNumber?.toInt(),
// days: prescriptionVM.prescriptionDetailsList[index].days!.toInt(),
// orderDate: prescriptionVM.prescriptionDetailsList[index].orderDate!,
// itemDescriptionN: prescriptionVM.prescriptionDetailsList[index].itemDescription!,
// route: prescriptionVM.prescriptionDetailsList[index].route!);
},
);
}
},
).toShimmer2(isShow: isLoading),
],

@ -69,52 +69,52 @@ class _PrescriptionsListPageState extends State<PrescriptionsListPage> {
children: [
SizedBox(height: 16.h),
// Clinic & Hospital Sort
Row(
children: [
CustomButton(
text: LocaleKeys.byClinic.tr(context: context),
onPressed: () {
model.setIsSortByClinic(true);
},
backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor,
borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2),
textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor,
fontSize: 12,
fontWeight: FontWeight.w500,
borderRadius: 10,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
),
SizedBox(width: 8.h),
CustomButton(
text: LocaleKeys.byHospital.tr(context: context),
onPressed: () {
model.setIsSortByClinic(false);
},
backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor,
borderColor: model.isSortByClinic ? AppColors.textColor.withOpacity(0.2) : AppColors.primaryRedColor,
textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor,
fontSize: 12,
fontWeight: FontWeight.w500,
borderRadius: 10,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
),
],
).paddingSymmetrical(24.h, 0.h),
SizedBox(height: 20.h),
// Row(
// children: [
// CustomButton(
// text: LocaleKeys.byClinic.tr(context: context),
// onPressed: () {
// model.setIsSortByClinic(true);
// },
// backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor,
// borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2),
// textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor,
// fontSize: 12,
// fontWeight: FontWeight.w500,
// borderRadius: 10,
// padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
// height: 40.h,
// ),
// SizedBox(width: 8.h),
// CustomButton(
// text: LocaleKeys.byHospital.tr(context: context),
// onPressed: () {
// model.setIsSortByClinic(false);
// },
// backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor,
// borderColor: model.isSortByClinic ? AppColors.textColor.withOpacity(0.2) : AppColors.primaryRedColor,
// textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor,
// fontSize: 12,
// fontWeight: FontWeight.w500,
// borderRadius: 10,
// padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
// height: 40.h,
// ),
// ],
// ).paddingSymmetrical(24.h, 0.h),
// SizedBox(height: 20.h),
// Expandable list
ListView.builder(
itemCount: model.isPrescriptionsOrdersLoading
? 4
: model.patientPrescriptionOrders.isNotEmpty
? model.patientPrescriptionOrdersViewList.length
? model.patientPrescriptionOrders.length
: 1,
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: const EdgeInsets.only(left: 0, right: 8),
itemBuilder: (context, index) {
final isExpanded = expandedIndex == index;
// final isExpanded = expandedIndex == index;
return model.isPrescriptionsOrdersLoading
? LabResultItemView(
onTap: () {},
@ -134,180 +134,416 @@ class _PrescriptionsListPageState extends State<PrescriptionsListPage> {
curve: Curves.easeInOut,
margin: EdgeInsets.symmetric(vertical: 8.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true),
child: InkWell(
onTap: () {
setState(() {
expandedIndex = isExpanded ? null : index;
});
},
child: Container(
key: ValueKey<int>(index),
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 16.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.all(16.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CustomButton(
text: "${model.patientPrescriptionOrdersViewList[index].prescriptionsList!.length} Prescriptions Available",
onPressed: () {},
backgroundColor: AppColors.greyColor,
borderColor: AppColors.greyColor,
textColor: AppColors.blackColor,
fontSize: 10,
fontWeight: FontWeight.w500,
borderRadius: 8,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 30.h,
),
Icon(isExpanded ? Icons.expand_less : Icons.expand_more),
],
AppCustomChipWidget(
labelText:
"${getIt.get<AppState>().isArabic() ? model.patientPrescriptionOrders[index].isInOutPatientDescriptionN : model.patientPrescriptionOrders[index].isInOutPatientDescription}",
backgroundColor:
model.patientPrescriptionOrders[index].isInOutPatient! ? AppColors.primaryRedColor.withOpacity(0.1) : AppColors.warningColorYellow.withOpacity(0.1),
textColor: model.patientPrescriptionOrders[index].isInOutPatient! ? AppColors.primaryRedColor : AppColors.warningColorYellow,
),
SizedBox(height: 16.h),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Image.network(
model.patientPrescriptionOrders[index].doctorImageURL!,
width: 24.h,
height: 24.h,
fit: BoxFit.fill,
).circle(100),
SizedBox(width: 8.h),
Expanded(child: model.patientPrescriptionOrders[index].doctorName!.toText14(weight: FontWeight.w500)),
],
),
SizedBox(height: 8.h),
Wrap(
direction: Axis.horizontal,
spacing: 6.h,
runSpacing: 6.h,
children: [
Directionality(
textDirection: ui.TextDirection.ltr,
child: AppCustomChipWidget(
labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(model.patientPrescriptionOrders[index].appointmentDate), false),
isEnglishOnly: true,
),
SizedBox(height: 8.h),
(model.patientPrescriptionOrdersViewList[index].filterName ?? "").toText16(isBold: true)
],
),
),
AppCustomChipWidget(
labelText: model.patientPrescriptionOrders[index].name,
),
AppCustomChipWidget(
labelText: model.patientPrescriptionOrders[index].clinicDescription!,
),
],
),
AnimatedSwitcher(
duration: Duration(milliseconds: 500),
switchInCurve: Curves.easeIn,
switchOutCurve: Curves.easeOut,
transitionBuilder: (Widget child, Animation<double> animation) {
return FadeTransition(
opacity: animation,
child: SizeTransition(
sizeFactor: animation,
axisAlignment: 0.0,
child: child,
SizedBox(height: 8.h),
Row(
children: [
Expanded(
flex: 6,
child: CustomButton(
text: model.patientPrescriptionOrders[index].isHomeMedicineDeliverySupported!
? LocaleKeys.resendOrder.tr(context: context)
: LocaleKeys.prescriptionDeliveryError.tr(context: context),
onPressed: () async {
if (model.patientPrescriptionOrders[index].isHomeMedicineDeliverySupported!) {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionDetails.tr(context: context));
await prescriptionsViewModel.getPrescriptionDetails(prescriptionsViewModel.patientPrescriptionOrders[index], onSuccess: (val) {
LoaderBottomSheet.hideLoader();
prescriptionsViewModel.initiatePrescriptionDelivery();
});
}
},
backgroundColor: model.patientPrescriptionOrders[index].isHomeMedicineDeliverySupported!
? AppColors.successColor.withOpacity(0.15)
: AppColors.textColor.withOpacity(0.15),
borderColor: AppColors.successColor.withOpacity(0.01),
textColor: model.patientPrescriptionOrders[index].isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35),
fontSize: model.patientPrescriptionOrders[index].isHomeMedicineDeliverySupported! ? 14.f : 12.f,
fontWeight: FontWeight.w500,
borderRadius: 12.r,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
icon: AppAssets.prescription_refill_icon,
iconColor: model.patientPrescriptionOrders[index].isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35),
iconSize: 16.h,
),
);
},
child: isExpanded
? Container(
key: ValueKey<int>(index),
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...model.patientPrescriptionOrdersViewList[index].prescriptionsList!.map((prescription) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisSize: MainAxisSize.min,
children: [
Image.network(
prescription.doctorImageURL!,
width: 24.h,
height: 24.h,
fit: BoxFit.fill,
).circle(100),
SizedBox(width: 8.h),
Expanded(child: prescription.doctorName!.toText14(weight: FontWeight.w500)),
],
),
SizedBox(height: 8.h),
Wrap(
direction: Axis.horizontal,
spacing: 6.h,
runSpacing: 6.h,
children: [
Directionality(
textDirection: ui.TextDirection.ltr,
child: AppCustomChipWidget(
labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(prescription.appointmentDate), false), isEnglishOnly: true,
),
),
AppCustomChipWidget(
labelText: model.isSortByClinic ? prescription.name ?? "" : prescription.clinicDescription!,
),
],
),
SizedBox(height: 8.h),
Row(
children: [
Expanded(
flex: 6,
child: CustomButton(
text: prescription.isHomeMedicineDeliverySupported!
? LocaleKeys.resendOrder.tr(context: context)
: LocaleKeys.prescriptionDeliveryError.tr(context: context),
onPressed: () async {
if (prescription.isHomeMedicineDeliverySupported!) {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionDetails.tr(context: context));
await prescriptionsViewModel.getPrescriptionDetails(prescriptionsViewModel.patientPrescriptionOrders[index],
onSuccess: (val) {
LoaderBottomSheet.hideLoader();
prescriptionsViewModel.initiatePrescriptionDelivery();
});
}
},
backgroundColor:
prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor.withOpacity(0.15) : AppColors.greyF7Color,
borderColor: AppColors.successColor.withOpacity(0.01),
textColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35),
fontSize: prescription.isHomeMedicineDeliverySupported! ? 14.f : 12.f,
fontWeight: FontWeight.w500,
borderRadius: 12.r,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
icon: AppAssets.prescription_refill_icon,
iconColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35),
iconSize: 16.h,
),
),
SizedBox(width: 8.h),
Expanded(
flex: 1,
child: Container(
height: 40.h,
width: 40.w,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.textColor,
borderRadius: 12,
),
child: Padding(
padding: EdgeInsets.all(12.h),
child: Transform.flip(
flipX: appState.isArabic(),
child: Utils.buildSvgWithAssets(
icon: AppAssets.forward_arrow_icon_small,
iconColor: AppColors.whiteColor,
fit: BoxFit.contain,
),
),
),
).onPress(() {
model.setPrescriptionsDetailsLoading();
Navigator.of(context).push(
CustomPageRoute(
page: PrescriptionDetailPage(
prescriptionsResponseModel: prescription,
isFromAppointments: false,
),
),
);
}),
),
],
),
SizedBox(height: 12.h),
Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
SizedBox(height: 12.h),
],
);
}).toList(),
],
),
SizedBox(width: 8.h),
Expanded(
flex: 1,
child: Container(
height: 40.h,
width: 40.w,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.textColor,
borderRadius: 12,
),
child: Padding(
padding: EdgeInsets.all(12.h),
child: Transform.flip(
flipX: appState.isArabic(),
child: Utils.buildSvgWithAssets(
icon: AppAssets.forward_arrow_icon_small,
iconColor: AppColors.whiteColor,
fit: BoxFit.contain,
),
),
),
).onPress(() {
model.setPrescriptionsDetailsLoading();
Navigator.of(context).push(
CustomPageRoute(
page: PrescriptionDetailPage(
prescriptionsResponseModel: model.patientPrescriptionOrders[index],
isFromAppointments: false,
),
),
)
: SizedBox.shrink(),
);
}),
),
],
),
// SizedBox(height: 12.h),
// Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
// SizedBox(height: 12.h),
],
),
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// ...model.patientPrescriptionOrders.map((prescription) {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// Image.network(
// prescription.doctorImageURL!,
// width: 24.h,
// height: 24.h,
// fit: BoxFit.fill,
// ).circle(100),
// SizedBox(width: 8.h),
// Expanded(child: prescription.doctorName!.toText14(weight: FontWeight.w500)),
// ],
// ),
// SizedBox(height: 8.h),
// Wrap(
// direction: Axis.horizontal,
// spacing: 6.h,
// runSpacing: 6.h,
// children: [
// Directionality(
// textDirection: ui.TextDirection.ltr,
// child: AppCustomChipWidget(
// labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(prescription.appointmentDate), false), isEnglishOnly: true,
// ),
// ),
// AppCustomChipWidget(
// labelText: model.isSortByClinic ? prescription.name ?? "" : prescription.clinicDescription!,
// ),
// ],
// ),
// SizedBox(height: 8.h),
// Row(
// children: [
// Expanded(
// flex: 6,
// child: CustomButton(
// text: prescription.isHomeMedicineDeliverySupported!
// ? LocaleKeys.resendOrder.tr(context: context)
// : LocaleKeys.prescriptionDeliveryError.tr(context: context),
// onPressed: () async {
// if (prescription.isHomeMedicineDeliverySupported!) {
// LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionDetails.tr(context: context));
// await prescriptionsViewModel.getPrescriptionDetails(prescriptionsViewModel.patientPrescriptionOrders[index],
// onSuccess: (val) {
// LoaderBottomSheet.hideLoader();
// prescriptionsViewModel.initiatePrescriptionDelivery();
// });
// }
// },
// backgroundColor:
// prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor.withOpacity(0.15) : AppColors.greyF7Color,
// borderColor: AppColors.successColor.withOpacity(0.01),
// textColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35),
// fontSize: prescription.isHomeMedicineDeliverySupported! ? 14.f : 12.f,
// fontWeight: FontWeight.w500,
// borderRadius: 12.r,
// padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
// height: 40.h,
// icon: AppAssets.prescription_refill_icon,
// iconColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35),
// iconSize: 16.h,
// ),
// ),
// SizedBox(width: 8.h),
// Expanded(
// flex: 1,
// child: Container(
// height: 40.h,
// width: 40.w,
// decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
// color: AppColors.textColor,
// borderRadius: 12,
// ),
// child: Padding(
// padding: EdgeInsets.all(12.h),
// child: Transform.flip(
// flipX: appState.isArabic(),
// child: Utils.buildSvgWithAssets(
// icon: AppAssets.forward_arrow_icon_small,
// iconColor: AppColors.whiteColor,
// fit: BoxFit.contain,
// ),
// ),
// ),
// ).onPress(() {
// model.setPrescriptionsDetailsLoading();
// Navigator.of(context).push(
// CustomPageRoute(
// page: PrescriptionDetailPage(
// prescriptionsResponseModel: prescription,
// isFromAppointments: false,
// ),
// ),
// );
// }),
// ),
// ],
// ),
// SizedBox(height: 12.h),
// Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
// SizedBox(height: 12.h),
// ],
// );
// }).toList(),
// ],
// ),
),
// InkWell(
// onTap: () {
// setState(() {
// expandedIndex = isExpanded ? null : index;
// });
// },
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Padding(
// padding: EdgeInsets.all(16.h),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// CustomButton(
// text: "${model.patientPrescriptionOrdersViewList[index].prescriptionsList!.length} Prescriptions Available",
// onPressed: () {},
// backgroundColor: AppColors.greyColor,
// borderColor: AppColors.greyColor,
// textColor: AppColors.blackColor,
// fontSize: 10,
// fontWeight: FontWeight.w500,
// borderRadius: 8,
// padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
// height: 30.h,
// ),
// Icon(isExpanded ? Icons.expand_less : Icons.expand_more),
// ],
// ),
// SizedBox(height: 8.h),
// (model.patientPrescriptionOrdersViewList[index].filterName ?? "").toText16(isBold: true)
// ],
// ),
// ),
// AnimatedSwitcher(
// duration: Duration(milliseconds: 500),
// switchInCurve: Curves.easeIn,
// switchOutCurve: Curves.easeOut,
// transitionBuilder: (Widget child, Animation<double> animation) {
// return FadeTransition(
// opacity: animation,
// child: SizeTransition(
// sizeFactor: animation,
// axisAlignment: 0.0,
// child: child,
// ),
// );
// },
// // child: isExpanded
// // ? Container(
// // key: ValueKey<int>(index),
// // padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h),
// // child: Column(
// // crossAxisAlignment: CrossAxisAlignment.start,
// // children: [
// // ...model.patientPrescriptionOrdersViewList[index].prescriptionsList!.map((prescription) {
// // return Column(
// // crossAxisAlignment: CrossAxisAlignment.start,
// // children: [
// // Row(
// // mainAxisSize: MainAxisSize.min,
// // children: [
// // Image.network(
// // prescription.doctorImageURL!,
// // width: 24.h,
// // height: 24.h,
// // fit: BoxFit.fill,
// // ).circle(100),
// // SizedBox(width: 8.h),
// // Expanded(child: prescription.doctorName!.toText14(weight: FontWeight.w500)),
// // ],
// // ),
// // SizedBox(height: 8.h),
// // Wrap(
// // direction: Axis.horizontal,
// // spacing: 6.h,
// // runSpacing: 6.h,
// // children: [
// // Directionality(
// // textDirection: ui.TextDirection.ltr,
// // child: AppCustomChipWidget(
// // labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(prescription.appointmentDate), false), isEnglishOnly: true,
// // ),
// // ),
// // AppCustomChipWidget(
// // labelText: model.isSortByClinic ? prescription.name ?? "" : prescription.clinicDescription!,
// // ),
// // ],
// // ),
// // SizedBox(height: 8.h),
// // Row(
// // children: [
// // Expanded(
// // flex: 6,
// // child: CustomButton(
// // text: prescription.isHomeMedicineDeliverySupported!
// // ? LocaleKeys.resendOrder.tr(context: context)
// // : LocaleKeys.prescriptionDeliveryError.tr(context: context),
// // onPressed: () async {
// // if (prescription.isHomeMedicineDeliverySupported!) {
// // LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionDetails.tr(context: context));
// // await prescriptionsViewModel.getPrescriptionDetails(prescriptionsViewModel.patientPrescriptionOrders[index],
// // onSuccess: (val) {
// // LoaderBottomSheet.hideLoader();
// // prescriptionsViewModel.initiatePrescriptionDelivery();
// // });
// // }
// // },
// // backgroundColor:
// // prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor.withOpacity(0.15) : AppColors.greyF7Color,
// // borderColor: AppColors.successColor.withOpacity(0.01),
// // textColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35),
// // fontSize: prescription.isHomeMedicineDeliverySupported! ? 14.f : 12.f,
// // fontWeight: FontWeight.w500,
// // borderRadius: 12.r,
// // padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
// // height: 40.h,
// // icon: AppAssets.prescription_refill_icon,
// // iconColor: prescription.isHomeMedicineDeliverySupported! ? AppColors.successColor : AppColors.textColor.withOpacity(0.35),
// // iconSize: 16.h,
// // ),
// // ),
// // SizedBox(width: 8.h),
// // Expanded(
// // flex: 1,
// // child: Container(
// // height: 40.h,
// // width: 40.w,
// // decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
// // color: AppColors.textColor,
// // borderRadius: 12,
// // ),
// // child: Padding(
// // padding: EdgeInsets.all(12.h),
// // child: Transform.flip(
// // flipX: appState.isArabic(),
// // child: Utils.buildSvgWithAssets(
// // icon: AppAssets.forward_arrow_icon_small,
// // iconColor: AppColors.whiteColor,
// // fit: BoxFit.contain,
// // ),
// // ),
// // ),
// // ).onPress(() {
// // model.setPrescriptionsDetailsLoading();
// // Navigator.of(context).push(
// // CustomPageRoute(
// // page: PrescriptionDetailPage(
// // prescriptionsResponseModel: prescription,
// // isFromAppointments: false,
// // ),
// // ),
// // );
// // }),
// // ),
// // ],
// // ),
// // SizedBox(height: 12.h),
// // Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
// // SizedBox(height: 12.h),
// // ],
// // );
// // }).toList(),
// // ],
// // ),
// // )
// // : SizedBox.shrink(),
// ),
// ],
// ),
// ),
),
),
),

@ -53,6 +53,7 @@ class ProfileSettingsState extends State<ProfileSettings> {
scheduleMicrotask(() {
insuranceViewModel.initInsuranceProvider();
});
_loadPermissions();
super.initState();
}
@ -92,6 +93,7 @@ class ProfileSettingsState extends State<ProfileSettings> {
final SwiperController _controller = SwiperController();
late InsuranceViewModel insuranceViewModel;
late ContactUsViewModel contactUsViewModel;
String _permissionsLabel = "";
@override
Widget build(BuildContext context) {
@ -294,6 +296,9 @@ class ProfileSettingsState extends State<ProfileSettings> {
launchUrl(Uri.parse("tel://" + "+966 92 006 6666"));
}, trailingLabel: "92 006 6666"),
1.divider,
actionItem(AppAssets.permission, LocaleKeys.permissionsProfile.tr(context: context), () {
openAppSettings();
}, trailingLabel: getCurrentPermissions()),
actionItem(AppAssets.feedbackFill, LocaleKeys.feedback.tr(context: context), () {
contactUsViewModel.setSelectedFeedbackType(
FeedbackType(id: 5, nameEN: "Not classified", nameAR: 'غير محدد'),
@ -349,6 +354,34 @@ class ProfileSettingsState extends State<ProfileSettings> {
);
}
Future<void> _loadPermissions() async {
final Map<String, Permission> permissionMap = {
'Camera': Permission.camera,
'Microphone': Permission.microphone,
'Location': Permission.location,
'Notifications': Permission.notification,
'Calendar': Permission.calendarFullAccess,
};
final List<String> granted = [];
for (final entry in permissionMap.entries) {
if (await entry.value.isGranted) {
granted.add(entry.key);
}
}
if (mounted) {
setState(() {
_permissionsLabel = granted.isEmpty ? 'No permissions granted' : granted.join(', ');
});
}
}
String getCurrentPermissions() {
return _permissionsLabel;
}
Widget actionItem(String icon, String label, VoidCallback onPress, {String trailingLabel = "", bool? switchValue, ValueChanged<bool>? onSwitchChanged, bool isExternalLink = false}) {
return SizedBox(
height: 56.h,

@ -3,6 +3,8 @@ import 'dart:async';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
@ -96,40 +98,40 @@ class _RadiologyOrdersPageState extends State<RadiologyOrdersPage> {
children: [
// Clinic / Hospital toggle
SizedBox(height: 16.h),
Row(
children: [
CustomButton(
text: LocaleKeys.byClinic.tr(context: context),
onPressed: () {
model.setIsSortByClinic(true);
},
backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor,
borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2),
textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor,
fontSize: 12,
fontWeight: FontWeight.w500,
borderRadius: 10,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
),
SizedBox(width: 8.h),
CustomButton(
text: LocaleKeys.byHospital.tr(context: context),
onPressed: () {
model.setIsSortByClinic(false);
},
backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor,
borderColor: model.isSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor,
textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor,
fontSize: 12,
fontWeight: FontWeight.w500,
borderRadius: 10,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
),
],
),
SizedBox(height: 8.h),
// Row(
// children: [
// CustomButton(
// text: LocaleKeys.byClinic.tr(context: context),
// onPressed: () {
// model.setIsSortByClinic(true);
// },
// backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor,
// borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2),
// textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor,
// fontSize: 12,
// fontWeight: FontWeight.w500,
// borderRadius: 10,
// padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
// height: 40.h,
// ),
// SizedBox(width: 8.h),
// CustomButton(
// text: LocaleKeys.byHospital.tr(context: context),
// onPressed: () {
// model.setIsSortByClinic(false);
// },
// backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor,
// borderColor: model.isSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor,
// textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor,
// fontSize: 12,
// fontWeight: FontWeight.w500,
// borderRadius: 10,
// padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
// height: 40.h,
// ),
// ],
// ),
// SizedBox(height: 8.h),
selectedFilterText.isNotEmpty
? AppCustomChipWidget(
padding: EdgeInsets.symmetric(horizontal: 5.h),
@ -171,198 +173,521 @@ class _RadiologyOrdersPageState extends State<RadiologyOrdersPage> {
return Utils.getNoDataWidget(ctx, noDataText: LocaleKeys.youDontHaveRadiologyOrders.tr(context: context));
}
return ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.zero,
itemCount: model.patientRadiologyOrdersViewList.length,
itemBuilder: (context, index) {
final group = model.patientRadiologyOrdersViewList[index];
final displayName = model.isSortByClinic ? (group.first.clinicDescription ?? 'Unknown') : (group.first.projectName ?? 'Unknown');
final isExpanded = expandedIndex == index;
return AnimationConfiguration.staggeredList(
// return ListView.builder(
// shrinkWrap: true,
// physics: NeverScrollableScrollPhysics(),
// padding: EdgeInsets.zero,
// itemCount: model.patientRadiologyOrdersViewList.length,
// itemBuilder: (context, index) {
// final group = model.patientRadiologyOrdersViewList[index];
// final displayName = model.isSortByClinic ? (group.first.clinicDescription ?? 'Unknown') : (group.first.projectName ?? 'Unknown');
// final isExpanded = expandedIndex == index;
// return AnimationConfiguration.staggeredList(
// position: index,
// duration: const Duration(milliseconds: 400),
// child: SlideAnimation(
// verticalOffset: 50.0,
// child: FadeInAnimation(
// child: AnimatedContainer(
// duration: const Duration(milliseconds: 300),
// curve: Curves.easeInOut,
// margin: EdgeInsets.symmetric(vertical: 8.h),
// decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
// color: AppColors.whiteColor,
// borderRadius: 20.h,
// hasShadow: true,
// ),
// child: InkWell(
// onTap: () {
// setState(() {
// expandedIndex = isExpanded ? null : index;
// });
// WidgetsBinding.instance.addPostFrameCallback((_) {
// final key = _groupKeys.putIfAbsent(index, () => GlobalKey());
// if (key.currentContext != null && expandedIndex == index) {
// Future.delayed(const Duration(milliseconds: 450), () {
// if (key.currentContext != null) {
// Scrollable.ensureVisible(
// key.currentContext!,
// duration: const Duration(milliseconds: 350),
// curve: Curves.easeInOut,
// alignment: 0.0,
// );
// }
// });
// }
// });
// },
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Padding(
// key: _groupKeys.putIfAbsent(index, () => GlobalKey()),
// padding: EdgeInsets.all(16.h),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// AppCustomChipWidget(labelText: "${group.length} ${LocaleKeys.results.tr(context: context)}"),
// Icon(isExpanded ? Icons.expand_less : Icons.expand_more),
// ],
// ),
// SizedBox(height: 8.h),
// Text(
// displayName,
// style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600),
// overflow: TextOverflow.ellipsis,
// ),
// ],
// ),
// ),
// AnimatedSwitcher(
// duration: const Duration(milliseconds: 500),
// switchInCurve: Curves.easeIn,
// switchOutCurve: Curves.easeOut,
// transitionBuilder: (Widget child, Animation<double> animation) {
// return FadeTransition(
// opacity: animation,
// child: SizeTransition(
// sizeFactor: animation,
// axisAlignment: 0.0,
// child: child,
// ),
// );
// },
// child: isExpanded
// ? Container(
// key: ValueKey<int>(index),
// padding: EdgeInsets.symmetric(horizontal: 16.w),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// ...group.map<Widget>((order) {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// mainAxisSize: MainAxisSize.min,
// children: [
// Image.network(
// order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png",
// width: 24.w,
// height: 24.h,
// fit: BoxFit.cover,
// ).circle(100),
// SizedBox(width: 8.h),
// Expanded(
// child: (order.doctorName ?? '').toString().toText14(weight: FontWeight.w500),
// ),
// ],
// ),
// SizedBox(height: 8.h),
// Wrap(
// direction: Axis.horizontal,
// spacing: 4.h,
// runSpacing: 4.h,
// children: [
// if ((order.description ?? '').isNotEmpty)
// AppCustomChipWidget(
// labelText: (order.description ?? '').toString(),
// ),
// Directionality(
// textDirection: ui.TextDirection.ltr,
// child: AppCustomChipWidget(
// labelText: DateUtil.formatDateToDate(
// (order.orderDate ?? order.appointmentDate),
// false,
// ), isEnglishOnly: true,
// ),
// ),
// AppCustomChipWidget(
// labelText: model.isSortByClinic ? (order.projectName ?? '') : (order.clinicDescription ?? ''),
// ),
// ],
// ),
// SizedBox(height: 12.h),
// Row(
// children: [
// Expanded(flex: 2, child: const SizedBox()),
// Expanded(
// flex: 2,
// child: CustomButton(
// icon: AppAssets.view_report_icon,
// iconColor: AppColors.primaryRedColor,
// iconSize: 16.h,
// text: LocaleKeys.viewResults.tr(context: context),
// onPressed: () {
// model.navigationService.push(
// CustomPageRoute(
// page: RadiologyResultPage(patientRadiologyResponseModel: order),
// ),
// );
// },
// backgroundColor: AppColors.secondaryLightRedColor,
// borderColor: AppColors.secondaryLightRedColor,
// textColor: AppColors.primaryRedColor,
// fontSize: 14,
// fontWeight: FontWeight.w500,
// borderRadius: 12,
// padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
// height: 40.h,
// ),
// ),
// ],
// ),
// SizedBox(height: 12.h),
// Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
// SizedBox(height: 12.h),
// ],
// );
// }).toList(),
// ],
// ),
// )
// : const SizedBox.shrink(),
// ),
// ],
// ),
// ),
// ),
// ),
// ),
// );
// },
// );
return ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.zero,
itemCount: model.patientRadiologyOrders.length,
itemBuilder: (context, index) {
final group = model.patientRadiologyOrders[index];
final isExpanded = expandedIndex == index;
return AnimationConfiguration.staggeredList(
position: index,
duration: const Duration(milliseconds: 400),
duration: const Duration(milliseconds: 500),
child: SlideAnimation(
verticalOffset: 50.0,
verticalOffset: 100.0,
child: FadeInAnimation(
child: AnimatedContainer(
duration: const Duration(milliseconds: 300),
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
margin: EdgeInsets.symmetric(vertical: 8.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 20.h,
hasShadow: true,
),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true),
child: InkWell(
onTap: () {
setState(() {
expandedIndex = isExpanded ? null : index;
});
WidgetsBinding.instance.addPostFrameCallback((_) {
final key = _groupKeys.putIfAbsent(index, () => GlobalKey());
if (key.currentContext != null && expandedIndex == index) {
Future.delayed(const Duration(milliseconds: 450), () {
if (key.currentContext != null) {
Scrollable.ensureVisible(
key.currentContext!,
duration: const Duration(milliseconds: 350),
curve: Curves.easeInOut,
alignment: 0.0,
);
}
});
}
});
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
key: _groupKeys.putIfAbsent(index, () => GlobalKey()),
padding: EdgeInsets.all(16.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppCustomChipWidget(
labelText: "${getIt.get<AppState>().isArabic() ? group.isInOutPatientDescriptionN : group.isInOutPatientDescription}",
backgroundColor: group.isInOutPatient! ? AppColors.primaryRedColor.withOpacity(0.1) : AppColors.warningColorYellow.withOpacity(0.1),
textColor: group.isInOutPatient! ? AppColors.primaryRedColor : AppColors.warningColorYellow,
),
SizedBox(height: 16.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: [
AppCustomChipWidget(labelText: "${group.length} ${LocaleKeys.results.tr(context: context)}"),
Icon(isExpanded ? Icons.expand_less : Icons.expand_more),
Image.network(
group.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png",
width: 24.w,
height: 24.h,
fit: BoxFit.cover,
).circle(100),
SizedBox(width: 8.h),
Expanded(child: (group.doctorName ?? "").toString().toText14(weight: FontWeight.w500)),
],
),
SizedBox(height: 8.h),
Text(
displayName,
style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600),
overflow: TextOverflow.ellipsis,
Wrap(
direction: Axis.horizontal,
spacing: 4.h,
runSpacing: 4.h,
children: [
Directionality(
textDirection: ui.TextDirection.ltr,
child: AppCustomChipWidget(
labelText: DateUtil.formatDateToDate(group.orderDate!, false),
isEnglishOnly: true,
)),
AppCustomChipWidget(
labelText: (group.projectName ?? ""),
),
AppCustomChipWidget(
labelText: (group.clinicDescription ?? ""),
),
],
),
SizedBox(height: 16.h),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"${group.procedureName.toString().trim() ?? ""}".toText14(weight: FontWeight.w500),
// "Lorem ipsum text".toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight),
SizedBox(height: 16.h),
CustomButton(
text: LocaleKeys.viewReport.tr(),
onPressed: () {
model.navigationService.push(
CustomPageRoute(
page: RadiologyResultPage(patientRadiologyResponseModel: group),
),
);
},
backgroundColor: AppColors.infoColor.withAlpha(20),
borderColor: AppColors.infoColor.withAlpha(0),
textColor: AppColors.infoColor,
fontSize: (isFoldable || isTablet) ? 12.f : 14.f,
fontWeight: FontWeight.w500,
borderRadius: 12.r,
padding: EdgeInsets.fromLTRB(10.w, 0, 10.w, 0),
height: 40.h,
iconSize: 14.h,
icon: AppAssets.view_report_icon,
iconColor: AppColors.infoColor,
),
],
)
],
),
),
AnimatedSwitcher(
duration: const Duration(milliseconds: 500),
switchInCurve: Curves.easeIn,
switchOutCurve: Curves.easeOut,
transitionBuilder: (Widget child, Animation<double> animation) {
return FadeTransition(
opacity: animation,
child: SizeTransition(
sizeFactor: animation,
axisAlignment: 0.0,
child: child,
),
);
},
child: isExpanded
? Container(
key: ValueKey<int>(index),
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...group.map<Widget>((order) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisSize: MainAxisSize.min,
children: [
Image.network(
order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png",
width: 24.w,
height: 24.h,
fit: BoxFit.cover,
).circle(100),
SizedBox(width: 8.h),
Expanded(
child: (order.doctorName ?? '').toString().toText14(weight: FontWeight.w500),
),
],
),
SizedBox(height: 8.h),
Wrap(
direction: Axis.horizontal,
spacing: 4.h,
runSpacing: 4.h,
children: [
if ((order.description ?? '').isNotEmpty)
AppCustomChipWidget(
labelText: (order.description ?? '').toString(),
),
Directionality(
textDirection: ui.TextDirection.ltr,
child: AppCustomChipWidget(
labelText: DateUtil.formatDateToDate(
(order.orderDate ?? order.appointmentDate),
false,
), isEnglishOnly: true,
),
),
AppCustomChipWidget(
labelText: model.isSortByClinic ? (order.projectName ?? '') : (order.clinicDescription ?? ''),
),
],
),
SizedBox(height: 12.h),
Row(
children: [
Expanded(flex: 2, child: const SizedBox()),
Expanded(
flex: 2,
child: CustomButton(
icon: AppAssets.view_report_icon,
iconColor: AppColors.primaryRedColor,
iconSize: 16.h,
text: LocaleKeys.viewResults.tr(context: context),
onPressed: () {
model.navigationService.push(
CustomPageRoute(
page: RadiologyResultPage(patientRadiologyResponseModel: order),
),
);
},
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
fontSize: 14,
fontWeight: FontWeight.w500,
borderRadius: 12,
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
),
),
],
),
SizedBox(height: 12.h),
Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
SizedBox(height: 12.h),
],
);
}).toList(),
],
),
)
: const SizedBox.shrink(),
),
// AnimatedSwitcher(
// duration: Duration(milliseconds: 500),
// switchInCurve: Curves.easeIn,
// switchOutCurve: Curves.easeOut,
// transitionBuilder: (Widget child, Animation<double> animation) {
// return FadeTransition(
// opacity: animation,
// child: SizeTransition(
// sizeFactor: animation,
// axisAlignment: 0.0,
// child: child,
// ),
// );
// },
// child: isExpanded
// ? Container(
// key: ValueKey<int>(index),
// padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 0.h),
// child: Column(
// children: [
// ListView.separated(
// shrinkWrap: true,
// physics: NeverScrollableScrollPhysics(),
// padding: EdgeInsets.zero,
// itemBuilder: (cxt, index) {
// PatientRadiologyResponseModel order = group;
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// "${order.procedureName ?? ""}".toText14(weight: FontWeight.w500),
// "Lorem ipsum text".toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight),
// // SizedBox(height: 4.h),
// // order.testDetails![index].testDescriptionEn!.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight),
// // Row(
// // mainAxisSize: MainAxisSize.min,
// // children: [
// // Image.network(
// // order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png",
// // width: 24.w,
// // height: 24.h,
// // fit: BoxFit.cover,
// // ).circle(100),
// // SizedBox(width: 8.h),
// // Expanded(child: (order.doctorName ?? order.doctorNameEnglish ?? "").toString().toText14(weight: FontWeight.w500)),
// // ],
// // ),
// // SizedBox(height: 8.h),
// // Wrap(
// // direction: Axis.horizontal,
// // spacing: 4.h,
// // runSpacing: 4.h,
// // children: [
// // AppCustomChipWidget(
// // labelText: ("${LocaleKeys.orderNo.tr(context: context)}: ${order.orderNo!}"), isEnglishOnly: true,
// // ),
// // Directionality(
// // textDirection: ui.TextDirection.ltr,
// // child: AppCustomChipWidget(
// // labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false),
// // isEnglishOnly: true,
// // )),
// // AppCustomChipWidget(
// // labelText: labViewModel.isSortByClinic ? (order.projectName ?? "") : (order.clinicDescription ?? ""),
// // ),
// // ],
// // ),
// // // Row(
// // // children: [
// // // CustomButton(
// // // text: ("Order No: ".needTranslation + order.orderNo!),
// // // onPressed: () {},
// // // backgroundColor: AppColors.greyColor,
// // // borderColor: AppColors.greyColor,
// // // textColor: AppColors.blackColor,
// // // fontSize: 10,
// // // fontWeight: FontWeight.w500,
// // // borderRadius: 8,
// // // padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
// // // height: 24.h,
// // // ),
// // // SizedBox(width: 8.h),
// // // CustomButton(
// // // text: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false),
// // // onPressed: () {},
// // // backgroundColor: AppColors.greyColor,
// // // borderColor: AppColors.greyColor,
// // // textColor: AppColors.blackColor,
// // // fontSize: 10,
// // // fontWeight: FontWeight.w500,
// // // borderRadius: 8,
// // // padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
// // // height: 24.h,
// // // ),
// // // ],
// // // ),
// // // SizedBox(height: 8.h),
// // // Row(
// // // children: [
// // // CustomButton(
// // // text: model.isSortByClinic ? (order.clinicDescription ?? "") : (order.projectName ?? ""),
// // // onPressed: () {},
// // // backgroundColor: AppColors.greyColor,
// // // borderColor: AppColors.greyColor,
// // // textColor: AppColors.blackColor,
// // // fontSize: 10,
// // // fontWeight: FontWeight.w500,
// // // borderRadius: 8,
// // // padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
// // // height: 24.h,
// // // ),
// // // ],
// // // ),
// // SizedBox(height: 12.h),
// // Row(
// // children: [
// // Expanded(flex: 2, child: SizedBox()),
// // // Expanded(
// // // flex: 1,
// // // child: Container(
// // // height: 40.h,
// // // width: 40.w,
// // // decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
// // // color: AppColors.textColor,
// // // borderRadius: 12,
// // // ),
// // // child: Padding(
// // // padding: EdgeInsets.all(12.h),
// // // child: Transform.flip(
// // // flipX: _appState.isArabic(),
// // // child: Utils.buildSvgWithAssets(
// // // icon: AppAssets.forward_arrow_icon_small,
// // // iconColor: AppColors.whiteColor,
// // // fit: BoxFit.contain,
// // // ),
// // // ),
// // // ),
// // // ).onPress(() {
// // // model.currentlySelectedPatientOrder = order;
// // // labProvider.getPatientLabResultByHospital(order);
// // // labProvider.getPatientSpecialResult(order);
// // // Navigator.of(context).push(
// // // CustomPageRoute(page: LabResultByClinic(labOrder: order)),
// // // );
// // // }),
// // // )
// //
// // Expanded(
// // flex: 2,
// // child: CustomButton(
// // icon: AppAssets.view_report_icon,
// // iconColor: AppColors.primaryRedColor,
// // iconSize: 16.h,
// // text: LocaleKeys.viewResults.tr(context: context),
// // onPressed: () {
// // labViewModel.currentlySelectedPatientOrder = order;
// // labProvider.getPatientLabResultByHospital(order);
// // labProvider.getPatientSpecialResult(order);
// // Navigator.of(context).push(
// // CustomPageRoute(page: LabResultByClinic(labOrder: order)),
// // );
// // },
// // backgroundColor: AppColors.secondaryLightRedColor,
// // borderColor: AppColors.secondaryLightRedColor,
// // textColor: AppColors.primaryRedColor,
// // fontSize: 14,
// // fontWeight: FontWeight.w500,
// // borderRadius: 12,
// // padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
// // height: 40.h,
// // ),
// // )
// // ],
// // ),
// // SizedBox(height: 12.h),
// // Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
// // SizedBox(height: 12.h),
// ],
// ).paddingOnly(top: 16, bottom: 16);
// },
// separatorBuilder: (cxt, index) => Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
// itemCount: 1),
// SizedBox(height: 16.h),
// CustomButton(
// text: LocaleKeys.viewReport.tr(),
// onPressed: () {
// model.navigationService.push(
// CustomPageRoute(
// page: RadiologyResultPage(patientRadiologyResponseModel: group),
// ),
// );
// },
// backgroundColor: AppColors.infoColor.withAlpha(20),
// borderColor: AppColors.infoColor.withAlpha(0),
// textColor: AppColors.infoColor,
// fontSize: (isFoldable || isTablet) ? 12.f : 14.f,
// fontWeight: FontWeight.w500,
// borderRadius: 12.r,
// padding: EdgeInsets.fromLTRB(10.w, 0, 10.w, 0),
// height: 40.h,
// iconSize: 14.h,
// icon: AppAssets.view_report_icon,
// iconColor: AppColors.infoColor,
// ),
// SizedBox(height: 16.h),
// ],
// ),
// )
// : SizedBox.shrink(),
// ),
],
),
),
),
),
),
);
},
);
}),
],
),
);
},
),
));
},
);
}),
],
),
);
},
),
),
),
);
}

@ -53,14 +53,48 @@ class _RadiologyResultPageState extends State<RadiologyResultPage> {
Expanded(
child: CollapsingListView(
title: LocaleKeys.radiologyResult.tr(context: context),
viewImage: () {
if (radiologyViewModel.radiologyImageURL.isNotEmpty) {
Uri uri = Uri.parse(radiologyViewModel.radiologyImageURL);
launchUrl(uri, mode: LaunchMode.platformDefault, webOnlyWindowName: "");
} else {
Utils.showToast("Radiology image not available");
}
downloadReport: () async {
LoaderBottomSheet.showLoader();
await radiologyViewModel
.getRadiologyPDF(
patientRadiologyResponseModel: widget.patientRadiologyResponseModel,
authenticatedUser: _appState.getAuthenticatedUser()!,
onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
})
.then((val) async {
LoaderBottomSheet.hideLoader();
if (radiologyViewModel.patientRadiologyReportPDFBase64.isNotEmpty) {
String path = await Utils.createFileFromString(radiologyViewModel.patientRadiologyReportPDFBase64, "pdf");
try {
OpenFilex.open(path);
} catch (ex) {
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: "Cannot open file"),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
}
}
});
},
// viewImage: () {
// if (radiologyViewModel.radiologyImageURL.isNotEmpty) {
// Uri uri = Uri.parse(radiologyViewModel.radiologyImageURL);
// launchUrl(uri, mode: LaunchMode.platformDefault, webOnlyWindowName: "");
// } else {
// Utils.showToast("Radiology image not available");
// }
// },
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 24.h),
@ -124,54 +158,28 @@ class _RadiologyResultPageState extends State<RadiologyResultPage> {
borderRadius: 24.h,
hasShadow: true,
),
child: CustomButton(
text: LocaleKeys.downloadReport.tr(context: context),
child: widget.patientRadiologyResponseModel.dIAPACSURL != "" ? CustomButton(
text: LocaleKeys.openRad.tr(context: context),
onPressed: () async {
LoaderBottomSheet.showLoader();
await radiologyViewModel
.getRadiologyPDF(
patientRadiologyResponseModel: widget.patientRadiologyResponseModel,
authenticatedUser: _appState.getAuthenticatedUser()!,
onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
})
.then((val) async {
LoaderBottomSheet.hideLoader();
if (radiologyViewModel.patientRadiologyReportPDFBase64.isNotEmpty) {
String path = await Utils.createFileFromString(radiologyViewModel.patientRadiologyReportPDFBase64, "pdf");
try {
OpenFilex.open(path);
} catch (ex) {
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: "Cannot open file"),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
}
}
});
if (radiologyViewModel.radiologyImageURL.isNotEmpty) {
Uri uri = Uri.parse(radiologyViewModel.radiologyImageURL);
launchUrl(uri, mode: LaunchMode.platformDefault, webOnlyWindowName: "");
} else {
Utils.showToast("Radiology image not available");
}
},
backgroundColor: AppColors.successColor,
borderColor: AppColors.successColor,
backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedColor,
textColor: Colors.white,
fontSize: 16,
fontWeight: FontWeight.w500,
borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 45.h,
icon: AppAssets.download,
icon: AppAssets.imageIcon,
iconColor: Colors.white,
iconSize: 20.h,
).paddingSymmetrical(24.h, 24.h),
).paddingSymmetrical(24.h, 24.h) : SizedBox.shrink(),
),
],
),

@ -27,6 +27,7 @@ class CollapsingListView extends StatelessWidget {
VoidCallback? doctorResponse;
VoidCallback? downloadReport;
VoidCallback? viewImage;
VoidCallback? location;
Widget? bottomChild;
Widget? trailing;
bool isClose;
@ -51,6 +52,7 @@ class CollapsingListView extends StatelessWidget {
this.doctorResponse,
this.downloadReport,
this.viewImage,
this.location,
this.isLeading = true,
this.trailing,
this.leadingCallback,
@ -95,6 +97,7 @@ class CollapsingListView extends StatelessWidget {
doctorResponse: doctorResponse,
downloadReport: downloadReport,
viewImage: viewImage,
location: location,
bottomChild: bottomChild,
trailing: trailing,
aiOverview: aiOverview,
@ -208,6 +211,7 @@ class ScrollAnimatedTitle extends StatefulWidget implements PreferredSizeWidget
VoidCallback? doctorResponse;
VoidCallback? downloadReport;
VoidCallback? viewImage;
VoidCallback? location;
Widget? bottomChild;
Widget? trailing;
@ -227,6 +231,7 @@ class ScrollAnimatedTitle extends StatefulWidget implements PreferredSizeWidget
this.doctorResponse,
this.downloadReport,
this.viewImage,
this.location,
this.bottomChild,
this.trailing,
});
@ -307,6 +312,7 @@ class _ScrollAnimatedTitleState extends State<ScrollAnimatedTitle> {
if (widget.aiOverview != null) actionButton(context, t, title: LocaleKeys.aiOverView.tr(context: context), icon: AppAssets.aiOverView, isAiButton: true).onPress(widget.aiOverview!),
if (widget.downloadReport != null) actionButton(context, t, title: LocaleKeys.downloadReport.tr(context: context), icon: AppAssets.download).onPress(widget.downloadReport!),
if (widget.viewImage != null) actionButton(context, t, title: LocaleKeys.viewRadiologyImage.tr(context: context), icon: AppAssets.download).onPress(widget.viewImage!),
if (widget.location != null) actionButton(context, t, title: LocaleKeys.sortByLocation.tr(context: context), icon: AppAssets.location).onPress(widget.location!),
if (widget.trailing != null) widget.trailing!,
]
],

@ -2,6 +2,7 @@ import 'dart:io' show Platform;
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/core/utils/calender_utils_new.dart';
@ -10,6 +11,7 @@ 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/presentation/prescriptions/prescription_reminder_view.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/services/permission_service.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:permission_handler/permission_handler.dart';
@ -22,19 +24,66 @@ class BottomSheetUtils {
_showReminderBottomSheet(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed);
} else {
// Utils.showPermissionConsentDialog(context, TranslationBase.of(context).calendarPermission, () async {
// if (await Permission.calendarFullAccess.request().isGranted) {
// _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
// onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed);
// }
// });
showCommonBottomSheetWithoutHeight(
title: LocaleKeys.notice.tr(context: GetIt.instance<NavigationService>().navigatorKey.currentContext!),
GetIt.instance<NavigationService>().navigatorKey.currentContext!,
child: Utils.getWarningWidget(
loadingText: LocaleKeys.calendarPermissionAlert.tr(),
isShowActionButtons: true,
onCancelTap: () {
GetIt.instance<NavigationService>().pop();
},
onConfirmTap: () async {
GetIt.instance<NavigationService>().pop();
openAppSettings();
}),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
}
} else {
if (await Permission.calendarWriteOnly.request().isGranted) {
if (await Permission.calendarFullAccess.request().isGranted) {
_showReminderBottomSheet(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed);
} else {
showCommonBottomSheetWithoutHeight(
title: LocaleKeys.notice.tr(context: GetIt.instance<NavigationService>().navigatorKey.currentContext!),
GetIt.instance<NavigationService>().navigatorKey.currentContext!,
child: Utils.getWarningWidget(
loadingText: LocaleKeys.calendarPermissionAlert.tr(),
isShowActionButtons: true,
onCancelTap: () {
GetIt.instance<NavigationService>().pop();
},
onConfirmTap: () async {
GetIt.instance<NavigationService>().pop();
openAppSettings();
}),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
}
} else {
showCommonBottomSheetWithoutHeight(
title: LocaleKeys.notice.tr(context: GetIt.instance<NavigationService>().navigatorKey.currentContext!),
GetIt.instance<NavigationService>().navigatorKey.currentContext!,
child: Utils.getWarningWidget(
loadingText: LocaleKeys.calendarPermissionAlert.tr(),
isShowActionButtons: true,
onCancelTap: () {
GetIt.instance<NavigationService>().pop();
},
onConfirmTap: () async {
GetIt.instance<NavigationService>().pop();
openAppSettings();
}),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
}
}
}

Loading…
Cancel
Save