From 936682ff95bd5bc0ded1ac60b15caabc6771303b Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Tue, 15 Oct 2024 17:40:24 +0300 Subject: [PATCH 1/3] WD: clinic by hospital --- android/app/build.gradle | 2 +- lib/config/config.dart | 1 + lib/config/localized_values.dart | 2 + lib/pages/BookAppointment/Search.dart | 53 +- .../components/search_by_hospital_name.dart | 513 ++++++++++++++++++ .../dialog/clinic_list_dialog.dart | 2 +- .../appointment_services/GetDoctorsList.dart | 2 +- .../clinic_services/get_clinic_service.dart | 13 + lib/uitl/translations_delegate_base.dart | 3 + 9 files changed, 578 insertions(+), 13 deletions(-) create mode 100644 lib/pages/BookAppointment/components/search_by_hospital_name.dart diff --git a/android/app/build.gradle b/android/app/build.gradle index b5f2d00f..a75b8ca5 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -199,7 +199,7 @@ dependencies { implementation files('libs/Penguin.aar') implementation files('libs/PenguinRenderer.aar') - implementation "org.jetbrains.anko:anko-commons:0.10.4" +// implementation "org.jetbrains.anko:anko-commons:0.10.4" implementation 'com.github.kittinunf.fuel:fuel:2.3.0' //for JVM implementation 'com.github.kittinunf.fuel:fuel-android:2.3.0' implementation 'com.google.android.gms:play-services-location:17.1.0'//for Android diff --git a/lib/config/config.dart b/lib/config/config.dart index 16a900ec..a574c111 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -215,6 +215,7 @@ var GET_QR_PARKING = 'Services/SWP.svc/REST/GetQRParkingByID'; //URL to get clinic list var GET_CLINICS_LIST_URL = "Services/lists.svc/REST/GetClinicCentralized"; +var GET_CLINICS_LIST_WRT_HOSPITAL_URL = "Services/Lists.svc/REST/GetClinicFromDoctorSchedule"; //URL to get active appointment list var GET_ACTIVE_APPOINTMENTS_LIST_URL = "Services/Doctors.svc/Rest/Dr_GetAppointmentActiveNumber"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 7107d357..8ac98ce0 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -45,6 +45,8 @@ const Map localizedValues = { 'name': {'en': 'Name', 'ar': 'الإسم'}, 'doctor': {'en': 'Doctor', 'ar': 'الطبيب'}, 'clinicName': {'en': 'Clinic Name', 'ar': 'اسم العيادة'}, + 'hospitalName': {'en': 'Hospital Name', 'ar': 'اسم المستشفى'}, + 'NoClinicFound': {'en': 'No Clinic Found', 'ar': 'لم يتم العثور على عيادة'}, 'doctorName': {'en': 'Doctor Name', 'ar': 'إسم الطبيب'}, 'nearestAppo': {'en': 'Nearest Appointment', 'ar': 'أقرب موعد'}, 'searchByDocText': {'en': 'Type the name of the doctor to help you find him', 'ar': 'اكتب اسم الطبيب لمساعدتك في العثور عليه'}, diff --git a/lib/pages/BookAppointment/Search.dart b/lib/pages/BookAppointment/Search.dart index b5680c1c..0cd0da0f 100644 --- a/lib/pages/BookAppointment/Search.dart +++ b/lib/pages/BookAppointment/Search.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByClinic.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByDoctor.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/components/search_by_hospital_name.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -28,15 +29,20 @@ class _SearchState extends State with TickerProviderStateMixin { @override void initState() { - _tabController = new TabController(length: 2, vsync: this, initialIndex: widget.type, ); + _tabController = new TabController( + length: 3, + vsync: this, + initialIndex: widget.type, + ); super.initState(); } @override Widget build(BuildContext context) { AppGlobal.context = context; - // ProjectViewModel projectViewModel = Provider.of(context); - GAnalytics.TREATMENT_TYPE = null; // reset treatment type on start new booking + // ProjectViewModel projectViewModel = Provider.of(context); + GAnalytics.TREATMENT_TYPE = + null; // reset treatment type on start new booking return AppScaffold( isShowAppBar: false, @@ -54,33 +60,60 @@ class _SearchState extends State with TickerProviderStateMixin { indicatorSize: TabBarIndicatorSize.tab, labelColor: Color(0xff2B353E), unselectedLabelColor: Color(0xff575757), - labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelPadding: + EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), labelStyle: TextStyle( - fontFamily: context.read().isArabic ? 'Cairo' : 'Poppins', + fontFamily: context.read().isArabic + ? 'Cairo' + : 'Poppins', fontSize: 16, fontWeight: FontWeight.w600, letterSpacing: -0.48, ), unselectedLabelStyle: TextStyle( - fontFamily: context.read().isArabic ? 'Cairo' : 'Poppins', + fontFamily: context.read().isArabic + ? 'Cairo' + : 'Poppins', fontSize: 16, fontWeight: FontWeight.w600, letterSpacing: -0.48, ), - tabs: [Text(TranslationBase.of(context).clinicName), Text(TranslationBase.of(context).doctorName)], + tabs: [ + + Text( + TranslationBase.of(context).clinicName, + style: TextStyle(fontSize: 12), + ), + Text( + TranslationBase.of(context).hospitalName, + style: TextStyle(fontSize: 12), + ), + Text( + TranslationBase.of(context).doctorName, + style: TextStyle(fontSize: 12), + ) + ], onTap: (idx) { if (idx == 0) - context.read().analytics.appointment.book_appointment_by_clinic(); + context + .read() + .analytics + .appointment + .book_appointment_by_clinic(); else - context.read().analytics.appointment.book_appointment_by_doctor(); + context + .read() + .analytics + .appointment + .book_appointment_by_doctor(); }, ), Expanded( child: TabBarView( - physics: NeverScrollableScrollPhysics(), children: [ SearchByClinic(clnicIds: widget.clnicIds), + SearchByHospital(), SearchByDoctor(), ], controller: _tabController, diff --git a/lib/pages/BookAppointment/components/search_by_hospital_name.dart b/lib/pages/BookAppointment/components/search_by_hospital_name.dart new file mode 100644 index 00000000..2813391b --- /dev/null +++ b/lib/pages/BookAppointment/components/search_by_hospital_name.dart @@ -0,0 +1,513 @@ +import 'dart:collection'; + +import 'package:auto_size_text/auto_size_text.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../../../config/shared_pref_kay.dart'; +import '../../../config/size_config.dart'; +import '../../../core/model/hospitals/hospitals_model.dart'; +import '../../../core/viewModels/project_view_model.dart'; +import '../../../models/Appointments/DoctorListResponse.dart'; +import '../../../models/Appointments/SearchInfoModel.dart'; +import '../../../models/Clinics/ClinicListResponse.dart'; +import '../../../services/appointment_services/GetDoctorsList.dart'; +import '../../../services/authentication/auth_provider.dart'; +import '../../../services/clinic_services/get_clinic_service.dart'; +import '../../../uitl/app_toast.dart'; +import '../../../uitl/gif_loader_dialog_utils.dart'; +import '../../../uitl/translations_delegate_base.dart'; +import '../../../widgets/transitions/fade_page.dart'; +import '../../livecare/livecare_home.dart'; +import '../DentalComplaints.dart'; +import '../LaserBooking.dart'; +import '../SearchResults.dart'; +import '../dialog/clinic_list_dialog.dart'; +import 'LiveCareBookAppointment.dart'; + +class SearchByHospital extends StatefulWidget { + @override + State createState() => _SearchByHospitalState(); +} + +class _SearchByHospitalState extends State { + HospitalsModel? selectedHospital; + bool nearestAppo = false; + + String? selectedClinicName; + List projectsList = []; + List? clinicIds = List.empty(); + + final GlobalKey projectDropdownKey = GlobalKey(); + + List clinicsList = []; + bool isMobileAppDentalAllow = false; + ListClinicCentralized? selectedClinic; + + String? dropdownValue; + String dropdownTitle = ""; + + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback((_) => getProjectsList()); + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Padding( + padding: const EdgeInsets.only(left: 6, right: 6, top: 16), + child: Row( + children: [ + Checkbox( + activeColor: CustomColors.accentColor, + value: nearestAppo, + onChanged: (bool? value) { + nearestAppo = value?? false; + setState(() { + + }); + }, + ), + AutoSizeText( + TranslationBase.of(context).nearestAppo.trim(), + maxLines: 1, + minFontSize: 10, + style: TextStyle( + fontSize: SizeConfig.textMultiplier! * 1.4, + fontWeight: FontWeight.w600, + letterSpacing: -0.39, + height: 0.8, + ), + ), + // Text(TranslationBase.of(context).nearestAppo, style: TextStyle(fontSize: 14.0, letterSpacing: -0.56)), + ], + ), + ), + + mHeight(8), + Container( + width: double.infinity, + decoration: containerRadius(Colors.white, 12), + margin: EdgeInsets.only(left: 20, right: 20), + padding: + EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), + child: Row( + children: [ + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectHospital, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ), + Container( + height: 18, + width: double.infinity, + child: DropdownButtonHideUnderline( + child: DropdownButton( + hint: Text( + TranslationBase.of(context).selectHospital), + value: selectedHospital, + iconSize: 0, + isExpanded: true, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.56, + color: Colors.black), + items: projectsList.map((HospitalsModel item) { + return DropdownMenuItem( + value: item, + child: AutoSizeText( + item.name!, + maxLines: 1, + minFontSize: 10, + style: TextStyle( + fontSize: + SizeConfig.textMultiplier! * 1.6, + fontWeight: FontWeight.w600, + letterSpacing: -0.39, + height: 0.8, + ), + ), + // Text('${item.name!}'), + ); + }).toList(), + onChanged: (HospitalsModel? newValue) async { + getClinicWrtHospital(newValue); + // setState(() { + // selectedHospital = newValue; + // }); + }, + ), + ), + ), + ], + ), + ), + Icon(Icons.keyboard_arrow_down), + ], + )), + if (clinicIds?.isNotEmpty == true) ...[ + mHeight(8), + InkWell( + onTap: () { + showClickListDialog(context, clinicIds ?? List.empty(), + onSelection: (ListClinicCentralized clincs) { + selectedClinic = clincs; + Navigator.pop(context); + setState(() { + dropdownTitle = clincs.clinicDescription!; + dropdownValue = clincs.clinicID.toString() + + "-" + + clincs.isLiveCareClinicAndOnline.toString() + + "-" + + clincs.liveCareClinicID.toString() + + "-" + + clincs.liveCareServiceID.toString(); + }); + getDoctorsList(context); + + context + .read() + .analytics + .appointment + .book_appointment_select_clinic( + appointment_type: 'regular', + clinic: clincs.clinicDescription); + }); + }, + child: Container( + width: double.infinity, + decoration: containerRadius(Colors.white, 12), + margin: EdgeInsets.only(left: 20, right: 20), + padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 8), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).selectClinic, + style: TextStyle( + fontSize: 11, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 4, bottom: 2), + child: Text( + dropdownTitle, + style: TextStyle( + fontSize: 13, + letterSpacing: -0.44, + fontWeight: FontWeight.w600, + ), + ), + ), + ], + ), + ), + Icon(Icons.keyboard_arrow_down), + ], + ), + ), + ) + ] + ], + ); + } + + void openDropdown(GlobalKey key) { + GestureDetector? detector; + detector = searchForGestureDetector(key.currentContext!); + assert(detector != null); + detector!.onTap!(); + } + + GestureDetector? searchForGestureDetector(BuildContext element) { + GestureDetector? detector; + element.visitChildElements((element) { + if (element.widget != null && element.widget is GestureDetector) { + detector = element.widget as GestureDetector?; + //return false; + } else { + searchForGestureDetector(element); + } + }); + return detector; + } + + getProjectsList() { + GifLoaderDialogUtils.showMyDialog(context); + + int languageID = context.read().isArabic ? 1 : 2; + ClinicListService service = new ClinicListService(); + List projectsListLocal = []; + service.getProjectsList(languageID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + + if (res['MessageStatus'] == 1) { + setState(() { + res['ListProject'].forEach((v) { + projectsListLocal.add(new HospitalsModel.fromJson(v)); + }); + projectsList = projectsListLocal; + }); + } else {} + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + + print(err); + }); + } + + + + void getClinicWrtHospital(HospitalsModel? newValue) { + GifLoaderDialogUtils.showMyDialog(context); + ClinicListService service = new ClinicListService(); + List projectsListLocal = []; + setState(() { + clinicIds = List.empty(); + }); + List clinicId = []; + service + .getClinicByHospital( + projectID: newValue?.mainProjectID.toString() ?? "") + .then((res) { + print("the result is obtained"); + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + List list = res['ListClinic']; + + if(list.isEmpty){ + AppToast.showErrorToast(message: + TranslationBase.of(context).NoClinicFound, + ); + + } + res['ListClinic'].forEach((v) { + clinicId?.add(ListClinicCentralized.fromJson(v)); + }); + clinicIds = clinicId; + setState(() { + + }); + } else { + AppToast.showErrorToast(message: + TranslationBase.of(context).NoClinicFound, + ); + } + }).catchError((err) { + print('the error is $err'); + AppToast.showErrorToast(message: + TranslationBase.of(context).NoClinicFound, + ); + GifLoaderDialogUtils.hideDialog(context); + }).catchError((err) { + AppToast.showErrorToast(message: + TranslationBase.of(context).NoClinicFound, + ); + GifLoaderDialogUtils.hideDialog(context); + + print(err); + }); + } + + Future navigateToDentalComplaints( + BuildContext context, SearchInfo searchInfo) async { + Navigator.push( + context, + FadePage( + page: DentalComplaints(searchInfo: searchInfo), + ), + ).then((value) { + setState(() { + dropdownValue = null; + selectedHospital = null; + clinicIds = List.empty(); + }); + }); + } + + callDoctorsSearchAPI(int clinicID) { + int languageID = context.read().isArabic ? 1 : 2; + GifLoaderDialogUtils.showMyDialog(context); + List doctorsList = []; + List arr = []; + List arrDistance = []; + List result; + int numAll; + List _patientDoctorAppointmentListHospital = + []; + + DoctorsListService service = new DoctorsListService(); + service + .getDoctorsList( + clinicID, + selectedHospital?.mainProjectID.toString() != "" + ? int.parse(selectedHospital?.mainProjectID.toString() ?? "-1") + : 0, + nearestAppo, + languageID, + null) + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + setState(() { + if (res['DoctorList'].length != 0) { + doctorsList.clear(); + res['DoctorList'].forEach((v) { + doctorsList.add(new DoctorList.fromJson(v)); + }); + doctorsList.forEach((element) { + List doctorByHospital = + _patientDoctorAppointmentListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[ + _patientDoctorAppointmentListHospital + .indexOf(doctorByHospital[0])] + .patientDoctorAppointmentList! + .add(element); + } else { + _patientDoctorAppointmentListHospital.add( + PatientDoctorAppointmentList( + filterName: element.projectName, + distanceInKMs: + element.projectDistanceInKiloMeters.toString(), + patientDoctorAppointment: element)); + } + }); + } else {} + }); + + result = LinkedHashSet.from(arr).toList(); + numAll = result.length; + navigateToSearchResults( + context, doctorsList, _patientDoctorAppointmentListHospital); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + AppToast.showErrorToast(message: err, localContext: context); + }); + } + + Future navigateToSearchResults( + context, + List docList, + List + patientDoctorAppointmentListHospital) async { + Navigator.push( + context, + FadePage( + page: SearchResults( + isLiveCareAppointment: false, + doctorsList: docList, + patientDoctorAppointmentListHospital: + patientDoctorAppointmentListHospital))) + .then((value) { + + print("navigation return "); + dropdownValue = null; + dropdownTitle = ""; + selectedHospital = null; + clinicIds = List.empty(); + setState(() { + + }); + // getProjectsList(); + }); + } + + Future navigateToLaserClinic(BuildContext context) async { + Navigator.push( + context, + FadePage( + page: LaserBooking(), + ), + ).then((value) { + print("LaserBooking navigation return "); + setState(() { + dropdownValue = null; + selectedHospital = null; + clinicIds = List.empty(); + }); + }); + } + + getDoctorsList(BuildContext context) { + SearchInfo searchInfo = new SearchInfo(); + if (dropdownValue != null) if (dropdownValue!.split("-")[0] == "17") { + searchInfo.ProjectID = int.parse(selectedHospital?.mainProjectID ?? ""); + searchInfo.ClinicID = int.parse(dropdownValue!.split("-")[0]); + searchInfo.hospital = selectedHospital; + searchInfo.clinic = selectedClinic; + searchInfo.date = DateTime.now(); + + if (context.read().isLogin) { + if (context.read().user.age! > 12) { + navigateToDentalComplaints(context, searchInfo); + } else { + callDoctorsSearchAPI(17); + } + } else { + navigateToDentalComplaints(context, searchInfo); + } + } else if (dropdownValue!.split("-")[0] == "253") { + navigateToLaserClinic(context); + // callDoctorsSearchAPI(); + } else if (dropdownValue!.split("-")[1] == "true" + // && authProvider.isLogin && + // authUser.patientType == 1 + ) { + Navigator.push( + context, + FadePage( + page: LiveCareBookAppointment( + clinicName: dropdownTitle, + liveCareClinicID: dropdownValue!.split("-")[2], + liveCareServiceID: dropdownValue!.split("-")[3]), + ), + ).then((value) { + print("navigation return "); + if (value == "false") dropdownValue = null; + + // setState(() { + // }); + if (value == "livecare") { + Navigator.push(context, FadePage(page: LiveCareHome())); + } + if (value == "schedule") { + callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0])); + } + }); + setState(() { + + }); + } else { + callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0])); + } + } +} diff --git a/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart b/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart index ecbe1003..c3d82c74 100644 --- a/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart +++ b/lib/pages/BookAppointment/dialog/clinic_list_dialog.dart @@ -115,7 +115,7 @@ class _ClickListDialogState extends State { ), ), ), - tempClinicsList[index].isLiveCareClinicAndOnline! + tempClinicsList[index].isLiveCareClinicAndOnline == true ? SvgPicture.asset( 'assets/images/new-design/video_icon_green_right.svg', height: 12, diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index aaf30b97..841fe6c6 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -34,7 +34,7 @@ class DoctorsListService extends BaseService { String? tokenID; List selectedBodyPartList = []; - Future getDoctorsList(int clinicID, int projectID, bool isNearest, int languageID, BuildContext context, {doctorId, doctorName, isContinueDentalPlan = false}) async { + Future getDoctorsList(int clinicID, int projectID, bool isNearest, int languageID, BuildContext? context, {doctorId, doctorName, isContinueDentalPlan = false}) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index dc494a61..fb7ae8c1 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -34,6 +34,19 @@ class ClinicListService extends BaseService { return Future.value(localRes); } + Future getClinicByHospital({required String projectID}) async { + Map request = {"ProjectID": projectID}; + + dynamic localRes; + + await baseAppClient.post(GET_CLINICS_LIST_WRT_HOSPITAL_URL, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future getActiveAppointmentNo(context) async { Map request = {}; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 01e737a8..366def26 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -59,7 +59,10 @@ class TranslationBase { String get clinicName => localizedValues['clinicName'][locale.languageCode]; + String get hospitalName => localizedValues['hospitalName'][locale.languageCode]; + String get doctorName => localizedValues['doctorName'][locale.languageCode]; + String get NoClinicFound => localizedValues['NoClinicFound'][locale.languageCode]; String get nearestAppo => localizedValues['nearestAppo'][locale.languageCode]; From fe9d259cbdb6c6a6ad82309b3a83cf6440c92094 Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Wed, 16 Oct 2024 10:16:59 +0300 Subject: [PATCH 2/3] build context handled --- .../components/search_by_hospital_name.dart | 239 +++++++++++------- 1 file changed, 150 insertions(+), 89 deletions(-) diff --git a/lib/pages/BookAppointment/components/search_by_hospital_name.dart b/lib/pages/BookAppointment/components/search_by_hospital_name.dart index 2813391b..3de28dff 100644 --- a/lib/pages/BookAppointment/components/search_by_hospital_name.dart +++ b/lib/pages/BookAppointment/components/search_by_hospital_name.dart @@ -1,6 +1,7 @@ import 'dart:collection'; import 'package:auto_size_text/auto_size_text.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/material.dart'; @@ -56,6 +57,8 @@ class _SearchByHospitalState extends State { @override Widget build(BuildContext context) { + AppGlobal.context = context; + return Column( children: [ Padding( @@ -66,14 +69,17 @@ class _SearchByHospitalState extends State { activeColor: CustomColors.accentColor, value: nearestAppo, onChanged: (bool? value) { - nearestAppo = value?? false; + nearestAppo = value ?? false; setState(() { }); }, ), AutoSizeText( - TranslationBase.of(context).nearestAppo.trim(), + TranslationBase + .of(context) + .nearestAppo + .trim(), maxLines: 1, minFontSize: 10, style: TextStyle( @@ -94,7 +100,7 @@ class _SearchByHospitalState extends State { decoration: containerRadius(Colors.white, 12), margin: EdgeInsets.only(left: 20, right: 20), padding: - EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), + EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), child: Row( children: [ Flexible( @@ -102,7 +108,9 @@ class _SearchByHospitalState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase.of(context).selectHospital, + TranslationBase + .of(context) + .selectHospital, style: TextStyle( fontSize: 11, letterSpacing: -0.44, @@ -115,7 +123,9 @@ class _SearchByHospitalState extends State { child: DropdownButtonHideUnderline( child: DropdownButton( hint: Text( - TranslationBase.of(context).selectHospital), + TranslationBase + .of(context) + .selectHospital), value: selectedHospital, iconSize: 0, isExpanded: true, @@ -132,7 +142,7 @@ class _SearchByHospitalState extends State { minFontSize: 10, style: TextStyle( fontSize: - SizeConfig.textMultiplier! * 1.6, + SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.w600, letterSpacing: -0.39, height: 0.8, @@ -141,11 +151,11 @@ class _SearchByHospitalState extends State { // Text('${item.name!}'), ); }).toList(), - onChanged: (HospitalsModel? newValue) async { + onChanged: (HospitalsModel? newValue){ getClinicWrtHospital(newValue); - // setState(() { - // selectedHospital = newValue; - // }); + setState(() { + selectedHospital = newValue; + }); }, ), ), @@ -162,28 +172,29 @@ class _SearchByHospitalState extends State { onTap: () { showClickListDialog(context, clinicIds ?? List.empty(), onSelection: (ListClinicCentralized clincs) { - selectedClinic = clincs; - Navigator.pop(context); - setState(() { - dropdownTitle = clincs.clinicDescription!; - dropdownValue = clincs.clinicID.toString() + + selectedClinic = clincs; + Navigator.pop(context); + setState(() { + dropdownTitle = clincs.clinicDescription!; + dropdownValue = clincs.clinicID.toString() + "-" + clincs.isLiveCareClinicAndOnline.toString() + "-" + clincs.liveCareClinicID.toString() + "-" + - clincs.liveCareServiceID.toString(); - }); - getDoctorsList(context); - - context - .read() - .analytics - .appointment - .book_appointment_select_clinic( + clincs.liveCareServiceID.toString( + ); + }); + getDoctorsList(context); + + context + .read() + .analytics + .appointment + .book_appointment_select_clinic( appointment_type: 'regular', clinic: clincs.clinicDescription); - }); + }); }, child: Container( width: double.infinity, @@ -197,7 +208,9 @@ class _SearchByHospitalState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase.of(context).selectClinic, + TranslationBase + .of(context) + .selectClinic, style: TextStyle( fontSize: 11, letterSpacing: -0.44, @@ -230,7 +243,7 @@ class _SearchByHospitalState extends State { void openDropdown(GlobalKey key) { GestureDetector? detector; - detector = searchForGestureDetector(key.currentContext!); + detector = searchForGestureDetector(key.currentContext!); assert(detector != null); detector!.onTap!(); } @@ -251,7 +264,9 @@ class _SearchByHospitalState extends State { getProjectsList() { GifLoaderDialogUtils.showMyDialog(context); - int languageID = context.read().isArabic ? 1 : 2; + int languageID = context + .read() + .isArabic ? 1 : 2; ClinicListService service = new ClinicListService(); List projectsListLocal = []; service.getProjectsList(languageID, context).then((res) { @@ -275,8 +290,7 @@ class _SearchByHospitalState extends State { } - - void getClinicWrtHospital(HospitalsModel? newValue) { + void getClinicWrtHospital(HospitalsModel? newValue) async { GifLoaderDialogUtils.showMyDialog(context); ClinicListService service = new ClinicListService(); List projectsListLocal = []; @@ -284,23 +298,25 @@ class _SearchByHospitalState extends State { clinicIds = List.empty(); }); List clinicId = []; - service - .getClinicByHospital( - projectID: newValue?.mainProjectID.toString() ?? "") - .then((res) { - print("the result is obtained"); + try { + Map res = await service + .getClinicB + + yHospital( + projectID: newValue?.mainProjectID.toString() ?? ""); GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { List list = res['ListClinic']; - if(list.isEmpty){ + if (list.isEmpty) { AppToast.showErrorToast(message: - TranslationBase.of(context).NoClinicFound, + TranslationBase + .of(context) + .NoClinicFound, ); - } res['ListClinic'].forEach((v) { - clinicId?.add(ListClinicCentralized.fromJson(v)); + clinicId.add(ListClinicCentralized.fromJson(v)); }); clinicIds = clinicId; setState(() { @@ -308,27 +324,67 @@ class _SearchByHospitalState extends State { }); } else { AppToast.showErrorToast(message: - TranslationBase.of(context).NoClinicFound, + TranslationBase + .of(context) + .NoClinicFound, ); } - }).catchError((err) { - print('the error is $err'); - AppToast.showErrorToast(message: - TranslationBase.of(context).NoClinicFound, - ); - GifLoaderDialogUtils.hideDialog(context); - }).catchError((err) { + } catch (e) { + print("the error is $e"); AppToast.showErrorToast(message: - TranslationBase.of(context).NoClinicFound, - ); - GifLoaderDialogUtils.hideDialog(context); + TranslationBase.of(context).NoClinicFound, + ); + GifLoaderDialogUtils.hideDialog(context); - print(err); - }); + } + + // .then((res) { + // print("the result is obtained"); + // GifLoaderDialogUtils.hideDialog(context); + // if (res['MessageStatus'] == 1) { + // List list = res['ListClinic']; + // + // if(list.isEmpty){ + // AppToast.showErrorToast(message: + // TranslationBase.of(context).NoClinicFound, + // ); + // + // } + // res['ListClinic'].forEach((v) { + // clinicId?.add(ListClinicCentralized.fromJson(v)); + // }); + // clinicIds = clinicId; + // setState(() { + // + // }); + // } else { + // AppToast.showErrorToast(message: + // TranslationBase.of(context).NoClinicFound, + // ); + // } + // }).catchError((err) { + // print('the error is $err'); + // AppToast.showErrorToast(message: + // TranslationBase.of(context).NoClinicFound, + // ); + // GifLoaderDialogUtils.hideDialog(context); + // }).catchError((err) { + // AppToast.showErrorToast(message: + // TranslationBase.of(context).NoClinicFound, + // ); + // GifLoaderDialogUtils.hideDialog(context); + // + // print(err); + // }); } - Future navigateToDentalComplaints( - BuildContext context, SearchInfo searchInfo) async { + @override + void dispose() { + super.dispose(); + } + + Future navigateToDentalComplaints(BuildContext context, + SearchInfo searchInfo) async { Navigator.push( context, FadePage( @@ -344,7 +400,9 @@ class _SearchByHospitalState extends State { } callDoctorsSearchAPI(int clinicID) { - int languageID = context.read().isArabic ? 1 : 2; + int languageID = context + .read() + .isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); List doctorsList = []; List arr = []; @@ -352,18 +410,18 @@ class _SearchByHospitalState extends State { List result; int numAll; List _patientDoctorAppointmentListHospital = - []; + []; DoctorsListService service = new DoctorsListService(); service .getDoctorsList( - clinicID, - selectedHospital?.mainProjectID.toString() != "" - ? int.parse(selectedHospital?.mainProjectID.toString() ?? "-1") - : 0, - nearestAppo, - languageID, - null) + clinicID, + selectedHospital?.mainProjectID.toString() != "" + ? int.parse(selectedHospital?.mainProjectID.toString() ?? "-1") + : 0, + nearestAppo, + languageID, + null) .then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { @@ -371,21 +429,21 @@ class _SearchByHospitalState extends State { if (res['DoctorList'].length != 0) { doctorsList.clear(); res['DoctorList'].forEach((v) { - doctorsList.add(new DoctorList.fromJson(v)); + doctorsList.add( DoctorList.fromJson(v)); }); doctorsList.forEach((element) { List doctorByHospital = - _patientDoctorAppointmentListHospital - .where( - (elementClinic) => - elementClinic.filterName == element.projectName, - ) - .toList(); + _patientDoctorAppointmentListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.projectName, + ) + .toList(); if (doctorByHospital.length != 0) { _patientDoctorAppointmentListHospital[ - _patientDoctorAppointmentListHospital - .indexOf(doctorByHospital[0])] + _patientDoctorAppointmentListHospital + .indexOf(doctorByHospital[0])] .patientDoctorAppointmentList! .add(element); } else { @@ -393,7 +451,7 @@ class _SearchByHospitalState extends State { PatientDoctorAppointmentList( filterName: element.projectName, distanceInKMs: - element.projectDistanceInKiloMeters.toString(), + element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); } }); @@ -414,21 +472,19 @@ class _SearchByHospitalState extends State { }); } - Future navigateToSearchResults( - context, + Future navigateToSearchResults(context, List docList, List - patientDoctorAppointmentListHospital) async { + patientDoctorAppointmentListHospital) async { Navigator.push( - context, - FadePage( - page: SearchResults( - isLiveCareAppointment: false, - doctorsList: docList, - patientDoctorAppointmentListHospital: - patientDoctorAppointmentListHospital))) + context, + FadePage( + page: SearchResults( + isLiveCareAppointment: false, + doctorsList: docList, + patientDoctorAppointmentListHospital: + patientDoctorAppointmentListHospital))) .then((value) { - print("navigation return "); dropdownValue = null; dropdownTitle = ""; @@ -466,8 +522,13 @@ class _SearchByHospitalState extends State { searchInfo.clinic = selectedClinic; searchInfo.date = DateTime.now(); - if (context.read().isLogin) { - if (context.read().user.age! > 12) { + if (context + .read() + .isLogin) { + if (context + .read() + .user + .age! > 12) { navigateToDentalComplaints(context, searchInfo); } else { callDoctorsSearchAPI(17); @@ -479,9 +540,9 @@ class _SearchByHospitalState extends State { navigateToLaserClinic(context); // callDoctorsSearchAPI(); } else if (dropdownValue!.split("-")[1] == "true" - // && authProvider.isLogin && - // authUser.patientType == 1 - ) { + // && authProvider.isLogin && + // authUser.patientType == 1 + ) { Navigator.push( context, FadePage( From 81b94814ce4f0a1e4626fe07a9b7933246d71336 Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Thu, 17 Oct 2024 11:10:21 +0300 Subject: [PATCH 3/3] WD: hospital top and bottom name added --- .../Appointments/DoctorListResponse.dart | 12 +- lib/pages/BookAppointment/Search.dart | 7 +- .../components/SearchByClinic.dart | 2 +- .../components/SearchByDoctor.dart | 2 +- .../components/search_by_hospital_name.dart | 184 +++++++----------- 5 files changed, 89 insertions(+), 118 deletions(-) diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 205909c9..93cb81e5 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -44,6 +44,8 @@ class DoctorList { List? specialityN; dynamic workingHours; dynamic decimalDoctorRate; + String? projectBottomName; + String? projectTopName; DoctorList( {this.clinicID, @@ -90,7 +92,9 @@ class DoctorList { this.speciality, this.specialityN, this.workingHours, - this.decimalDoctorRate}); + this.decimalDoctorRate, + this.projectBottomName, + this.projectTopName}); DoctorList.fromJson(Map json) { clinicID = json['ClinicID']; @@ -138,6 +142,8 @@ class DoctorList { if (json.containsKey('SpecialityN') && json['SpecialityN'] != null) specialityN = json['SpecialityN'].cast(); workingHours = json['WorkingHours']; decimalDoctorRate = json['DecimalDoctorRate']; + projectBottomName = json['ProjectNameBottom']; + projectTopName = json['ProjectNameTop']; } Map toJson() { @@ -188,6 +194,10 @@ class DoctorList { data['DecimalDoctorRate'] = this.decimalDoctorRate; return data; } + + String getProjectCompleteName(){ + return "${this.projectTopName} ${this.projectBottomName}"; + } } class PatientDoctorAppointmentList { diff --git a/lib/pages/BookAppointment/Search.dart b/lib/pages/BookAppointment/Search.dart index 0cd0da0f..c7989cbf 100644 --- a/lib/pages/BookAppointment/Search.dart +++ b/lib/pages/BookAppointment/Search.dart @@ -79,13 +79,12 @@ class _SearchState extends State with TickerProviderStateMixin { letterSpacing: -0.48, ), tabs: [ - Text( - TranslationBase.of(context).clinicName, + TranslationBase.of(context).hospitalName, style: TextStyle(fontSize: 12), ), Text( - TranslationBase.of(context).hospitalName, + TranslationBase.of(context).clinicName, style: TextStyle(fontSize: 12), ), Text( @@ -112,8 +111,8 @@ class _SearchState extends State with TickerProviderStateMixin { child: TabBarView( physics: NeverScrollableScrollPhysics(), children: [ - SearchByClinic(clnicIds: widget.clnicIds), SearchByHospital(), + SearchByClinic(clnicIds: widget.clnicIds), SearchByDoctor(), ], controller: _tabController, diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 849a0afc..f89b6349 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -656,7 +656,7 @@ class _SearchByClinicState extends State { _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element); } else { _patientDoctorAppointmentListHospital - .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); + .add(PatientDoctorAppointmentList(filterName: element.getProjectCompleteName(), distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); } }); } else {} diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index f5c98d87..55f1a31d 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -111,7 +111,7 @@ class _SearchByDoctorState extends State { _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element); } else { _patientDoctorAppointmentListHospital - .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); + .add(PatientDoctorAppointmentList(filterName: element.getProjectCompleteName(), distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); } }); } else { diff --git a/lib/pages/BookAppointment/components/search_by_hospital_name.dart b/lib/pages/BookAppointment/components/search_by_hospital_name.dart index 3de28dff..d6315e35 100644 --- a/lib/pages/BookAppointment/components/search_by_hospital_name.dart +++ b/lib/pages/BookAppointment/components/search_by_hospital_name.dart @@ -70,16 +70,11 @@ class _SearchByHospitalState extends State { value: nearestAppo, onChanged: (bool? value) { nearestAppo = value ?? false; - setState(() { - - }); + setState(() {}); }, ), AutoSizeText( - TranslationBase - .of(context) - .nearestAppo - .trim(), + TranslationBase.of(context).nearestAppo.trim(), maxLines: 1, minFontSize: 10, style: TextStyle( @@ -93,14 +88,12 @@ class _SearchByHospitalState extends State { ], ), ), - mHeight(8), Container( width: double.infinity, decoration: containerRadius(Colors.white, 12), margin: EdgeInsets.only(left: 20, right: 20), - padding: - EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), + padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), child: Row( children: [ Flexible( @@ -108,9 +101,7 @@ class _SearchByHospitalState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase - .of(context) - .selectHospital, + TranslationBase.of(context).selectHospital, style: TextStyle( fontSize: 11, letterSpacing: -0.44, @@ -123,9 +114,7 @@ class _SearchByHospitalState extends State { child: DropdownButtonHideUnderline( child: DropdownButton( hint: Text( - TranslationBase - .of(context) - .selectHospital), + TranslationBase.of(context).selectHospital), value: selectedHospital, iconSize: 0, isExpanded: true, @@ -141,8 +130,7 @@ class _SearchByHospitalState extends State { maxLines: 1, minFontSize: 10, style: TextStyle( - fontSize: - SizeConfig.textMultiplier! * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.w600, letterSpacing: -0.39, height: 0.8, @@ -151,7 +139,7 @@ class _SearchByHospitalState extends State { // Text('${item.name!}'), ); }).toList(), - onChanged: (HospitalsModel? newValue){ + onChanged: (HospitalsModel? newValue) { getClinicWrtHospital(newValue); setState(() { selectedHospital = newValue; @@ -172,29 +160,28 @@ class _SearchByHospitalState extends State { onTap: () { showClickListDialog(context, clinicIds ?? List.empty(), onSelection: (ListClinicCentralized clincs) { - selectedClinic = clincs; - Navigator.pop(context); - setState(() { - dropdownTitle = clincs.clinicDescription!; - dropdownValue = clincs.clinicID.toString() + + selectedClinic = clincs; + Navigator.pop(context); + setState(() { + dropdownTitle = clincs.clinicDescription!; + dropdownValue = clincs.clinicID.toString() + "-" + clincs.isLiveCareClinicAndOnline.toString() + "-" + clincs.liveCareClinicID.toString() + "-" + - clincs.liveCareServiceID.toString( - ); - }); - getDoctorsList(context); - - context - .read() - .analytics - .appointment - .book_appointment_select_clinic( + clincs.liveCareServiceID.toString(); + }); + getDoctorsList(context); + + context + .read() + .analytics + .appointment + .book_appointment_select_clinic( appointment_type: 'regular', clinic: clincs.clinicDescription); - }); + }); }, child: Container( width: double.infinity, @@ -208,9 +195,7 @@ class _SearchByHospitalState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase - .of(context) - .selectClinic, + TranslationBase.of(context).selectClinic, style: TextStyle( fontSize: 11, letterSpacing: -0.44, @@ -264,9 +249,7 @@ class _SearchByHospitalState extends State { getProjectsList() { GifLoaderDialogUtils.showMyDialog(context); - int languageID = context - .read() - .isArabic ? 1 : 2; + int languageID = context.read().isArabic ? 1 : 2; ClinicListService service = new ClinicListService(); List projectsListLocal = []; service.getProjectsList(languageID, context).then((res) { @@ -289,7 +272,6 @@ class _SearchByHospitalState extends State { }); } - void getClinicWrtHospital(HospitalsModel? newValue) async { GifLoaderDialogUtils.showMyDialog(context); ClinicListService service = new ClinicListService(); @@ -299,43 +281,33 @@ class _SearchByHospitalState extends State { }); List clinicId = []; try { - Map res = await service - .getClinicB - - yHospital( + Map res = await service.getClinicByHospital( projectID: newValue?.mainProjectID.toString() ?? ""); GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { List list = res['ListClinic']; if (list.isEmpty) { - AppToast.showErrorToast(message: - TranslationBase - .of(context) - .NoClinicFound, + AppToast.showErrorToast( + message: TranslationBase.of(context).NoClinicFound, ); } res['ListClinic'].forEach((v) { clinicId.add(ListClinicCentralized.fromJson(v)); }); clinicIds = clinicId; - setState(() { - - }); + setState(() {}); } else { - AppToast.showErrorToast(message: - TranslationBase - .of(context) - .NoClinicFound, + AppToast.showErrorToast( + message: TranslationBase.of(context).NoClinicFound, ); } } catch (e) { print("the error is $e"); - AppToast.showErrorToast(message: - TranslationBase.of(context).NoClinicFound, - ); - GifLoaderDialogUtils.hideDialog(context); - + AppToast.showErrorToast( + message: TranslationBase.of(context).NoClinicFound, + ); + GifLoaderDialogUtils.hideDialog(context); } // .then((res) { @@ -383,8 +355,8 @@ class _SearchByHospitalState extends State { super.dispose(); } - Future navigateToDentalComplaints(BuildContext context, - SearchInfo searchInfo) async { + Future navigateToDentalComplaints( + BuildContext context, SearchInfo searchInfo) async { Navigator.push( context, FadePage( @@ -400,9 +372,7 @@ class _SearchByHospitalState extends State { } callDoctorsSearchAPI(int clinicID) { - int languageID = context - .read() - .isArabic ? 1 : 2; + int languageID = context.read().isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); List doctorsList = []; List arr = []; @@ -410,18 +380,18 @@ class _SearchByHospitalState extends State { List result; int numAll; List _patientDoctorAppointmentListHospital = - []; + []; DoctorsListService service = new DoctorsListService(); service .getDoctorsList( - clinicID, - selectedHospital?.mainProjectID.toString() != "" - ? int.parse(selectedHospital?.mainProjectID.toString() ?? "-1") - : 0, - nearestAppo, - languageID, - null) + clinicID, + selectedHospital?.mainProjectID.toString() != "" + ? int.parse(selectedHospital?.mainProjectID.toString() ?? "-1") + : 0, + nearestAppo, + languageID, + null) .then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { @@ -429,29 +399,29 @@ class _SearchByHospitalState extends State { if (res['DoctorList'].length != 0) { doctorsList.clear(); res['DoctorList'].forEach((v) { - doctorsList.add( DoctorList.fromJson(v)); + doctorsList.add(DoctorList.fromJson(v)); }); doctorsList.forEach((element) { List doctorByHospital = - _patientDoctorAppointmentListHospital - .where( - (elementClinic) => - elementClinic.filterName == element.projectName, - ) - .toList(); + _patientDoctorAppointmentListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.projectName, + ) + .toList(); if (doctorByHospital.length != 0) { _patientDoctorAppointmentListHospital[ - _patientDoctorAppointmentListHospital - .indexOf(doctorByHospital[0])] + _patientDoctorAppointmentListHospital + .indexOf(doctorByHospital[0])] .patientDoctorAppointmentList! .add(element); } else { _patientDoctorAppointmentListHospital.add( PatientDoctorAppointmentList( - filterName: element.projectName, + filterName: element.getProjectCompleteName(), distanceInKMs: - element.projectDistanceInKiloMeters.toString(), + element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); } }); @@ -472,27 +442,26 @@ class _SearchByHospitalState extends State { }); } - Future navigateToSearchResults(context, + Future navigateToSearchResults( + context, List docList, List - patientDoctorAppointmentListHospital) async { + patientDoctorAppointmentListHospital) async { Navigator.push( - context, - FadePage( - page: SearchResults( - isLiveCareAppointment: false, - doctorsList: docList, - patientDoctorAppointmentListHospital: - patientDoctorAppointmentListHospital))) + context, + FadePage( + page: SearchResults( + isLiveCareAppointment: false, + doctorsList: docList, + patientDoctorAppointmentListHospital: + patientDoctorAppointmentListHospital))) .then((value) { print("navigation return "); dropdownValue = null; dropdownTitle = ""; selectedHospital = null; clinicIds = List.empty(); - setState(() { - - }); + setState(() {}); // getProjectsList(); }); } @@ -522,13 +491,8 @@ class _SearchByHospitalState extends State { searchInfo.clinic = selectedClinic; searchInfo.date = DateTime.now(); - if (context - .read() - .isLogin) { - if (context - .read() - .user - .age! > 12) { + if (context.read().isLogin) { + if (context.read().user.age! > 12) { navigateToDentalComplaints(context, searchInfo); } else { callDoctorsSearchAPI(17); @@ -540,9 +504,9 @@ class _SearchByHospitalState extends State { navigateToLaserClinic(context); // callDoctorsSearchAPI(); } else if (dropdownValue!.split("-")[1] == "true" - // && authProvider.isLogin && - // authUser.patientType == 1 - ) { + // && authProvider.isLogin && + // authUser.patientType == 1 + ) { Navigator.push( context, FadePage( @@ -564,9 +528,7 @@ class _SearchByHospitalState extends State { callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0])); } }); - setState(() { - - }); + setState(() {}); } else { callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0])); }