diff --git a/lib/presentation/home/data/hospital_list_data.dart b/lib/presentation/home/data/hospital_list_data.dart new file mode 100644 index 00000000..7ff9b6b0 --- /dev/null +++ b/lib/presentation/home/data/hospital_list_data.dart @@ -0,0 +1,16 @@ +class HospitalListItem { + final String nameEn; + final String nameAr; + final String id; + + HospitalListItem({ + required this.nameEn, + required this.nameAr, + required this.id, + }); +} + +List hospitalList = [ + HospitalListItem( + nameEn: "Sahafa Hospital", nameAr: "مستشفى الصحافة", id: "130") +]; diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index 26e5147f..45153a26 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -269,6 +269,7 @@ class _LandingPageState extends State { horizontalOffset: 100.0, child: FadeInAnimation( child: SmallServiceCard( + serviceName: LandingPageData.getNotLoggedInServiceCardsList[index].serviceName, icon: LandingPageData.getNotLoggedInServiceCardsList[index].icon, title: LandingPageData.getNotLoggedInServiceCardsList[index].title, subtitle: LandingPageData.getNotLoggedInServiceCardsList[index].subtitle, diff --git a/lib/presentation/home/widgets/hospital_list_item.dart b/lib/presentation/home/widgets/hospital_list_item.dart new file mode 100644 index 00000000..2e0c15c4 --- /dev/null +++ b/lib/presentation/home/widgets/hospital_list_item.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/widget_previews.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; + +import '../../../theme/colors.dart'; + +class HospitalListItemWidget extends StatelessWidget{ + final String name; + final String id; + final Function(String , String) onTap; + + const HospitalListItemWidget({super.key, required this.name, required this.id, required this.onTap}); + + @Preview(name: "sample Hospital List item preview") + @override + Widget build(BuildContext context) { + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 20.h, + hasShadow: true, + + ), + child: ListTile( + title: Text(name), + trailing: Icon(Icons.arrow_forward), + onTap:(){ + onTap(name, id); + }, + ), + ); + } + +} \ No newline at end of file diff --git a/lib/presentation/home/widgets/hospital_selection_bottom_sheet.dart b/lib/presentation/home/widgets/hospital_selection_bottom_sheet.dart new file mode 100644 index 00000000..7fd0272e --- /dev/null +++ b/lib/presentation/home/widgets/hospital_selection_bottom_sheet.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/app_export.dart'; +import 'package:hmg_patient_app_new/presentation/home/data/hospital_list_data.dart'; +import 'package:hmg_patient_app_new/presentation/home/widgets/hospital_list_item.dart'; + +class HospitalBottomSheet extends StatelessWidget { + final Function(String, String) onHospitalSelected; + final List hospitals; + + const HospitalBottomSheet( + {super.key, required this.onHospitalSelected, required this.hospitals}); + + @override + Widget build(BuildContext context) { + return SizedBox( + height: 140.h, + child: ListView.builder( + shrinkWrap: true, + itemCount: hospitals.length, + itemBuilder: (_, index) { + return HospitalListItemWidget( + name: hospitals[index].nameEn, + id: hospitals[index].id, + onTap: onHospitalSelected, + ); + }), + ); + } +} diff --git a/lib/presentation/home/widgets/small_service_card.dart b/lib/presentation/home/widgets/small_service_card.dart index 6e1c588a..7e41f236 100644 --- a/lib/presentation/home/widgets/small_service_card.dart +++ b/lib/presentation/home/widgets/small_service_card.dart @@ -1,17 +1,22 @@ import 'package:flutter/material.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/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/presentation/appointments/my_doctors_page.dart'; +import 'package:hmg_patient_app_new/presentation/home/widgets/hospital_selection_bottom_sheet.dart'; import 'package:hmg_patient_app_new/presentation/insurance/insurance_home_page.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_orders_page.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/patient_sickleaves_list_page.dart'; import 'package:hmg_patient_app_new/presentation/prescriptions/prescriptions_list_page.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart' + show showCommonBottomSheetWithoutHeight; import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; import '../../../core/utils/utils.dart'; import '../../../theme/colors.dart'; import '../../radiology/radiology_orders_page.dart' show RadiologyOrdersPage; +import '../data/hospital_list_data.dart' show hospitalList; class SmallServiceCard extends StatelessWidget { final String serviceName; @@ -23,7 +28,7 @@ class SmallServiceCard extends StatelessWidget { final Color backgroundColor; final bool isBold; - SmallServiceCard({ + const SmallServiceCard({ super.key, this.icon = "", this.serviceName = "", @@ -49,10 +54,12 @@ class SmallServiceCard extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Utils.buildSvgWithAssets(icon: icon, iconColor: iconColor, width: 32.h, height: 32.h), + Utils.buildSvgWithAssets( + icon: icon, iconColor: iconColor, width: 32.h, height: 32.h), SizedBox(height: 6.h), title.toText11(color: textColor, isBold: isBold, isCenter: true), - subtitle.toText11(color: textColor, isBold: isBold, isCenter: true), + subtitle.toText11( + color: textColor, isBold: isBold, isCenter: true), ], ), ), @@ -103,10 +110,28 @@ class SmallServiceCard extends StatelessWidget { ), ); break; + case "indoor_navigation": + openHospitalSelectionBottomSheet(context); + break; default: // Handle unknown service break; } }); } + + void openHospitalSelectionBottomSheet(BuildContext context) { + showCommonBottomSheetWithoutHeight( + context, + title: "Select Hospital", + child: HospitalBottomSheet( + onHospitalSelected: (name, id) { + PenguinMethodChannel.launch("penguin", "en", "1", + details: NavigationClinicDetails(projectId: id)); + Navigator.pop(context); + }, + hospitals: hospitalList), + callBackFunc: () {}, + ); + } }