From a7f5dfab5c5f972a90f12fa46d45652dc4206ff5 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 2 Sep 2020 12:22:05 +0300 Subject: [PATCH] fixes --- lib/models/Appointments/DoctorListResponse.dart | 3 ++- lib/pages/BookAppointment/SearchResults.dart | 5 +++-- .../BookAppointment/components/SearchByDoctor.dart | 1 + .../appointment_services/GetDoctorsList.dart | 12 ++++++++++-- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 8e1f0b35..66c0c855 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -169,10 +169,11 @@ class DoctorList { class PatientDoctorAppointmentList { String filterName = ""; + String distanceInKMs = ""; List patientDoctorAppointmentList = List(); PatientDoctorAppointmentList( - {this.filterName, DoctorList patientDoctorAppointment}) { + {this.filterName, this.distanceInKMs, DoctorList patientDoctorAppointment}) { patientDoctorAppointmentList.add(patientDoctorAppointment); } } diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index 8b9dd984..c52002b4 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -33,7 +33,7 @@ class _SearchResultsState extends State { appBarTitle: TranslationBase.of(context).bookAppo, isShowAppBar: true, body: Container( - margin: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.all(10.0), child: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Column( @@ -42,7 +42,8 @@ class _SearchResultsState extends State { widget.patientDoctorAppointmentListHospital.length, (index) => AppExpandableNotifier( title: widget - .patientDoctorAppointmentListHospital[index].filterName, + .patientDoctorAppointmentListHospital[index].filterName + " - " +widget + .patientDoctorAppointmentListHospital[index].distanceInKMs + " KMs" , bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 4fb55c7c..1e7deb38 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -117,6 +117,7 @@ class _SearchByDoctorState extends State { _patientDoctorAppointmentListHospital.add( PatientDoctorAppointmentList( filterName: element.projectName, + distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); } }); diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 27a66d43..61845095 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -79,12 +79,20 @@ class DoctorsListService extends BaseService { Future getDoctorsListByName(String docName, BuildContext context) async { Map request; + double lat; + double long; + if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson( await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } + if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { + lat = await this.sharedPref.getDouble(USER_LAT); + long = await this.sharedPref.getDouble(USER_LONG); + } + var languageID = await sharedPref.getString(APP_LANGUAGE); Request req = appGlobal.getPublicRequest(); request = { @@ -106,8 +114,8 @@ class DoctorsListService extends BaseService { "gender": authUser.gender != null ? authUser.gender : 0, "age": authUser.age != null ? authUser.age : 0, "IsGetNearAppointment": false, - "Latitude": 0, - "Longitude": 0, + "Latitude": lat, + "Longitude": long, "License": true };