pull/199/head
haroon amjad 2 weeks 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": "تم إرسال طلب تحديث بيانات التأمين بنجاح. سيتم إعلامك بمجرد الانتهاء.", "insuranceRequestSubmittedSuccessfully": "تم إرسال طلب تحديث بيانات التأمين بنجاح. سيتم إعلامك بمجرد الانتهاء.",
"updatingEmailAddress": "جارٍ تحديث عنوان البريد الإلكتروني، يرجى الانتظار...", "updatingEmailAddress": "جارٍ تحديث عنوان البريد الإلكتروني، يرجى الانتظار...",
"verifyInsurance": "التحقق من التأمين", "verifyInsurance": "التحقق من التأمين",
"tests": "تحليل" "tests": "تحليل",
"calendarPermissionAlert": "يرجى منح إذن الوصول إلى التقويم من إعدادات التطبيق لضبط تذكير تناول الدواء.",
"sortByLocation": "الترتيب حسب الموقع"
} }

@ -1583,5 +1583,7 @@
"insuranceRequestSubmittedSuccessfully": "Your insurance update request has been successfully submitted. You will be notified once completed.", "insuranceRequestSubmittedSuccessfully": "Your insurance update request has been successfully submitted. You will be notified once completed.",
"updatingEmailAddress": "Updating email address, Please wait...", "updatingEmailAddress": "Updating email address, Please wait...",
"verifyInsurance": "Verify Insurance", "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 aiOverView = '$svgBasePath/ai_overview.svg';
static const String darkModeIcon = '$svgBasePath/dark_mode_icon.svg'; static const String darkModeIcon = '$svgBasePath/dark_mode_icon.svg';
static const String biometricLockIcon = '$svgBasePath/biometric_lock_icon.svg'; static const String biometricLockIcon = '$svgBasePath/biometric_lock_icon.svg';
static const String imageIcon = '$svgBasePath/image_icon.svg';
// PNGS // // PNGS //
static const String hmgLogo = '$pngBasePath/hmg_logo.png'; static const String hmgLogo = '$pngBasePath/hmg_logo.png';

