|
|
|
|
@ -9,6 +9,7 @@ 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/calender_utils_new.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/penguin_method_channel.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
|
|
|
|
@ -17,6 +18,7 @@ import 'package:hmg_patient_app_new/features/book_appointments/book_appointments
|
|
|
|
|
import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/doctors_list_response_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/contact_us/models/feedback_type.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/hospital/AppPermission.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/features/lab/lab_view_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/my_appointments_view_model.dart';
|
|
|
|
|
@ -40,6 +42,7 @@ import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
|
|
|
|
|
import 'package:map_launcher/map_launcher.dart';
|
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import '../medical_file/widgets/medical_file_card.dart';
|
|
|
|
|
@ -230,19 +233,23 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.785,
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
await MapLauncher.showMarker(
|
|
|
|
|
mapType: MapType.google,
|
|
|
|
|
coords: Coords(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!),
|
|
|
|
|
double.parse(widget.patientAppointmentHistoryResponseModel.longitude!)),
|
|
|
|
|
title: widget.patientAppointmentHistoryResponseModel.projectName ?? "Habib Hospital",
|
|
|
|
|
).catchError((err) {
|
|
|
|
|
MapLauncher.showMarker(
|
|
|
|
|
mapType: Platform.isIOS ? MapType.apple : MapType.google,
|
|
|
|
|
if (widget.patientAppointmentHistoryResponseModel.projectID == 130 || widget.patientAppointmentHistoryResponseModel.projectID == 120) {
|
|
|
|
|
showDirectionsBottomSheet();
|
|
|
|
|
} else {
|
|
|
|
|
await MapLauncher.showMarker(
|
|
|
|
|
mapType: MapType.google,
|
|
|
|
|
coords: Coords(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!),
|
|
|
|
|
double.parse(widget.patientAppointmentHistoryResponseModel.longitude!)),
|
|
|
|
|
title: widget.patientAppointmentHistoryResponseModel.projectName ?? "Habib Hospital",
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
).catchError((err) {
|
|
|
|
|
MapLauncher.showMarker(
|
|
|
|
|
mapType: Platform.isIOS ? MapType.apple : MapType.google,
|
|
|
|
|
coords: Coords(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!),
|
|
|
|
|
double.parse(widget.patientAppointmentHistoryResponseModel.longitude!)),
|
|
|
|
|
title: widget.patientAppointmentHistoryResponseModel.projectName ?? "Habib Hospital",
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
text: LocaleKeys.getDirections.tr(context: context),
|
|
|
|
|
backgroundColor: AppColors.textColor.withValues(alpha: 0.8),
|
|
|
|
|
@ -819,6 +826,89 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void showDirectionsBottomSheet() {
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
context,
|
|
|
|
|
title: "",
|
|
|
|
|
isDismissible: true,
|
|
|
|
|
isCloseButtonVisible: false,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.confirmYourLocation.tr(context: context).toText28(color: AppColors.textColor, isBold: true, height: 1.5),
|
|
|
|
|
SizedBox(height: 4.h),
|
|
|
|
|
LocaleKeys.confirmYourLocationDesc.tr(context: context).toText12(
|
|
|
|
|
color: AppColors.greyTextColor,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 24.h),
|
|
|
|
|
CustomButton(
|
|
|
|
|
text: LocaleKeys.insideHospital.tr(context: context),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
initPenguinSDK(widget.patientAppointmentHistoryResponseModel.projectID == 130 ? 1 : (widget.patientAppointmentHistoryResponseModel.projectID == 120 ? 3 : -1),
|
|
|
|
|
clinicID: widget.patientAppointmentHistoryResponseModel.clinicID.toString());
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: AppColors.primaryRedColor,
|
|
|
|
|
borderColor: AppColors.primaryRedColor,
|
|
|
|
|
textColor: AppColors.whiteColor,
|
|
|
|
|
fontSize: 16.f,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
borderRadius: 12.r,
|
|
|
|
|
// padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
|
|
|
height: 56.h,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 8.h),
|
|
|
|
|
CustomButton(
|
|
|
|
|
text: LocaleKeys.outsideHospital.tr(context: context),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
await MapLauncher.showMarker(
|
|
|
|
|
mapType: MapType.google,
|
|
|
|
|
coords: Coords(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!), double.parse(widget.patientAppointmentHistoryResponseModel.longitude!)),
|
|
|
|
|
title: widget.patientAppointmentHistoryResponseModel.projectName ?? "Habib Hospital",
|
|
|
|
|
).catchError((err) {
|
|
|
|
|
MapLauncher.showMarker(
|
|
|
|
|
mapType: Platform.isIOS ? MapType.apple : MapType.google,
|
|
|
|
|
coords: Coords(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!), double.parse(widget.patientAppointmentHistoryResponseModel.longitude!)),
|
|
|
|
|
title: widget.patientAppointmentHistoryResponseModel.projectName ?? "Habib Hospital",
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: AppColors.chipSecondaryLightRedColor,
|
|
|
|
|
borderColor: AppColors.chipSecondaryLightRedColor,
|
|
|
|
|
textColor: AppColors.primaryRedColor,
|
|
|
|
|
fontSize: 16.f,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
borderRadius: 12.r,
|
|
|
|
|
// padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
|
|
|
height: 56.h,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).paddingSymmetrical(24.w, 20.h),
|
|
|
|
|
callBackFunc: () {},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initPenguinSDK(int projectID, {String clinicID = ""}) async {
|
|
|
|
|
NavigationClinicDetails data = NavigationClinicDetails();
|
|
|
|
|
data.projectId = projectID.toString();
|
|
|
|
|
data.clinicId = clinicID;
|
|
|
|
|
// data.clinicId = "1";
|
|
|
|
|
final bool permited = await AppPermission.askPenguinPermissions();
|
|
|
|
|
if (!permited) {
|
|
|
|
|
Map<Permission, PermissionStatus> statuses = await [
|
|
|
|
|
Permission.location,
|
|
|
|
|
Permission.bluetooth,
|
|
|
|
|
Permission.bluetoothConnect,
|
|
|
|
|
Permission.bluetoothScan,
|
|
|
|
|
Permission.activityRecognition,
|
|
|
|
|
].request().whenComplete(() {
|
|
|
|
|
PenguinMethodChannel().launch("penguin", getIt.get<AppState>().isArabic() ? "ar" : "en", getIt.get<AppState>().getAuthenticatedUser()?.patientId?.toString() ?? "", true, details: data);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openDoctorScheduleCalendar() async {
|
|
|
|
|
DoctorsListResponseModel doctor = DoctorsListResponseModel(
|
|
|
|
|
clinicID: widget.patientAppointmentHistoryResponseModel.clinicID,
|
|
|
|
|
|