diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index ce00c085..f207ee15 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -18,19 +18,21 @@ import '../util/helpers.dart'; const GET_PATIENT_VITAL_SIGN = BASE_URL + 'Doctors.svc/REST/Doctor_GetPatientVitalSign'; -const GET_PATIENT_LAB_OREDERS =BASE_URL + 'DoctorApplication.svc/REST/GetPatientLabOreders'; -const GET_PRESCRIPTION =BASE_URL+'Patients.svc/REST/GetPrescriptionApptList'; -const GET_RADIOLOGY = BASE_URL+'DoctorApplication.svc/REST/GetPatientRadResult'; +const GET_PATIENT_LAB_OREDERS = + BASE_URL + 'DoctorApplication.svc/REST/GetPatientLabOreders'; +const GET_PRESCRIPTION = BASE_URL + 'Patients.svc/REST/GetPrescriptionApptList'; +const GET_RADIOLOGY = + BASE_URL + 'DoctorApplication.svc/REST/GetPatientRadResult'; + class PatientsProvider with ChangeNotifier { - bool isLoading = true; + bool isLoading = false; bool isError = false; String error = ''; List patientVitalSignList = []; - List patientLabResultOrdersList = []; - List patientPrescriptionsList = []; - List patientRadiologyList = []; + List patientLabResultOrdersList = []; + List patientPrescriptionsList = []; + List patientRadiologyList = []; - Client client = HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); @@ -79,6 +81,13 @@ class PatientsProvider with ChangeNotifier { } } + setBasicData() { + isLoading = true; + isError = false; + error = ''; + notifyListeners(); + } + /* *@author: Elham Rababah *@Date:27/4/2020 @@ -87,6 +96,8 @@ class PatientsProvider with ChangeNotifier { *@desc: getPatientVitalSign */ getPatientVitalSign(patient) async { + setBasicData(); + try { if (await Helpers.checkConnection()) { final response = await client.post(GET_PATIENT_VITAL_SIGN, @@ -138,6 +149,10 @@ class PatientsProvider with ChangeNotifier { *@desc: getLabResult Orders */ getLabResultOrders(patient) async { + // isLoading = true; + // notifyListeners(); + setBasicData(); + try { if (await Helpers.checkConnection()) { final response = await client.post(GET_PATIENT_LAB_OREDERS, @@ -179,11 +194,15 @@ class PatientsProvider with ChangeNotifier { *@return: *@desc: getPatientPrescriptions */ -getPatientPrescriptions(patient) async { + getPatientPrescriptions(patient) async { + // isLoading = true; + // notifyListeners(); + setBasicData(); + try { if (await Helpers.checkConnection()) { - final response = await client.post(GET_PRESCRIPTION, - body: json.encode(patient)); + final response = + await client.post(GET_PRESCRIPTION, body: json.encode(patient)); final int statusCode = response.statusCode; isLoading = false; @@ -197,7 +216,8 @@ getPatientPrescriptions(patient) async { patientPrescriptionsList = []; print("res['PatientPrescriptionList']"); res['PatientPrescriptionList'].forEach((v) { - patientPrescriptionsList.add(new PrescriptionResModel.fromJson(v)); + patientPrescriptionsList + .add(new PrescriptionResModel.fromJson(v)); }); } else { isError = true; @@ -221,11 +241,14 @@ getPatientPrescriptions(patient) async { *@return: *@desc: getPatientRadiology */ -getPatientRadiology(patient) async { + getPatientRadiology(patient) async { + // isLoading = true; + // notifyListeners(); + setBasicData(); try { if (await Helpers.checkConnection()) { - final response = await client.post(GET_RADIOLOGY, - body: json.encode(patient)); + final response = + await client.post(GET_RADIOLOGY, body: json.encode(patient)); final int statusCode = response.statusCode; isLoading = false; @@ -239,7 +262,7 @@ getPatientRadiology(patient) async { patientRadiologyList = []; print("res['List_GetRadOreders']"); res['List_GetRadOreders'].forEach((v) { - patientRadiologyList.add(new RadiologyResModel .fromJson(v)); + patientRadiologyList.add(new RadiologyResModel.fromJson(v)); }); } else { isError = true; @@ -256,6 +279,4 @@ getPatientRadiology(patient) async { throw error; } } - - } diff --git a/lib/screens/patients/profile/lab_result/lab_orders_screen.dart b/lib/screens/patients/profile/lab_result/lab_orders_screen.dart index 7f576f8c..c8364296 100644 --- a/lib/screens/patients/profile/lab_result/lab_orders_screen.dart +++ b/lib/screens/patients/profile/lab_result/lab_orders_screen.dart @@ -11,6 +11,7 @@ import '../../../../widgets/shared/app_scaffold_widget.dart'; import '../../../../widgets/shared/app_texts_widget.dart'; import '../../../../widgets/shared/card_with_bg_widget.dart'; import '../../../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import '../../../../widgets/shared/profile_image_widget.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); @@ -107,17 +108,9 @@ class _LabOrdersScreenState extends State { children: [ Row( children: [ - CircleAvatar( - radius: - SizeConfig.imageSizeMultiplier * - 12, - backgroundImage: NetworkImage( - patientsProv - .patientLabResultOrdersList[ - index] + ProfileImageWidget(url:patientsProv + .patientLabResultOrdersList[index] .doctorImageURL), - backgroundColor: Colors.transparent, - ), Expanded( child: Padding( padding: const EdgeInsets.fromLTRB( diff --git a/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart b/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart index ab1769d7..061bf648 100644 --- a/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart +++ b/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart @@ -1,18 +1,17 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/models/patient/prescription_req_model.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../../../config/shared_pref_kay.dart'; -import '../../../../models/patient/vital_sign_req_model.dart'; +import '../../../../config/size_config.dart'; +import '../../../../models/patient/patiant_info_model.dart'; +import '../../../../models/patient/prescription_req_model.dart'; import '../../../../providers/patients_provider.dart'; - import '../../../../util/dr_app_shared_pref.dart'; import '../../../../widgets/shared/app_scaffold_widget.dart'; +import '../../../../widgets/shared/app_texts_widget.dart'; import '../../../../widgets/shared/card_with_bg_widget.dart'; import '../../../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import '../../../../widgets/shared/profile_image_widget.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); @@ -109,16 +108,9 @@ class _PrescriptionScreenState extends State { children: [ Row( children: [ - CircleAvatar( - radius: - SizeConfig.imageSizeMultiplier * - 12, - backgroundImage: NetworkImage( - patientsProv + ProfileImageWidget(url:patientsProv .patientPrescriptionsList[index] .doctorImageURL), - backgroundColor: Colors.transparent, - ), Expanded( child: Padding( padding: const EdgeInsets.fromLTRB( diff --git a/lib/screens/patients/profile/radiology/radiology_screen.dart b/lib/screens/patients/profile/radiology/radiology_screen.dart index 8f0aaf55..a55c2704 100644 --- a/lib/screens/patients/profile/radiology/radiology_screen.dart +++ b/lib/screens/patients/profile/radiology/radiology_screen.dart @@ -1,18 +1,17 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/models/patient/radiology_req_model.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../../../config/shared_pref_kay.dart'; -import '../../../../models/patient/vital_sign_req_model.dart'; +import '../../../../config/size_config.dart'; +import '../../../../models/patient/patiant_info_model.dart'; +import '../../../../models/patient/radiology_req_model.dart'; import '../../../../providers/patients_provider.dart'; - import '../../../../util/dr_app_shared_pref.dart'; import '../../../../widgets/shared/app_scaffold_widget.dart'; +import '../../../../widgets/shared/app_texts_widget.dart'; import '../../../../widgets/shared/card_with_bg_widget.dart'; import '../../../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import '../../../../widgets/shared/profile_image_widget.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); @@ -51,12 +50,12 @@ class _RadiologyScreenState extends State { } print(type); RadiologyReqModel radiologyReqModel = RadiologyReqModel( - patientID: patient.patientId, - projectID: patient.projectId, - tokenID: token, - patientTypeID: patient.patientType, - languageID: 2, - ); + patientID: patient.patientId, + projectID: patient.projectId, + tokenID: token, + patientTypeID: patient.patientType, + languageID: 2, + ); patientsProv.getPatientRadiology(radiologyReqModel.toJson()); } @@ -108,16 +107,10 @@ class _RadiologyScreenState extends State { children: [ Row( children: [ - CircleAvatar( - radius: - SizeConfig.imageSizeMultiplier * - 12, - backgroundImage: NetworkImage( - patientsProv - .patientRadiologyList[index] - .doctorImageURL), - backgroundColor: Colors.transparent, - ), + ProfileImageWidget( + url: patientsProv + .patientRadiologyList[index] + .doctorImageURL), Expanded( child: Padding( padding: const EdgeInsets.fromLTRB( diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart index 8c97588b..da604792 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart @@ -1,17 +1,17 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../../../config/shared_pref_kay.dart'; +import '../../../../config/size_config.dart'; +import '../../../../models/patient/patiant_info_model.dart'; import '../../../../models/patient/vital_sign_req_model.dart'; import '../../../../providers/patients_provider.dart'; - import '../../../../util/dr_app_shared_pref.dart'; import '../../../../widgets/shared/app_scaffold_widget.dart'; +import '../../../../widgets/shared/app_texts_widget.dart'; import '../../../../widgets/shared/card_with_bg_widget.dart'; import '../../../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import '../../../../widgets/shared/profile_image_widget.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); @@ -109,16 +109,9 @@ class _VitalSignScreenState extends State { children: [ Row( children: [ - CircleAvatar( - radius: - SizeConfig.imageSizeMultiplier * - 12, - backgroundImage: NetworkImage( - patientsProv + ProfileImageWidget(url:patientsProv .patientVitalSignList[index] .doctorImageURL), - backgroundColor: Colors.transparent, - ), Expanded( child: Padding( padding: const EdgeInsets.fromLTRB( diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index ccc4d42a..387871d4 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/routes.dart'; +import 'package:doctor_app_flutter/widgets/shared/profile_image_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -60,7 +61,13 @@ class AppScaffold extends StatelessWidget { }), centerTitle: true, actions: [ - IconButton(icon: Icon(Icons.person), onPressed: null) + // IconButton(icon: Icon(Icons.person), onPressed: null) + ProfileImageWidget( + height: 50, + width: 50, + url: + "https://p.kindpng.com/picc/s/404-4042774_profile-photo-circle-circle-profile-picture-png-transparent.png", + ) ], ), drawer: (pageOnly == true || showAppDrawer == false) diff --git a/lib/widgets/shared/profile_image_widget.dart b/lib/widgets/shared/profile_image_widget.dart index 33256444..85f9c4b0 100644 --- a/lib/widgets/shared/profile_image_widget.dart +++ b/lib/widgets/shared/profile_image_widget.dart @@ -40,15 +40,14 @@ class ProfileImageWidget extends StatelessWidget { backgroundColor: Colors.transparent, ), ), - Padding( - padding: EdgeInsets.only(top: 10), - child: AppText( - name, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 4, - color: color, - )), - AppText( + name==null || des == null?SizedBox():SizedBox(height: 10,), + name==null?SizedBox():AppText( + name, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 4, + color: color, + ), + des==null?SizedBox():AppText( des, fontSize: SizeConfig.textMultiplier * 2.5, )