@ -94,7 +94,27 @@ class LocationUtils {
permissionGranted = await Geolocator.requestPermission(); permissionGranted = await Geolocator.requestPermission();
if (permissionGranted != LocationPermission.whileInUse && permissionGranted != LocationPermission.always) { if (permissionGranted != LocationPermission.whileInUse && permissionGranted != LocationPermission.always) {
appState.resetLocation(); 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; return;
} }
} else if (permissionGranted == LocationPermission.deniedForever) { } else if (permissionGranted == LocationPermission.deniedForever) {

@ -1,9 +1,16 @@
import 'dart:async'; import 'dart:async';
import 'package:device_calendar_plus/device_calendar_plus.dart'; 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/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:jiffy/jiffy.dart' show Jiffy;
import 'package:manage_calendar_events/manage_calendar_events.dart' hide Calendar; import 'package:manage_calendar_events/manage_calendar_events.dart' hide Calendar;
import 'package:permission_handler/permission_handler.dart';
class CalenderUtilsNew { class CalenderUtilsNew {
final DeviceCalendar calender = DeviceCalendar.instance; final DeviceCalendar calender = DeviceCalendar.instance;
@ -17,7 +24,26 @@ class CalenderUtilsNew {
Future<void> getCalenders() async { Future<void> getCalenders() async {
CalendarPermissionStatus result = await DeviceCalendar.instance.hasPermissions(); 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(); var calenders = await calender.listCalendars();
calenders.forEach((calender) { calenders.forEach((calender) {
if (!calender.readOnly) { 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/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/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:hmg_patient_app_new/services/error_handler_service.dart';
import 'package:permission_handler/permission_handler.dart';
class ContactUsViewModel extends ChangeNotifier { class ContactUsViewModel extends ChangeNotifier {
ContactUsRepo contactUsRepo; ContactUsRepo contactUsRepo;
@ -22,6 +23,7 @@ class ContactUsViewModel extends ChangeNotifier {
bool isHMGHospitalsListSelected = true; bool isHMGHospitalsListSelected = true;
bool isLiveChatProjectsListLoading = false; bool isLiveChatProjectsListLoading = false;
bool isSendFeedbackTabSelected = true; bool isSendFeedbackTabSelected = true;
bool hasLocationEnabled = false;
List<GetHMGLocationsModel> hmgHospitalsLocationsList = []; List<GetHMGLocationsModel> hmgHospitalsLocationsList = [];
List<GetHMGLocationsModel> hmgPharmacyLocationsList = []; List<GetHMGLocationsModel> hmgPharmacyLocationsList = [];
@ -52,11 +54,12 @@ class ContactUsViewModel extends ChangeNotifier {
ContactUsViewModel({required this.contactUsRepo, required this.errorHandlerService, required this.appState}); ContactUsViewModel({required this.contactUsRepo, required this.errorHandlerService, required this.appState});
initContactUsViewModel() { initContactUsViewModel() async {
isHMGLocationsListLoading = true; isHMGLocationsListLoading = true;
isHMGHospitalsListSelected = true; isHMGHospitalsListSelected = true;
isLiveChatProjectsListLoading = true; isLiveChatProjectsListLoading = true;
isCOCItemsListLoading = true; isCOCItemsListLoading = true;
hasLocationEnabled = false;
hmgHospitalsLocationsList.clear(); hmgHospitalsLocationsList.clear();
hmgPharmacyLocationsList.clear(); hmgPharmacyLocationsList.clear();
liveChatProjectsList.clear(); liveChatProjectsList.clear();
@ -65,6 +68,18 @@ class ContactUsViewModel extends ChangeNotifier {
selectedFeedbackType = FeedbackType(id: 5, nameEN: "Not classified", nameAR: 'غير محدد'); selectedFeedbackType = FeedbackType(id: 5, nameEN: "Not classified", nameAR: 'غير محدد');
setPatientFeedbackSelectedAppointment(null); setPatientFeedbackSelectedAppointment(null);
getHMGLocations(); getHMGLocations();
if (await Permission.location.isGranted) {
setHasLocationEnabled(true);
} else {
setHasLocationEnabled(false);
}
notifyListeners();
}
setHasLocationEnabled(bool hasLocationEnabled) {
this.hasLocationEnabled = hasLocationEnabled;
notifyListeners(); notifyListeners();
} }
@ -128,6 +143,19 @@ class ContactUsViewModel extends ChangeNotifier {
hmgPharmacyLocationsList.add(location); 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; isHMGLocationsListLoading = false;
notifyListeners(); notifyListeners();
if (onSuccess != null) { if (onSuccess != null) {

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

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

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

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

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

@ -69,13 +69,15 @@ class FindUsItemCard extends StatelessWidget {
Widget get distanceInfo => Row( Widget get distanceInfo => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
AppCustomChipWidget( getHMGLocationsModel.distanceInKilometers != 0
labelText: "${getHMGLocationsModel.distanceInKilometers ?? ""} km", ? AppCustomChipWidget(
icon: AppAssets.location_red, labelText: "${getHMGLocationsModel.distanceInKilometers ?? ""} km",
icon: AppAssets.location_red,
iconColor: AppColors.primaryRedColor, iconColor: AppColors.primaryRedColor,
backgroundColor: AppColors.secondaryLightRedColor, backgroundColor: AppColors.secondaryLightRedColor,
textColor: AppColors.errorColor, textColor: AppColors.errorColor,
), )
: SizedBox.shrink(),
Row( Row(
children: [ children: [
AppCustomChipWidget( 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/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.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_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/date_util.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.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/core/utils/utils.dart';
@ -63,8 +65,9 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
Expanded( Expanded(
child: CollapsingListView( child: CollapsingListView(
title: LocaleKeys.prescriptions.tr(context: context), title: LocaleKeys.prescriptions.tr(context: context),
instructions: () async { instructions: widget.prescriptionsResponseModel.isInOutPatient!
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionPDFPleaseWait.tr(context: context)); ? () async {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionPDFPleaseWait.tr(context: context));
await prescriptionsViewModel.getPrescriptionInstructionsPDF(widget.prescriptionsResponseModel, onSuccess: (val) { await prescriptionsViewModel.getPrescriptionInstructionsPDF(widget.prescriptionsResponseModel, onSuccess: (val) {
LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
if (prescriptionsViewModel.prescriptionInstructionsPDFLink.isNotEmpty) { if (prescriptionsViewModel.prescriptionInstructionsPDFLink.isNotEmpty) {
@ -89,7 +92,8 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
isCloseButtonVisible: true, isCloseButtonVisible: true,
); );
}); });
}, }
: null,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Consumer<PrescriptionsViewModel>(builder: (context, prescriptionVM, child) { child: Consumer<PrescriptionsViewModel>(builder: (context, prescriptionVM, child) {
return Column( return Column(
@ -107,6 +111,13 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ 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( Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ 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), borderColor: AppColors.successColor.withOpacity(0.01),
textColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? Colors.white : AppColors.textColor.withOpacity(0.35), textColor: widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported! ? Colors.white : AppColors.textColor.withOpacity(0.35),
fontSize: 16, fontSize: 16,

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

@ -69,52 +69,52 @@ class _PrescriptionsListPageState extends State<PrescriptionsListPage> {
children: [ children: [
SizedBox(height: 16.h), SizedBox(height: 16.h),
// Clinic & Hospital Sort // Clinic & Hospital Sort
Row( // Row(
children: [ // children: [
CustomButton( // CustomButton(
text: LocaleKeys.byClinic.tr(context: context), // text: LocaleKeys.byClinic.tr(context: context),
onPressed: () { // onPressed: () {
model.setIsSortByClinic(true); // model.setIsSortByClinic(true);
}, // },
backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, // backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor,
borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2), // borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withOpacity(0.2),
textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, // textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor,
fontSize: 12, // fontSize: 12,
fontWeight: FontWeight.w500, // fontWeight: FontWeight.w500,
borderRadius: 10, // borderRadius: 10,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h, // height: 40.h,
), // ),
SizedBox(width: 8.h), // SizedBox(width: 8.h),
CustomButton( // CustomButton(
text: LocaleKeys.byHospital.tr(context: context), // text: LocaleKeys.byHospital.tr(context: context),
onPressed: () { // onPressed: () {
model.setIsSortByClinic(false); // model.setIsSortByClinic(false);
}, // },
backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, // backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor,
borderColor: model.isSortByClinic ? AppColors.textColor.withOpacity(0.2) : AppColors.primaryRedColor, // borderColor: model.isSortByClinic ? AppColors.textColor.withOpacity(0.2) : AppColors.primaryRedColor,
textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, // textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor,
fontSize: 12, // fontSize: 12,
fontWeight: FontWeight.w500, // fontWeight: FontWeight.w500,
borderRadius: 10, // borderRadius: 10,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h, // height: 40.h,
), // ),
], // ],
).paddingSymmetrical(24.h, 0.h), // ).paddingSymmetrical(24.h, 0.h),
SizedBox(height: 20.h), // SizedBox(height: 20.h),
// Expandable list // Expandable list
ListView.builder( ListView.builder(
itemCount: model.isPrescriptionsOrdersLoading itemCount: model.isPrescriptionsOrdersLoading
? 4 ? 4
: model.patientPrescriptionOrders.isNotEmpty : model.patientPrescriptionOrders.isNotEmpty
? model.patientPrescriptionOrdersViewList.length ? model.patientPrescriptionOrders.length
: 1, : 1,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
padding: const EdgeInsets.only(left: 0, right: 8), padding: const EdgeInsets.only(left: 0, right: 8),
itemBuilder: (context, index) { itemBuilder: (context, index) {
final isExpanded = expandedIndex == index; // final isExpanded = expandedIndex == index;
return model.isPrescriptionsOrdersLoading return model.isPrescriptionsOrdersLoading
? LabResultItemView( ? LabResultItemView(
onTap: () {}, onTap: () {},
@ -134,180 +134,416 @@ class _PrescriptionsListPageState extends State<PrescriptionsListPage> {
curve: Curves.easeInOut, curve: Curves.easeInOut,
margin: EdgeInsets.symmetric(vertical: 8.h), 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( child: Container(
onTap: () { key: ValueKey<int>(index),
setState(() { padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 16.h),
expandedIndex = isExpanded ? null : index;
});
},
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( AppCustomChipWidget(
padding: EdgeInsets.all(16.h), labelText:
child: Column( "${getIt.get<AppState>().isArabic() ? model.patientPrescriptionOrders[index].isInOutPatientDescriptionN : model.patientPrescriptionOrders[index].isInOutPatientDescription}",
crossAxisAlignment: CrossAxisAlignment.start, backgroundColor:
children: [ model.patientPrescriptionOrders[index].isInOutPatient! ? AppColors.primaryRedColor.withOpacity(0.1) : AppColors.warningColorYellow.withOpacity(0.1),
Row( textColor: model.patientPrescriptionOrders[index].isInOutPatient! ? AppColors.primaryRedColor : AppColors.warningColorYellow,
mainAxisAlignment: MainAxisAlignment.spaceBetween, ),
children: [ SizedBox(height: 16.h),
CustomButton( Row(
text: "${model.patientPrescriptionOrdersViewList[index].prescriptionsList!.length} Prescriptions Available", mainAxisSize: MainAxisSize.min,
onPressed: () {}, children: [
backgroundColor: AppColors.greyColor, Image.network(
borderColor: AppColors.greyColor, model.patientPrescriptionOrders[index].doctorImageURL!,
textColor: AppColors.blackColor, width: 24.h,
fontSize: 10, height: 24.h,
fontWeight: FontWeight.w500, fit: BoxFit.fill,
borderRadius: 8, ).circle(100),
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), SizedBox(width: 8.h),
height: 30.h, Expanded(child: model.patientPrescriptionOrders[index].doctorName!.toText14(weight: FontWeight.w500)),
), ],
Icon(isExpanded ? Icons.expand_less : Icons.expand_more), ),
], 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( SizedBox(height: 8.h),
duration: Duration(milliseconds: 500), Row(
switchInCurve: Curves.easeIn, children: [
switchOutCurve: Curves.easeOut, Expanded(
transitionBuilder: (Widget child, Animation<double> animation) { flex: 6,
return FadeTransition( child: CustomButton(
opacity: animation, text: model.patientPrescriptionOrders[index].isHomeMedicineDeliverySupported!
child: SizeTransition( ? LocaleKeys.resendOrder.tr(context: context)
sizeFactor: animation, : LocaleKeys.prescriptionDeliveryError.tr(context: context),
axisAlignment: 0.0, onPressed: () async {
child: child, 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,
), ),
); ),
}, SizedBox(width: 8.h),
child: isExpanded Expanded(
? Container( flex: 1,
key: ValueKey<int>(index), child: Container(
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 8.h), height: 40.h,
child: Column( width: 40.w,
crossAxisAlignment: CrossAxisAlignment.start, decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
children: [ color: AppColors.textColor,
...model.patientPrescriptionOrdersViewList[index].prescriptionsList!.map((prescription) { borderRadius: 12,
return Column( ),
crossAxisAlignment: CrossAxisAlignment.start, child: Padding(
children: [ padding: EdgeInsets.all(12.h),
Row( child: Transform.flip(
mainAxisSize: MainAxisSize.min, flipX: appState.isArabic(),
children: [ child: Utils.buildSvgWithAssets(
Image.network( icon: AppAssets.forward_arrow_icon_small,
prescription.doctorImageURL!, iconColor: AppColors.whiteColor,
width: 24.h, fit: BoxFit.contain,
height: 24.h, ),
fit: BoxFit.fill, ),
).circle(100), ),
SizedBox(width: 8.h), ).onPress(() {
Expanded(child: prescription.doctorName!.toText14(weight: FontWeight.w500)), model.setPrescriptionsDetailsLoading();
], Navigator.of(context).push(
), CustomPageRoute(
SizedBox(height: 8.h), page: PrescriptionDetailPage(
Wrap( prescriptionsResponseModel: model.patientPrescriptionOrders[index],
direction: Axis.horizontal, isFromAppointments: false,
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(), }),
),
],
), ),
// 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(() { scheduleMicrotask(() {
insuranceViewModel.initInsuranceProvider(); insuranceViewModel.initInsuranceProvider();
}); });
_loadPermissions();
super.initState(); super.initState();
} }
@ -92,6 +93,7 @@ class ProfileSettingsState extends State<ProfileSettings> {
final SwiperController _controller = SwiperController(); final SwiperController _controller = SwiperController();
late InsuranceViewModel insuranceViewModel; late InsuranceViewModel insuranceViewModel;
late ContactUsViewModel contactUsViewModel; late ContactUsViewModel contactUsViewModel;
String _permissionsLabel = "";
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -294,6 +296,9 @@ class ProfileSettingsState extends State<ProfileSettings> {
launchUrl(Uri.parse("tel://" + "+966 92 006 6666")); launchUrl(Uri.parse("tel://" + "+966 92 006 6666"));
}, trailingLabel: "92 006 6666"), }, trailingLabel: "92 006 6666"),
1.divider, 1.divider,
actionItem(AppAssets.permission, LocaleKeys.permissionsProfile.tr(context: context), () {
openAppSettings();
}, trailingLabel: getCurrentPermissions()),
actionItem(AppAssets.feedbackFill, LocaleKeys.feedback.tr(context: context), () { actionItem(AppAssets.feedbackFill, LocaleKeys.feedback.tr(context: context), () {
contactUsViewModel.setSelectedFeedbackType( contactUsViewModel.setSelectedFeedbackType(
FeedbackType(id: 5, nameEN: "Not classified", nameAR: 'غير محدد'), 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}) { Widget actionItem(String icon, String label, VoidCallback onPress, {String trailingLabel = "", bool? switchValue, ValueChanged<bool>? onSwitchChanged, bool isExternalLink = false}) {
return SizedBox( return SizedBox(
height: 56.h, height: 56.h,

@ -3,6 +3,8 @@ import 'dart:async';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.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/date_util.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.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/core/utils/utils.dart';
@ -96,40 +98,40 @@ class _RadiologyOrdersPageState extends State<RadiologyOrdersPage> {
children: [ children: [
// Clinic / Hospital toggle // Clinic / Hospital toggle
SizedBox(height: 16.h), SizedBox(height: 16.h),
Row( // Row(
children: [ // children: [
CustomButton( // CustomButton(
text: LocaleKeys.byClinic.tr(context: context), // text: LocaleKeys.byClinic.tr(context: context),
onPressed: () { // onPressed: () {
model.setIsSortByClinic(true); // model.setIsSortByClinic(true);
}, // },
backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, // backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor,
borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), // borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2),
textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, // textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor,
fontSize: 12, // fontSize: 12,
fontWeight: FontWeight.w500, // fontWeight: FontWeight.w500,
borderRadius: 10, // borderRadius: 10,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h, // height: 40.h,
), // ),
SizedBox(width: 8.h), // SizedBox(width: 8.h),
CustomButton( // CustomButton(
text: LocaleKeys.byHospital.tr(context: context), // text: LocaleKeys.byHospital.tr(context: context),
onPressed: () { // onPressed: () {
model.setIsSortByClinic(false); // model.setIsSortByClinic(false);
}, // },
backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, // backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor,
borderColor: model.isSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor, // borderColor: model.isSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor,
textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, // textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor,
fontSize: 12, // fontSize: 12,
fontWeight: FontWeight.w500, // fontWeight: FontWeight.w500,
borderRadius: 10, // borderRadius: 10,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h, // height: 40.h,
), // ),
], // ],
), // ),
SizedBox(height: 8.h), // SizedBox(height: 8.h),
selectedFilterText.isNotEmpty selectedFilterText.isNotEmpty
? AppCustomChipWidget( ? AppCustomChipWidget(
padding: EdgeInsets.symmetric(horizontal: 5.h), 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 Utils.getNoDataWidget(ctx, noDataText: LocaleKeys.youDontHaveRadiologyOrders.tr(context: context));
} }
return ListView.builder( // return ListView.builder(
shrinkWrap: true, // shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), // physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.zero, // padding: EdgeInsets.zero,
itemCount: model.patientRadiologyOrdersViewList.length, // itemCount: model.patientRadiologyOrdersViewList.length,
itemBuilder: (context, index) { // itemBuilder: (context, index) {
final group = model.patientRadiologyOrdersViewList[index]; // final group = model.patientRadiologyOrdersViewList[index];
final displayName = model.isSortByClinic ? (group.first.clinicDescription ?? 'Unknown') : (group.first.projectName ?? 'Unknown'); // final displayName = model.isSortByClinic ? (group.first.clinicDescription ?? 'Unknown') : (group.first.projectName ?? 'Unknown');
final isExpanded = expandedIndex == index; // final isExpanded = expandedIndex == index;
return AnimationConfiguration.staggeredList( // 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, position: index,
duration: const Duration(milliseconds: 400), duration: const Duration(milliseconds: 500),
child: SlideAnimation( child: SlideAnimation(
verticalOffset: 50.0, verticalOffset: 100.0,
child: FadeInAnimation( child: FadeInAnimation(
child: AnimatedContainer( child: AnimatedContainer(
duration: const Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
curve: Curves.easeInOut, curve: Curves.easeInOut,
margin: EdgeInsets.symmetric(vertical: 8.h), margin: EdgeInsets.symmetric(vertical: 8.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true),
color: AppColors.whiteColor,
borderRadius: 20.h,
hasShadow: true,
),
child: InkWell( child: InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
expandedIndex = isExpanded ? null : index; 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( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
key: _groupKeys.putIfAbsent(index, () => GlobalKey()),
padding: EdgeInsets.all(16.h), padding: EdgeInsets.all(16.h),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ 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( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.min,
children: [ children: [
AppCustomChipWidget(labelText: "${group.length} ${LocaleKeys.results.tr(context: context)}"), Image.network(
Icon(isExpanded ? Icons.expand_less : Icons.expand_more), 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), SizedBox(height: 8.h),
Text( Wrap(
displayName, direction: Axis.horizontal,
style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600), spacing: 4.h,
overflow: TextOverflow.ellipsis, 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( // AnimatedSwitcher(
duration: const Duration(milliseconds: 500), // duration: Duration(milliseconds: 500),
switchInCurve: Curves.easeIn, // switchInCurve: Curves.easeIn,
switchOutCurve: Curves.easeOut, // switchOutCurve: Curves.easeOut,
transitionBuilder: (Widget child, Animation<double> animation) { // transitionBuilder: (Widget child, Animation<double> animation) {
return FadeTransition( // return FadeTransition(
opacity: animation, // opacity: animation,
child: SizeTransition( // child: SizeTransition(
sizeFactor: animation, // sizeFactor: animation,
axisAlignment: 0.0, // axisAlignment: 0.0,
child: child, // child: child,
), // ),
); // );
}, // },
child: isExpanded // child: isExpanded
? Container( // ? Container(
key: ValueKey<int>(index), // key: ValueKey<int>(index),
padding: EdgeInsets.symmetric(horizontal: 16.w), // padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 0.h),
child: Column( // child: Column(
crossAxisAlignment: CrossAxisAlignment.start, // children: [
children: [ // ListView.separated(
...group.map<Widget>((order) { // shrinkWrap: true,
return Column( // physics: NeverScrollableScrollPhysics(),
crossAxisAlignment: CrossAxisAlignment.start, // padding: EdgeInsets.zero,
children: [ // itemBuilder: (cxt, index) {
Row( // PatientRadiologyResponseModel order = group;
mainAxisSize: MainAxisSize.min, // return Column(
children: [ // crossAxisAlignment: CrossAxisAlignment.start,
Image.network( // children: [
order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", // "${order.procedureName ?? ""}".toText14(weight: FontWeight.w500),
width: 24.w, // "Lorem ipsum text".toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight),
height: 24.h, // // SizedBox(height: 4.h),
fit: BoxFit.cover, // // order.testDetails![index].testDescriptionEn!.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight),
).circle(100), // // Row(
SizedBox(width: 8.h), // // mainAxisSize: MainAxisSize.min,
Expanded( // // children: [
child: (order.doctorName ?? '').toString().toText14(weight: FontWeight.w500), // // Image.network(
), // // order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png",
], // // width: 24.w,
), // // height: 24.h,
SizedBox(height: 8.h), // // fit: BoxFit.cover,
Wrap( // // ).circle(100),
direction: Axis.horizontal, // // SizedBox(width: 8.h),
spacing: 4.h, // // Expanded(child: (order.doctorName ?? order.doctorNameEnglish ?? "").toString().toText14(weight: FontWeight.w500)),
runSpacing: 4.h, // // ],
children: [ // // ),
if ((order.description ?? '').isNotEmpty) // // SizedBox(height: 8.h),
AppCustomChipWidget( // // Wrap(
labelText: (order.description ?? '').toString(), // // direction: Axis.horizontal,
), // // spacing: 4.h,
Directionality( // // runSpacing: 4.h,
textDirection: ui.TextDirection.ltr, // // children: [
child: AppCustomChipWidget( // // AppCustomChipWidget(
labelText: DateUtil.formatDateToDate( // // labelText: ("${LocaleKeys.orderNo.tr(context: context)}: ${order.orderNo!}"), isEnglishOnly: true,
(order.orderDate ?? order.appointmentDate), // // ),
false, // // Directionality(
), isEnglishOnly: true, // // textDirection: ui.TextDirection.ltr,
), // // child: AppCustomChipWidget(
), // // labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false),
AppCustomChipWidget( // // isEnglishOnly: true,
labelText: model.isSortByClinic ? (order.projectName ?? '') : (order.clinicDescription ?? ''), // // )),
), // // AppCustomChipWidget(
], // // labelText: labViewModel.isSortByClinic ? (order.projectName ?? "") : (order.clinicDescription ?? ""),
), // // ),
SizedBox(height: 12.h), // // ],
Row( // // ),
children: [ // // // Row(
Expanded(flex: 2, child: const SizedBox()), // // // children: [
Expanded( // // // CustomButton(
flex: 2, // // // text: ("Order No: ".needTranslation + order.orderNo!),
child: CustomButton( // // // onPressed: () {},
icon: AppAssets.view_report_icon, // // // backgroundColor: AppColors.greyColor,
iconColor: AppColors.primaryRedColor, // // // borderColor: AppColors.greyColor,
iconSize: 16.h, // // // textColor: AppColors.blackColor,
text: LocaleKeys.viewResults.tr(context: context), // // // fontSize: 10,
onPressed: () { // // // fontWeight: FontWeight.w500,
model.navigationService.push( // // // borderRadius: 8,
CustomPageRoute( // // // padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
page: RadiologyResultPage(patientRadiologyResponseModel: order), // // // height: 24.h,
), // // // ),
); // // // SizedBox(width: 8.h),
}, // // // CustomButton(
backgroundColor: AppColors.secondaryLightRedColor, // // // text: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false),
borderColor: AppColors.secondaryLightRedColor, // // // onPressed: () {},
textColor: AppColors.primaryRedColor, // // // backgroundColor: AppColors.greyColor,
fontSize: 14, // // // borderColor: AppColors.greyColor,
fontWeight: FontWeight.w500, // // // textColor: AppColors.blackColor,
borderRadius: 12, // // // fontSize: 10,
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), // // // fontWeight: FontWeight.w500,
height: 40.h, // // // borderRadius: 8,
), // // // padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
), // // // height: 24.h,
], // // // ),
), // // // ],
SizedBox(height: 12.h), // // // ),
Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), // // // SizedBox(height: 8.h),
SizedBox(height: 12.h), // // // Row(
], // // // children: [
); // // // CustomButton(
}).toList(), // // // text: model.isSortByClinic ? (order.clinicDescription ?? "") : (order.projectName ?? ""),
], // // // onPressed: () {},
), // // // backgroundColor: AppColors.greyColor,
) // // // borderColor: AppColors.greyColor,
: const SizedBox.shrink(), // // // 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( Expanded(
child: CollapsingListView( child: CollapsingListView(
title: LocaleKeys.radiologyResult.tr(context: context), title: LocaleKeys.radiologyResult.tr(context: context),
viewImage: () { downloadReport: () async {
if (radiologyViewModel.radiologyImageURL.isNotEmpty) { LoaderBottomSheet.showLoader();
Uri uri = Uri.parse(radiologyViewModel.radiologyImageURL); await radiologyViewModel
launchUrl(uri, mode: LaunchMode.platformDefault, webOnlyWindowName: ""); .getRadiologyPDF(
} else { patientRadiologyResponseModel: widget.patientRadiologyResponseModel,
Utils.showToast("Radiology image not available"); 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: SingleChildScrollView(
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 24.h), padding: EdgeInsets.symmetric(horizontal: 24.h),
@ -124,54 +158,28 @@ class _RadiologyResultPageState extends State<RadiologyResultPage> {
borderRadius: 24.h, borderRadius: 24.h,
hasShadow: true, hasShadow: true,
), ),
child: CustomButton( child: widget.patientRadiologyResponseModel.dIAPACSURL != "" ? CustomButton(
text: LocaleKeys.downloadReport.tr(context: context), text: LocaleKeys.openRad.tr(context: context),
onPressed: () async { onPressed: () async {
LoaderBottomSheet.showLoader(); if (radiologyViewModel.radiologyImageURL.isNotEmpty) {
await radiologyViewModel Uri uri = Uri.parse(radiologyViewModel.radiologyImageURL);
.getRadiologyPDF( launchUrl(uri, mode: LaunchMode.platformDefault, webOnlyWindowName: "");
patientRadiologyResponseModel: widget.patientRadiologyResponseModel, } else {
authenticatedUser: _appState.getAuthenticatedUser()!, Utils.showToast("Radiology image not available");
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,
);
}
}
});
}, },
backgroundColor: AppColors.successColor, backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.successColor, borderColor: AppColors.primaryRedColor,
textColor: Colors.white, textColor: Colors.white,
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
borderRadius: 12, borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0), padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 45.h, height: 45.h,
icon: AppAssets.download, icon: AppAssets.imageIcon,
iconColor: Colors.white, iconColor: Colors.white,
iconSize: 20.h, 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? doctorResponse;
VoidCallback? downloadReport; VoidCallback? downloadReport;
VoidCallback? viewImage; VoidCallback? viewImage;
VoidCallback? location;
Widget? bottomChild; Widget? bottomChild;
Widget? trailing; Widget? trailing;
bool isClose; bool isClose;
@ -51,6 +52,7 @@ class CollapsingListView extends StatelessWidget {
this.doctorResponse, this.doctorResponse,
this.downloadReport, this.downloadReport,
this.viewImage, this.viewImage,
this.location,
this.isLeading = true, this.isLeading = true,
this.trailing, this.trailing,
this.leadingCallback, this.leadingCallback,
@ -95,6 +97,7 @@ class CollapsingListView extends StatelessWidget {
doctorResponse: doctorResponse, doctorResponse: doctorResponse,
downloadReport: downloadReport, downloadReport: downloadReport,
viewImage: viewImage, viewImage: viewImage,
location: location,
bottomChild: bottomChild, bottomChild: bottomChild,
trailing: trailing, trailing: trailing,
aiOverview: aiOverview, aiOverview: aiOverview,
@ -208,6 +211,7 @@ class ScrollAnimatedTitle extends StatefulWidget implements PreferredSizeWidget
VoidCallback? doctorResponse; VoidCallback? doctorResponse;
VoidCallback? downloadReport; VoidCallback? downloadReport;
VoidCallback? viewImage; VoidCallback? viewImage;
VoidCallback? location;
Widget? bottomChild; Widget? bottomChild;
Widget? trailing; Widget? trailing;
@ -227,6 +231,7 @@ class ScrollAnimatedTitle extends StatefulWidget implements PreferredSizeWidget
this.doctorResponse, this.doctorResponse,
this.downloadReport, this.downloadReport,
this.viewImage, this.viewImage,
this.location,
this.bottomChild, this.bottomChild,
this.trailing, 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.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.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.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!, if (widget.trailing != null) widget.trailing!,
] ]
], ],

@ -2,6 +2,7 @@ import 'dart:io' show Platform;
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.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_assets.dart';
import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/core/utils/calender_utils_new.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/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.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/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/services/permission_service.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
@ -22,19 +24,66 @@ class BottomSheetUtils {
_showReminderBottomSheet(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, _showReminderBottomSheet(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed); onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed);
} else { } else {
// Utils.showPermissionConsentDialog(context, TranslationBase.of(context).calendarPermission, () async { showCommonBottomSheetWithoutHeight(
// if (await Permission.calendarFullAccess.request().isGranted) { title: LocaleKeys.notice.tr(context: GetIt.instance<NavigationService>().navigatorKey.currentContext!),
// _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, GetIt.instance<NavigationService>().navigatorKey.currentContext!,
// onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed); 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 { } else {
if (await Permission.calendarWriteOnly.request().isGranted) { if (await Permission.calendarWriteOnly.request().isGranted) {
if (await Permission.calendarFullAccess.request().isGranted) { if (await Permission.calendarFullAccess.request().isGranted) {
_showReminderBottomSheet(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, _showReminderBottomSheet(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed); 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