diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 390222c2..27fcb103 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -3,14 +3,9 @@ import 'dart:convert'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/models/doctor_profile_model.dart'; -import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; -import 'package:http_interceptor/http_methods.dart'; -import 'package:http_interceptor/models/request_data.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = new Helpers(); @@ -75,6 +70,7 @@ class BaseAppClient { var parsed = json.decode(response.body.toString()); if (!parsed['IsAuthenticated']) { await helpers.logout(); + helpers.showErrorToast('Your session expired Please login agian'); } else if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); diff --git a/lib/config/config.dart b/lib/config/config.dart index 0752561d..2bd1256d 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -2,7 +2,7 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; - const BASE_URL = 'https://hmgwebservices.com/Services/'; +const BASE_URL = 'https://hmgwebservices.com/Services/'; //const BASE_URL = 'https://uat.hmgwebservices.com/Services/'; const PHARMACY_ITEMS_URL = "Lists.svc/REST/GetPharmcyItems_Region"; const PHARMACY_LIST_URL = "Patients.svc/REST/GetPharmcyList"; @@ -24,7 +24,7 @@ const GET_PATIENT_LAB_OREDERS = const GET_PRESCRIPTION = 'Patients.svc/REST/GetPrescriptionApptList'; const GET_RADIOLOGY = 'DoctorApplication.svc/REST/GetPatientRadResult'; -var selectedPatientType = 0; +var selectedPatientType = 0; //*********change value to decode json from Dropdown ************ var SERVICES_PATIANT = [ @@ -70,7 +70,7 @@ const IS_LOGIN_FOR_DOCTOR_APP = true; const PATIENT_OUT_SA = false; /// Timer Info -const TIMER_MIN =10; +const TIMER_MIN = 10; class AppGlobal{ - static var CONTEX; +static var CONTEX; } diff --git a/lib/providers/auth_provider.dart b/lib/providers/auth_provider.dart index af93c837..e79192ae 100644 --- a/lib/providers/auth_provider.dart +++ b/lib/providers/auth_provider.dart @@ -1,27 +1,31 @@ -import 'dart:convert'; -import 'package:doctor_app_flutter/client/app_client.dart'; +import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:flutter/cupertino.dart'; + import '../models/user_model.dart'; -const LOGIN_URL = - 'Sentry.svc/REST/MemberLogIN_New'; -const INSERT_DEVICE_IMEI = - 'Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI'; +const LOGIN_URL = 'Sentry.svc/REST/MemberLogIN_New'; +const INSERT_DEVICE_IMEI = 'Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI'; const SELECT_DEVICE_IMEI = 'Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI'; const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE = 'Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType'; -const MEMBER_CHECK_ACTIVATION_CODE_NEW ='Sentry.svc/REST/MemberCheckActivationCode_New'; +const MEMBER_CHECK_ACTIVATION_CODE_NEW = + 'Sentry.svc/REST/MemberCheckActivationCode_New'; const GET_DOC_PROFILES = 'Doctors.svc/REST/GetDocProfiles'; -class AuthProvider with ChangeNotifier { - Future login(UserModel userInfo) async { - const url = LOGIN_URL; +class AuthProvider with ChangeNotifier { + Future login(UserModel userInfo) async { try { - final response = await AppClient.post(url, - body: json.encode({ + dynamic localRes; + + await BaseAppClient.post(LOGIN_URL, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: { "UserID": userInfo.UserID, "Password": userInfo.Password, "ProjectID": userInfo.ProjectID, @@ -30,76 +34,98 @@ class AuthProvider with ChangeNotifier { "VersionID": userInfo.VersionID, "Channel": userInfo.Channel, "SessionID": userInfo.SessionID - })); - return Future.value(json.decode(response.body)); + }); + + return Future.value(localRes); } catch (error) { print(error); throw error; } } - Future insertDeviceImei(imei) async { - const url = INSERT_DEVICE_IMEI; - + Future insertDeviceImei(imei) async { try { - final response = await AppClient.post(url, body: json.encode(imei)); - return Future.value(json.decode(response.body)); + dynamic localRes; + + await BaseAppClient.post(INSERT_DEVICE_IMEI, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: imei); + return Future.value(localRes); } catch (error) { print(error); throw error; } } - Future selectDeviceImei(imei) async { - const url = SELECT_DEVICE_IMEI; - + Future selectDeviceImei(imei) async { try { - final response = await AppClient.post(url, body: json.encode(imei)); - return Future.value(json.decode(response.body)); + dynamic localRes; + await BaseAppClient.post(SELECT_DEVICE_IMEI, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: imei); + return Future.value(localRes); } catch (error) { print(error); throw error; } } - Future sendActivationCodeByOtpNotificationType( + Future sendActivationCodeByOtpNotificationType( activationCodeModel) async { - const url = SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE; - try { - final response = await AppClient.post(url, body: json.encode(activationCodeModel)); - return Future.value(json.decode(response.body)); + var localRes; + await BaseAppClient.post(SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: activationCodeModel); + return Future.value(localRes); } catch (error) { print(error); throw error; } } - Future memberCheckActivationCodeNew(activationCodeModel) async { - const url = MEMBER_CHECK_ACTIVATION_CODE_NEW; - + Future memberCheckActivationCodeNew(activationCodeModel) async { try { - final response = await AppClient.post(url, body: json.encode(activationCodeModel)); - return Future.value(json.decode(response.body)); + dynamic localRes; + await BaseAppClient.post(MEMBER_CHECK_ACTIVATION_CODE_NEW, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: activationCodeModel); + return Future.value(localRes); } catch (error) { print(error); throw error; } } - /* - *@author: Elham Rababah + /* + *@author: Elham Rababah *@Date:17/5/2020 *@param: docInfo *@return:Future *@desc: getDocProfiles */ - Future getDocProfiles(docInfo) async { - const url = GET_DOC_PROFILES; - + Future getDocProfiles(docInfo) async { try { - final response = await AppClient.post(url, body: json.encode(docInfo)); - return Future.value(json.decode(response.body)); + dynamic localRes; + await BaseAppClient.post(GET_DOC_PROFILES, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: docInfo); + return Future.value(localRes); } catch (error) { print(error); throw error; diff --git a/lib/providers/hospital_provider.dart b/lib/providers/hospital_provider.dart index abf758a2..547bffe2 100644 --- a/lib/providers/hospital_provider.dart +++ b/lib/providers/hospital_provider.dart @@ -1,11 +1,8 @@ -import 'dart:convert'; - -import 'package:doctor_app_flutter/client/app_client.dart'; +import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:flutter/cupertino.dart'; class HospitalProvider with ChangeNotifier { - Future getProjectsList() async { const url = GET_PROJECTS; var info = { @@ -18,12 +15,17 @@ class HospitalProvider with ChangeNotifier { "SessionID": "i1UJwCTSqt", "IsLoginForDoctorApp": true }; - try { - final response = await AppClient.post(url, body: json.encode(info)); - return Future.value(json.decode(response.body)); - } catch (error) { - throw error; - // print('error'); - } + dynamic localRes ; + + await BaseAppClient.post(url, + onSuccess: ( response, statusCode) async { + localRes= response; + }, + onFailure: (String error, int statusCode) { + throw error; + }, + body: info); + return Future.value(localRes); + } } diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index 754af77b..6da89e74 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -16,13 +16,10 @@ import 'package:doctor_app_flutter/models/patient/prescription_res_model.dart'; import 'package:doctor_app_flutter/models/patient/radiology_res_model.dart'; import 'package:doctor_app_flutter/models/patient/refer_to_doctor_request.dart'; import 'package:doctor_app_flutter/models/prescription_report.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:flutter/cupertino.dart'; -import 'package:http/http.dart'; -import 'package:http_interceptor/http_client_with_interceptor.dart'; -import '../client/app_client.dart'; import '../config/config.dart'; -import '../interceptor/http_interceptor.dart'; import '../models/patient/lab_orders_res_model.dart'; import '../models/patient/patiant_info_model.dart'; import '../models/patient/patient_model.dart'; @@ -32,6 +29,7 @@ import '../models/patient/vital_sign_res_model.dart'; import '../util/helpers.dart'; Helpers helpers = Helpers(); +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); class PatientsProvider with ChangeNotifier { bool isLoading = false; @@ -60,31 +58,26 @@ class PatientsProvider with ChangeNotifier { var referalFrequancyList = []; DoctorsByClinicIdRequest _doctorsByClinicIdRequest = - DoctorsByClinicIdRequest(); + DoctorsByClinicIdRequest(); STPReferralFrequencyRequest _referralFrequencyRequest = - STPReferralFrequencyRequest(); + STPReferralFrequencyRequest(); ClinicByProjectIdRequest _clinicByProjectIdRequest = - ClinicByProjectIdRequest(); - ReferToDoctorRequest _referToDoctorRequest ; - Client client = - HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); + ClinicByProjectIdRequest(); + ReferToDoctorRequest _referToDoctorRequest = ReferToDoctorRequest(); PatiantInformtion _selectedPatient; - Future getPatientList(PatientModel patient, patientType) async { - /* const url = - BASE_URL+'DoctorApplication.svc/REST/GetMyInPatient';*/ - + Future getPatientList(PatientModel patient, patientType) async { int val = int.parse(patientType); - //**********Modify url by amjad amireh for patiant type********* - - final url = - BASE_URL + "DoctorApplication.svc/REST/" + SERVICES_PATIANT[val]; - // print("a===========$url=======a"); try { - final response = await client.post(url, - body: json.encode({ + dynamic localRes; + await BaseAppClient.post('DoctorApplication.svc/REST/' + SERVICES_PATIANT[val], + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: { "ProjectID": patient.ProjectID, "ClinicID": patient.ClinicID, "DoctorID": patient.DoctorID, @@ -105,13 +98,12 @@ class PatientsProvider with ChangeNotifier { "SessionID": patient.SessionID, "IsLoginForDoctorApp": patient.IsLoginForDoctorApp, "PatientOutSA": patient.PatientOutSA - })); -//********************** -//*********************** + }); - return Future.value(json.decode(response.body)); - } catch (err) { - throw err; + return Future.value(localRes); + } catch (error) { + print(error); + throw error; } } @@ -133,21 +125,10 @@ class PatientsProvider with ChangeNotifier { setBasicData(); try { - if (await Helpers.checkConnection()) { - final response = await AppClient.post(GET_PATIENT_VITAL_SIGN, - body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { + await BaseAppClient.post(GET_PATIENT_VITAL_SIGN, + onSuccess: (dynamic response, int statusCode) { patientVitalSignList = []; - res['List_DoctorPatientVitalSign'].forEach((v) { + response['List_DoctorPatientVitalSign'].forEach((v) { patientVitalSignList.add(new VitalSignResModel.fromJson(v)); }); @@ -160,21 +141,22 @@ class PatientsProvider with ChangeNotifier { a.vitalSignDate.microsecondsSinceEpoch; }); patientVitalSignOrderdSubList.clear(); - for (int x = 0; x < 20; x++) { + int length = patientVitalSignOrderdSubListTemp.length >= 20 + ? 20 + : patientVitalSignOrderdSubListTemp.length; + for (int x = 0; x < length; x++) { patientVitalSignOrderdSubList .add(patientVitalSignOrderdSubListTemp[x]); } } - } else { + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -193,33 +175,20 @@ class PatientsProvider with ChangeNotifier { setBasicData(); try { - if (await Helpers.checkConnection()) { - final response = await AppClient.post(GET_PATIENT_LAB_OREDERS, - body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { + await BaseAppClient.post(GET_PATIENT_LAB_OREDERS, + onSuccess: (dynamic response, int statusCode) { patientLabResultOrdersList = []; - res['List_GetLabOreders'].forEach((v) { + response['List_GetLabOreders'].forEach((v) { patientLabResultOrdersList.add(new LabOrdersResModel.fromJson(v)); }); - } else { + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -234,36 +203,21 @@ class PatientsProvider with ChangeNotifier { */ getOutPatientPrescriptions(patient) async { setBasicData(); - try { - if (await Helpers.checkConnection()) { - final response = - await AppClient.post(GET_PRESCRIPTION, body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { + await BaseAppClient.post(GET_PRESCRIPTION, + onSuccess: (dynamic response, int statusCode) { patientPrescriptionsList = []; - res['PatientPrescriptionList'].forEach((v) { - patientPrescriptionsList - .add(new PrescriptionResModel.fromJson(v)); + response['PatientPrescriptionList'].forEach((v) { + patientPrescriptionsList.add(new PrescriptionResModel.fromJson(v)); }); - } else { + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -284,13 +238,13 @@ class PatientsProvider with ChangeNotifier { await BaseAppClient.post( 'DoctorApplication.svc/REST/GetPrescriptionReportForInPatient', onSuccess: (dynamic response, int statusCode) { - response['List_PrescriptionReportForInPatient'].forEach((v) { - prescriptionReportForInPatientList - .add(PrescriptionReportForInPatient.fromJson(v)); - }); - isError = false; - isLoading = false; - }, onFailure: (String error, int statusCode) { + response['List_PrescriptionReportForInPatient'].forEach((v) { + prescriptionReportForInPatientList + .add(PrescriptionReportForInPatient.fromJson(v)); + }); + isError = false; + isLoading = false; + }, onFailure: (String error, int statusCode) { isError = true; isLoading = false; this.error = error; @@ -309,16 +263,16 @@ class PatientsProvider with ChangeNotifier { notifyListeners(); await BaseAppClient.post('Patients.svc/REST/GetPrescriptionReport', onSuccess: (dynamic response, int statusCode) { - response['ListPRM'].forEach((v) { - prescriptionReport.add(PrescriptionReport.fromJson(v)); - }); - isError = false; - isLoading = false; - }, onFailure: (String error, int statusCode) { - isError = true; - isLoading = false; - this.error = error; - }, body: prescriptionReqModel); + response['ListPRM'].forEach((v) { + prescriptionReport.add(PrescriptionReport.fromJson(v)); + }); + isError = false; + isLoading = false; + }, onFailure: (String error, int statusCode) { + isError = true; + isLoading = false; + this.error = error; + }, body: prescriptionReqModel); notifyListeners(); } @@ -347,33 +301,20 @@ class PatientsProvider with ChangeNotifier { // notifyListeners(); setBasicData(); try { - if (await Helpers.checkConnection()) { - final response = - await AppClient.post(GET_RADIOLOGY, body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { + await BaseAppClient.post(GET_RADIOLOGY, + onSuccess: (dynamic response, int statusCode) { patientRadiologyList = []; - res['List_GetRadOreders'].forEach((v) { + response['List_GetRadOreders'].forEach((v) { patientRadiologyList.add(new RadiologyResModel.fromJson(v)); }); - } else { + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -391,47 +332,33 @@ class PatientsProvider with ChangeNotifier { requestLabResult.patientTypeID = labOrdersResModel.patientType; await BaseAppClient.post('DoctorApplication.svc/REST/GetPatientLabResults', onSuccess: (dynamic response, int statusCode) { - isError = false; - isLoading = false; - response['List_GetLabNormal'].forEach((v) { - labResultList.add(new LabResult.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - isError = true; - isLoading = false; - this.error = error; - }, body: requestLabResult.toJson()); + isError = false; + isLoading = false; + response['List_GetLabNormal'].forEach((v) { + labResultList.add(new LabResult.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + isError = true; + isLoading = false; + this.error = error; + }, body: requestLabResult.toJson()); notifyListeners(); } getPatientInsuranceApprovals(patient) async { setBasicData(); try { - if (await Helpers.checkConnection()) { - final response = await AppClient.post(PATIENT_INSURANCE_APPROVALS_URL, - body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { - //patientRadiologyList = []; - insuranceApporvalsList = res['List_ApprovalMain_InPatient']; - } else { + await BaseAppClient.post(PATIENT_INSURANCE_APPROVALS_URL, + onSuccess: (dynamic response, int statusCode) { + insuranceApporvalsList = response['List_ApprovalMain_InPatient']; + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -445,30 +372,17 @@ class PatientsProvider with ChangeNotifier { getPatientProgressNote(patient) async { setBasicData(); try { - if (await Helpers.checkConnection()) { - final response = await AppClient.post(PATIENT_PROGRESS_NOTE_URL, - body: json.encode(patient)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { - patientProgressNoteList = res['List_GetPregressNoteForInPatient']; - } else { + await BaseAppClient.post(PATIENT_PROGRESS_NOTE_URL, + onSuccess: (dynamic response, int statusCode) { + patientProgressNoteList = response['List_GetPregressNoteForInPatient']; + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, body: patient); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -480,51 +394,29 @@ class PatientsProvider with ChangeNotifier { *@desc: getDoctorsList */ getDoctorsList(String clinicId) async { - String token = await sharedPref.getString(TOKEN); - int projectID = await sharedPref.getInt(PROJECT_ID); setBasicData(); try { - if (await Helpers.checkConnection()) { - _doctorsByClinicIdRequest.projectID = projectID; - _doctorsByClinicIdRequest.clinicID = clinicId; - _doctorsByClinicIdRequest.tokenID = token; - - final response = await AppClient.post(PATIENT_GET_DOCTOR_BY_CLINIC_URL, - body: json.encode(_doctorsByClinicIdRequest)); - final int statusCode = response.statusCode; - - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - isLoading = false; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { - doctorsList = res['List_Doctors_All']; - isLoading = false; - } else { + _doctorsByClinicIdRequest.clinicID = clinicId; + await BaseAppClient.post(PATIENT_GET_DOCTOR_BY_CLINIC_URL, + onSuccess: (dynamic response, int statusCode) { + doctorsList = response['List_Doctors_All']; + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - isLoading = false; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, body: _doctorsByClinicIdRequest.toJson()); notifyListeners(); } catch (err) { handelCatchErrorCase(err); - isLoading = false; } } List getDoctorNameList() { var doctorNamelist = - doctorsList.map((value) => value['DoctorName'].toString()).toList(); + doctorsList.map((value) => value['DoctorName'].toString()).toList(); return doctorNamelist; } @@ -533,37 +425,19 @@ class PatientsProvider with ChangeNotifier { *@desc: getClinicsList */ getClinicsList() async { - String token = await sharedPref.getString(TOKEN); setBasicData(); try { - if (await Helpers.checkConnection()) { - int projectID = await sharedPref.getInt(PROJECT_ID); - _clinicByProjectIdRequest.projectID = projectID; - _clinicByProjectIdRequest.tokenID = token; - - final response = await AppClient.post(PATIENT_GET_CLINIC_BY_PROJECT_URL, - body: json.encode(_clinicByProjectIdRequest)); - final int statusCode = response.statusCode; - isLoading = false; - - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { - clinicsList = res['List_Clinic_All']; - } else { + await BaseAppClient.post(PATIENT_GET_CLINIC_BY_PROJECT_URL, + onSuccess: (dynamic response, int statusCode) { + clinicsList = response['List_Clinic_All']; + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, body: _clinicByProjectIdRequest.toJson()); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -582,33 +456,19 @@ class PatientsProvider with ChangeNotifier { *@desc: getReferralFrequancyList */ getReferralFrequancyList() async { - String token = await sharedPref.getString(TOKEN); setBasicData(); try { - if (await Helpers.checkConnection()) { - _referralFrequencyRequest.tokenID = token; - final response = await AppClient.post(PATIENT_GET_LIST_REFERAL_URL, - body: json.encode(_referralFrequencyRequest)); - final int statusCode = response.statusCode; - isLoading = false; - if (statusCode < 200 || statusCode >= 400 || json == null) { - isError = true; - error = 'Error While Fetching data'; - } else { - var res = json.decode(response.body); - print('$res'); - if (res['MessageStatus'] == 1) { - referalFrequancyList = res['list_STPReferralFrequency']; - } else { + await BaseAppClient.post(PATIENT_GET_LIST_REFERAL_URL, + onSuccess: (dynamic response, int statusCode) { + referalFrequancyList = response['list_STPReferralFrequency']; + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; isError = true; - error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + this.error = error; + }, body: _referralFrequencyRequest.toJson()); notifyListeners(); } catch (err) { handelCatchErrorCase(err); @@ -628,23 +488,23 @@ class PatientsProvider with ChangeNotifier { */ referToDoctor(context, {String selectedDoctorID, - String selectedClinicID, - int admissionNo, - String extension, - String priority, - String frequency, - String referringDoctorRemarks, - int patientID, - int patientTypeID, - String roomID, - int projectID}) async { + String selectedClinicID, + int admissionNo, + String extension, + String priority, + String frequency, + String referringDoctorRemarks, + int patientID, + int patientTypeID, + String roomID, + int projectID}) async { setBasicData(); try { if (await Helpers.checkConnection()) { String token = await sharedPref.getString(TOKEN); Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = - new DoctorProfileModel.fromJson(profile); + new DoctorProfileModel.fromJson(profile); int doctorID = doctorProfile.doctorID; int clinicId = doctorProfile.clinicID; _referToDoctorRequest = ReferToDoctorRequest( diff --git a/lib/screens/QR_reader_screen.dart b/lib/screens/QR_reader_screen.dart index bbbe327a..27afd2ee 100644 --- a/lib/screens/QR_reader_screen.dart +++ b/lib/screens/QR_reader_screen.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart'; import 'package:doctor_app_flutter/providers/patients_provider.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/widgets/shared/app_button.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -23,7 +24,7 @@ class QrReaderScreen extends StatefulWidget { } class _QrReaderScreenState extends State { -DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); bool isLoading = false; bool isError = false; @@ -72,9 +73,9 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); height: 7, ), AppText( - 'scan Qr code to retrieve patient profile', - fontSize: 14, - fontWeight: FontWeight.w400, + 'scan Qr code to retrieve patient profile', + fontSize: 14, + fontWeight: FontWeight.w400, textAlign: TextAlign.center ), SizedBox( @@ -123,15 +124,15 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); /// var result = await BarcodeScanner.scan(); /// int patientID = get from qr result var result = await BarcodeScanner.scan(); - // if (result.rawContent == "") { - List listOfParams = result.rawContent.split(','); - String patientType = "1"; - setState(() { - isLoading = true; - isError = false; - patientList = []; - }); - String token = await sharedPref.getString(TOKEN); + // if (result.rawContent == "") { + List listOfParams = result.rawContent.split(','); + String patientType = "1"; + setState(() { + isLoading = true; + isError = false; + patientList = []; + }); + String token = await sharedPref.getString(TOKEN); // Map profile = await sharedPref.getObj(DOCTOR_PROFILE); // DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); // patient.PatientID = 8808; @@ -140,57 +141,64 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); // patient.setClinicID = doctorProfile.clinicID; // patient.setProjectID = doctorProfile.projectID; // Provider.of(context, listen: false); - patient.PatientID = 8808; - patient.TokenID = token; - Provider.of(context, listen: false) - .getPatientList(patient, "1") - .then((response) { - if (response['MessageStatus'] == 1) { - switch (patientType) { - case "0": - if (response['List_MyOutPatient'] != null) { - setState(() { - patientList = ModelResponse.fromJson(response['List_MyOutPatient']).list; - isLoading = false; - }); - Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { - "patient": patientList[0], - }); - } else { - setState(() { - isError = true; - error = 'No patient'; - isLoading = false; - }); - } + patient.PatientID = 8808; + patient.TokenID = token; + Provider.of(context, listen: false) + .getPatientList(patient, "1") + .then((response) { + if (response['MessageStatus'] == 1) { + switch (patientType) { + case "0": + if (response['List_MyOutPatient'] != null) { + setState(() { + patientList = ModelResponse.fromJson(response['List_MyOutPatient']).list; + isLoading = false; + }); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": patientList[0], + }); + } else { + setState(() { + isError = true; + isLoading = false; + }); + DrAppToastMsg.showErrorToast('No patient'); + } + break; + case "1": + if (response['List_MyInPatient'] != null) { + setState(() { + patientList = ModelResponse.fromJson(response['List_MyInPatient']).list; + isLoading = false; + error = ""; + }); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": patientList[0], + }); + } else { + setState(() { + isError = true; + isLoading = false; + }); + DrAppToastMsg.showErrorToast('No patient'); break; - case "1": - if (response['List_MyInPatient'] != null) { - setState(() { - patientList = ModelResponse.fromJson(response['List_MyInPatient']).list; - isLoading = false; - error = ""; - }); - Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { - "patient": patientList[0], - }); - } else { - setState(() { - error = 'No patient'; - isError = true; - isLoading = false; - }); - break; - } - } - } else { - setState(() { - error = response['ErrorEndUserMessage'] ?? response['ErrorMessage'] ; - isLoading = false; - isError = true; - }); + } } + } else { + setState(() { + isLoading = false; + isError = true; + }); + DrAppToastMsg.showErrorToast(response['ErrorEndUserMessage'] ?? response['ErrorMessage']); + + } + }).catchError((error){ + setState(() { + isLoading = false; }); - } - // } + helpers.showErrorToast(error); + //DrAppToastMsg.showErrorToast(error); + }); + } +// } } diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index 2d43a048..38c81cc3 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -41,10 +41,10 @@ class _LoginsreenState extends State { }); } -/* - *@author: Elham Rababah - *@Date:19/4/2020 - *@param: isLoading +/* + *@author: Elham Rababah + *@Date:19/4/2020 + *@param: isLoading *@return: *@desc: Change Isloading attribute in order to show or hide loader */ @@ -56,7 +56,7 @@ class _LoginsreenState extends State { @override Widget build(BuildContext context) { - AppGlobal.CONTEX = context; + getSharedPref(); return AppScaffold( isLoading: _isLoading, @@ -80,24 +80,24 @@ class _LoginsreenState extends State { children: [ (platformImei == null) ? Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AuthHeader(loginType.knownUser), - LoginForm( - changeLoadingStata: - changeLoadingStata, - ), - ], - ) + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AuthHeader(loginType.knownUser), + LoginForm( + changeLoadingStata: + changeLoadingStata, + ), + ], + ) : Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AuthHeader(loginType.unknownUser), - KnownUserLogin(), - ], - ), + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AuthHeader(loginType.unknownUser), + KnownUserLogin(), + ], + ), ])); } } diff --git a/lib/screens/doctor/my_schedule_screen.dart b/lib/screens/doctor/my_schedule_screen.dart index f7b9d444..36b449a7 100644 --- a/lib/screens/doctor/my_schedule_screen.dart +++ b/lib/screens/doctor/my_schedule_screen.dart @@ -6,8 +6,6 @@ import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indei import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import '../../config/size_config.dart'; -import '../../widgets/shared/app_scaffold_widget.dart'; class MyScheduleScreen extends StatelessWidget { ScheduleProvider scheduleProvider; diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index 5c3b857a..368a4bd1 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -63,10 +63,11 @@ class _MedicineSearchState extends State { ), Container( - margin: EdgeInsets.only(bottom: 5, - left: 10, - right: 10, - top: 0), + margin: EdgeInsets.only( + bottom: SizeConfig.heightMultiplier * 1, + right: SizeConfig.heightMultiplier * 2, + left: SizeConfig.heightMultiplier * 2, + top: SizeConfig.heightMultiplier * 1), child: Wrap( alignment: WrapAlignment.center, children: [ @@ -86,15 +87,18 @@ class _MedicineSearchState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( - "You find " + (data == null ? "0": data.length.toString())+" items in search", + "You find " + + (data == null ? "0" : data.length.toString()) + + " items in search", fontWeight: FontWeight.bold, - margin: 5,), + margin: 5, + ), ], ), ), Expanded( child: Container( - width: SizeConfig.screenWidth * 0.97, + width: SizeConfig.screenWidth * 0.90, child: !_medicineProvider.isFinished ? DrAppCircularProgressIndeicator() : _medicineProvider.hasError @@ -104,32 +108,33 @@ class _MedicineSearchState extends State { style: TextStyle( color: Theme.of(context).errorColor), ), - ):ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: data == null ? 0 : data.length, - itemBuilder: (BuildContext context, int index) { - - return InkWell( - child: MedicineItemWidget( - label: data[index]["ItemDescription"], - url: data[index]["ProductImageBase64"], - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ChangeNotifierProvider( - create: (_) => MedicineProvider(), - child: PharmaciesListScreen( - itemID: data[index]["ItemID"], url: data[index]["ProductImageBase64"]), - ), + ) + : ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: data == null ? 0 : data.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + child: MedicineItemWidget( + label: data[index]["ItemDescription"], + url: data[index]["ProductImageBase64"], + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + ChangeNotifierProvider( + create: (_) => MedicineProvider(), + child: PharmaciesListScreen( + itemID: data[index]["ItemID"], url: data[index]["ProductImageBase64"]), + ), + ), + ); + }, + ); + }, ), - ); - }, - ); - }, - ), ), ), ], diff --git a/lib/screens/patients/profile/radiology/radiology_screen.dart b/lib/screens/patients/profile/radiology/radiology_screen.dart index 1ddf944e..4b47956c 100644 --- a/lib/screens/patients/profile/radiology/radiology_screen.dart +++ b/lib/screens/patients/profile/radiology/radiology_screen.dart @@ -79,116 +79,112 @@ class _RadiologyScreenState extends State { body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError - ? DrAppEmbeddedError(error: patientsProv.error) - : patientsProv.patientRadiologyList.length == 0 - ? DrAppEmbeddedError(error: 'You don\'t have any Vital Sign') - : Container( - margin: EdgeInsets.fromLTRB( - SizeConfig.realScreenWidth * 0.05, - 0, - SizeConfig.realScreenWidth * 0.05, - 0), - child: Container( - margin: EdgeInsets.symmetric(vertical: 10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(20.0), - ), - ), - child: ListView.builder( - itemCount: patientsProv.patientRadiologyList.length, - itemBuilder: (BuildContext context, int index) { - return InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => RadiologyReportScreen(reportData: patientsProv.patientRadiologyList[index].reportData,)),); - }, - child: Container( - padding: EdgeInsets.all(10), - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(10)), - border: Border( - bottom: BorderSide( - color: Colors.grey, width: 0.5), - top: BorderSide( - color: Colors.grey, width: 0.5), - left: BorderSide( - color: Colors.grey, width: 0.5), - right: BorderSide( - color: Colors.grey, width: 0.5), + ? DrAppEmbeddedError(error: patientsProv.error) + : patientsProv.patientRadiologyList.length == 0 + ? DrAppEmbeddedError(error: 'You don\'t have any Vital Sign') + : Container( + margin: EdgeInsets.fromLTRB( + SizeConfig.realScreenWidth * 0.05, + 0, + SizeConfig.realScreenWidth * 0.05, + 0), + child: Container( + margin: EdgeInsets.symmetric(vertical: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(20.0), + ), + ), + child: ListView.builder( + itemCount: patientsProv.patientRadiologyList.length, + itemBuilder: (BuildContext context, int index) { + return InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => RadiologyReportScreen(reportData: patientsProv.patientRadiologyList[index].reportData,)),); + }, + child: Container( + padding: EdgeInsets.all(10), + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(10)), + border: Border( + bottom: BorderSide( + color: Colors.grey, width: 0.5), + top: BorderSide( + color: Colors.grey, width: 0.5), + left: BorderSide( + color: Colors.grey, width: 0.5), + right: BorderSide( + color: Colors.grey, width: 0.5), + ), + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + LargeAvatar( + url: patientsProv + .patientRadiologyList[index] + .doctorImageURL, + ), + Expanded( + child: Padding( + padding: + const EdgeInsets.fromLTRB( + 8, 0, 0, 0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + '${patientsProv.patientRadiologyList[index].doctorName}', + fontSize: 2.5 * + SizeConfig + .textMultiplier, + fontWeight: + FontWeight.bold), + SizedBox( + height: 8, + ), + AppText( + 'Invoice No:${patientsProv.patientRadiologyList[index].invoiceNo}', + fontSize: 2 * + SizeConfig + .textMultiplier, + ), + SizedBox( + height: 8, ), - ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - children: [ - LargeAvatar( - url: patientsProv - .patientRadiologyList[index] - .doctorImageURL, - name: patientsProv - .patientLabResultOrdersList[ - index] - .doctorName, - ), - Expanded( - child: Padding( - padding: - const EdgeInsets.fromLTRB( - 8, 0, 0, 0), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - '${patientsProv.patientRadiologyList[index].doctorName}', - fontSize: 2.5 * - SizeConfig - .textMultiplier, - fontWeight: - FontWeight.bold), - SizedBox( - height: 8, - ), - AppText( - 'Invoice No:${patientsProv.patientRadiologyList[index].invoiceNo}', - fontSize: 2 * - SizeConfig - .textMultiplier, - ), - SizedBox( - height: 8, - ), - AppText( - ' ${patientsProv.patientRadiologyList[index].clinicName}', - fontSize: 2 * - SizeConfig - .textMultiplier, - color: Theme.of(context) - .primaryColor, - ), - SizedBox( - height: 8, - ), - ], - ), - ), - ) - ], - ), - ], - ), + AppText( + ' ${patientsProv.patientRadiologyList[index].clinicName}', + fontSize: 2 * + SizeConfig + .textMultiplier, + color: Theme.of(context) + .primaryColor, + ), + SizedBox( + height: 8, + ), + ], ), - ); - }), - ), + ), + ) + ], + ), + ], ), + ), + ); + }), + ), + ), ); } } diff --git a/lib/util/dr_app_shared_pref.dart b/lib/util/dr_app_shared_pref.dart index f75c171e..54c8cc45 100644 --- a/lib/util/dr_app_shared_pref.dart +++ b/lib/util/dr_app_shared_pref.dart @@ -82,4 +82,14 @@ class DrAppSharedPreferances { } return json.decode(string); } + + clear() async { + final SharedPreferences prefs = await _prefs; + prefs.clear(); + } + + remove(String key) async { + final SharedPreferences prefs = await _prefs; + prefs.remove(key); + } } diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index e05f0d74..ebcf817c 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -1,12 +1,16 @@ import 'package:doctor_app_flutter/models/list_doctor_working_hours_table_model.dart'; +import 'package:doctor_app_flutter/routes.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:doctor_app_flutter/config/config.dart'; import '../config/size_config.dart'; import '../util/dr_app_toast_msg.dart'; import 'package:connectivity/connectivity.dart'; +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); /* *@author: Elham Rababah @@ -48,10 +52,6 @@ class Helpers { onPressed: () { Navigator.pop(context); }, - // padding: const EdgeInsets.symmetric( - // horizontal: 16.0, - // vertical: 5.0, - // ), ), CupertinoButton( child: Text( @@ -97,7 +97,7 @@ class Helpers { children: items.map((item) { return Text( '${item["$decKey"]}', - style: TextStyle(fontSize: SizeConfig.textMultiplier * 3), + style: TextStyle(fontSize: SizeConfig.textMultiplier * 2), ); }).toList(), @@ -164,14 +164,15 @@ class Helpers { ), ); } - /* + + /* *@author: Amjad Amireh *@Date:5/5/2020 *@param: checkDate *@return: DateTime *@desc: convert String to DateTime */ -static String checkDate(String dateString) { + static String checkDate(String dateString) { DateTime checkedTime = DateTime.parse(dateString); DateTime currentTime = DateTime.now(); @@ -257,6 +258,7 @@ static String checkDate(String dateString) { return "Sunday"; } } + /* *@author: Mohammad Aljammal *@Date:26/5/2020 @@ -275,6 +277,7 @@ static String checkDate(String dateString) { else return ""; } + /* *@author: Mohammad Aljammal *@Date:26/5/2020 @@ -301,13 +304,14 @@ static String checkDate(String dateString) { *@return: List *@desc: convert workingHours string to List */ - static List getWorkingHours(String workingHours ){ - List myWorkingHours =[]; + static List getWorkingHours(String workingHours) { + List myWorkingHours = []; List listOfHours = workingHours.split('a'); listOfHours.forEach((element) { WorkingHours workingHours = WorkingHours(); - var from = element.substring(element.indexOf('m ') + 2 , element.indexOf('To')-2); + var from = element.substring( + element.indexOf('m ') + 2, element.indexOf('To') - 2); workingHours.from = from.trim(); var to = element.substring(element.indexOf('To') + 2); workingHours.to = to.trim(); @@ -316,9 +320,6 @@ static String checkDate(String dateString) { return myWorkingHours; } - - - /* *@author: Elham Rababah *@Date:12/5/2020 @@ -333,4 +334,13 @@ static String checkDate(String dateString) { } return localMsg; } + + clearSharedPref() async { + await sharedPref.clear(); + } + + logout() async { + await clearSharedPref(); + Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN); + } } diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart index ba6c9a02..48769b59 100644 --- a/lib/widgets/auth/login_form.dart +++ b/lib/widgets/auth/login_form.dart @@ -69,6 +69,17 @@ class _LoginFormState extends State { _isInit = false; } + @override + void didChangeDependencies() { + super.didChangeDependencies(); + if (_isInit) { + if (projectsList.length == 0) { + getProjectsList(); + } + } + _isInit = false; + } + @override Widget build(BuildContext context) { final focusPass = FocusNode(); @@ -99,8 +110,9 @@ class _LoginFormState extends State { userInfo.UserID = value.trim(); }, onFieldSubmitted: (_) { - FocusScope.of(context).requestFocus(focusPass); + FocusScope.of(context).nextFocus(); }, + autofocus: false, ), buildSizedBox(), TextFormField( @@ -119,7 +131,7 @@ class _LoginFormState extends State { userInfo.Password = value; }, onFieldSubmitted: (_) { - FocusScope.of(context).requestFocus(focusProject); + FocusScope.of(context).nextFocus(); helpers.showCupertinoPicker( context, projectsList, 'Name', onSelectProject); }, @@ -144,22 +156,8 @@ class _LoginFormState extends State { }), buildSizedBox(), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.end, children: [ - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Checkbox( - value: true, - activeColor: Theme.of(context).primaryColor, - onChanged: (bool newValue) {}), - Text("Remember me", - style: TextStyle( - fontSize: 2 * SizeConfig.textMultiplier)), - ], - ), - ), RaisedButton( onPressed: () { login(context, authProv, widget.changeLoadingStata); @@ -204,17 +202,26 @@ class _LoginFormState extends State { */ InputDecoration buildInputDecoration(BuildContext context, hint, asset) { return InputDecoration( - prefixIcon: Image.asset(asset), - hintText: hint, - hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(20)), - borderSide: BorderSide(color: Hexcolor('#CCCCCC')), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Theme.of(context).primaryColor), - )); + prefixIcon: Image.asset(asset), + hintText: hint, + hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(20)), + borderSide: BorderSide(color: Hexcolor('#CCCCCC')), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderSide: BorderSide(color: Theme.of(context).primaryColor), + ), + errorBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderSide: BorderSide(color: Theme.of(context).errorColor), + ), + focusedErrorBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderSide: BorderSide(color: Theme.of(context).errorColor), + ), + ); } SizedBox buildSizedBox() { @@ -224,6 +231,11 @@ class _LoginFormState extends State { } login(context, AuthProvider authProv, Function changeLoadingStata) { + FocusScopeNode currentFocus = FocusScope.of(context); + + // if (!currentFocus.hasPrimaryFocus) { + // currentFocus.unfocus(); + // } changeLoadingStata(true); if (loginFormKey.currentState.validate()) { loginFormKey.currentState.save(); @@ -237,7 +249,7 @@ class _LoginFormState extends State { sharedPref.setString(TOKEN, res['LogInTokenID']); print("token" + res['LogInTokenID']); - Navigator.of(context).pushNamed(VERIFICATION_METHODS); + Navigator.of(context).pushReplacementNamed(VERIFICATION_METHODS); } else { // handel error // widget.showCenterShortLoadingToast("watting"); @@ -247,7 +259,7 @@ class _LoginFormState extends State { }).catchError((err) { print('$err'); changeLoadingStata(false); - helpers.showErrorToast(); + helpers.showErrorToast(err); }); } else { changeLoadingStata(false); @@ -295,7 +307,7 @@ class _LoginFormState extends State { // Platform messages may fail, so we use a try/catch PlatformException. try { platformImei = - await ImeiPlugin.getImei(shouldShowRequestPermissionRationale: false); + await ImeiPlugin.getImei(shouldShowRequestPermissionRationale: false); idunique = await ImeiPlugin.getId(); } on PlatformException { platformImei = 'Failed to get platform version.'; diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 45346a7d..611bd315 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -257,16 +257,25 @@ class _VerifyAccountState extends State { */ InputDecoration buildInputDecoration(BuildContext context) { return InputDecoration( - // ts/images/password_icon.png - contentPadding: EdgeInsets.only(top: 30, bottom: 30), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10)), - borderSide: BorderSide(color: Colors.black), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide(color: Theme.of(context).primaryColor), - )); + // ts/images/password_icon.png + contentPadding: EdgeInsets.only(top: 30, bottom: 30), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10)), + borderSide: BorderSide(color: Colors.black), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderSide: BorderSide(color: Theme.of(context).primaryColor), + ), + errorBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderSide: BorderSide(color: Theme.of(context).errorColor), + ), + focusedErrorBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderSide: BorderSide(color: Theme.of(context).errorColor), + ), + ); } /* @@ -325,7 +334,7 @@ class _VerifyAccountState extends State { verifyAccountFormValue['digit4']; print(activationCode); int projectID = await sharedPref.getInt(PROJECT_ID); - Map model = { + Map model = { "activationCode": activationCode, "DoctorID": _loggedUser['DoctorID'], "LogInTokenID": _loggedUser['LogInTokenID'], @@ -384,7 +393,7 @@ class _VerifyAccountState extends State { Map profile, Function changeLoadingStata) { changeLoadingStata(false); sharedPref.setObj(DOCTOR_PROFILE, profile); - Navigator.of(context).pushNamed(HOME); + Navigator.of(context).pushReplacementNamed(HOME); } Future _asyncSimpleDialog( diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index 3a7fa482..8c996556 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -50,7 +50,7 @@ class _VerificationMethodsState extends State { super.didChangeDependencies(); final routeArgs = ModalRoute.of(context).settings.arguments as Map; verificationMethod = - routeArgs != null ? routeArgs['verificationMethod'] : null; + routeArgs != null ? routeArgs['verificationMethod'] : null; } @override @@ -101,17 +101,17 @@ class _VerificationMethodsState extends State { child: buildFingerprintMethod( context, authProv), replacement: - buildWhatsAppMethod(context, authProv), + buildWhatsAppMethod(context, authProv), ), Visibility( visible: hideSilentMethods() ? false : true, child: buildFaceIDMethod(context, authProv), replacement: - buildSMSMethod(context, authProv), + buildSMSMethod(context, authProv), ), Visibility( visible: - hideSilentMethods() ? false : true, + hideSilentMethods() ? false : true, child: buildWhatsAppMethod( context, authProv)), Visibility( @@ -126,8 +126,8 @@ class _VerificationMethodsState extends State { // height: 500, ), SizedBox( - // height: 20, - ) + // height: 20, + ) ], ), ); @@ -136,7 +136,7 @@ class _VerificationMethodsState extends State { }); } - /* + /* *@author: Elham Rababah *@Date:28/5/2020 *@param: BuildContext context, AuthProvider authProv @@ -149,7 +149,7 @@ class _VerificationMethodsState extends State { sendActivationCodeByOtpNotificationType(1, authProv); }); } - /* + /* *@author: Elham Rababah *@Date:28/5/2020 *@param: BuildContext context, AuthProvider authProv @@ -159,9 +159,9 @@ class _VerificationMethodsState extends State { Center buildWhatsAppMethod(BuildContext context, AuthProvider authProv) { return buildVerificationMethod( context, 'assets/images/verification_whatsapp_icon.png', 'WhatsApp', - () { - sendActivationCodeByOtpNotificationType(2, authProv); - }); + () { + sendActivationCodeByOtpNotificationType(2, authProv); + }); } /* *@author: Elham Rababah @@ -186,8 +186,8 @@ class _VerificationMethodsState extends State { Center buildFingerprintMethod(BuildContext context, AuthProvider authProv) { return buildVerificationMethod(context, 'assets/images/verification_fingerprint_icon.png', 'Fingerprint', () { - sendActivationCodeByOtpNotificationType(4, authProv); - }); + sendActivationCodeByOtpNotificationType(4, authProv); + }); } /* @@ -212,7 +212,7 @@ class _VerificationMethodsState extends State { width: 1, color: Hexcolor( '#CCCCCC') // <--- border width here - ), + ), borderRadius: BorderRadius.all(Radius.circular(10))), child: Column( children: [ @@ -251,11 +251,12 @@ class _VerificationMethodsState extends State { *@desc: send Activation Code By Otp Notification Type */ sendActivationCodeByOtpNotificationType(oTPSendType, AuthProvider authProv) { + // TODO : build enum for verfication method if (oTPSendType == 1 || oTPSendType == 2) { widget.changeLoadingStata(true); - Map model = { + Map model = { "LogInTokenID": _loggedUser['LogInTokenID'], "Channel": 9, "MobileNumber": _loggedUser['MobileNumber'], @@ -270,7 +271,7 @@ class _VerificationMethodsState extends State { widget.changeLoadingStata(false); if (res['MessageStatus'] == 1) { - Navigator.of(context).pushNamed(VERIFY_ACCOUNT, arguments: {'model':model}); + Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT, arguments: {'model':model}); } else { print(res['ErrorEndUserMessage']); helpers.showErrorToast(res['ErrorEndUserMessage']); diff --git a/lib/widgets/doctor/my_referral_patient_widget.dart b/lib/widgets/doctor/my_referral_patient_widget.dart index 02d3f10a..f30de7cb 100644 --- a/lib/widgets/doctor/my_referral_patient_widget.dart +++ b/lib/widgets/doctor/my_referral_patient_widget.dart @@ -42,269 +42,277 @@ class _MyReferralPatientWidgetState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - '${widget.myReferralPatientModel.firstName} ${widget.myReferralPatientModel.lastName}', - fontSize: 2.5 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - InkWell( - onTap: () { - setState(() { - _showDetails = !_showDetails; - }); - }, - child: Icon(_showDetails - ? Icons.keyboard_arrow_up - : Icons.keyboard_arrow_down)), - ], + InkWell( + onTap: () { + setState(() { + _showDetails = !_showDetails; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + '${widget.myReferralPatientModel.firstName} ${widget.myReferralPatientModel.lastName}', + fontSize: 2.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + Icon(_showDetails + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down), + + ], + ), ), !_showDetails ? Container() : AnimatedContainer( - duration: Duration(milliseconds: 200), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 5,), - Divider(color: Color(0xFF000000),height: 0.5,), - Table( - border: TableBorder.symmetric(inside: BorderSide(width: 0.5),), + duration: Duration(milliseconds: 200), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 5,), + Divider(color: Color(0xFF000000),height: 0.5,), + Table( + border: TableBorder.symmetric(inside: BorderSide(width: 0.5),), + children: [ + TableRow( children: [ - TableRow( - children: [ - Container( - margin: EdgeInsets.all(2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'File No', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - '${widget.myReferralPatientModel.referringDoctor}', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], + Container( + margin: EdgeInsets.all(2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'File No', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, ), - ), - Container( - margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'Referring Doctor', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - widget.myReferralPatientModel - .referringClinicDescription, - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], + SizedBox(height: 5,), + AppText( + '${widget.myReferralPatientModel.referringDoctor}', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ), + Container( + margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Referring Doctor', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, ), - ), - ] + SizedBox(height: 5,), + AppText( + widget.myReferralPatientModel + .referringClinicDescription, + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), ), - TableRow( - children: [ - Container( - margin: EdgeInsets.all(2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - 'Referring Clinic', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - '${widget.myReferralPatientModel.referringClinicDescription}', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), + ] + ), + TableRow( + children: [ + Container( + margin: EdgeInsets.all(2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Referring Clinic', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, ), - Container( - margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - 'Frequency', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - widget.myReferralPatientModel - .frequencyDescription, - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), + SizedBox(height: 5,), + AppText( + '${widget.myReferralPatientModel.referringClinicDescription}', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, ) - ] + ], + ), ), - TableRow( - children: [ - Container( - margin: EdgeInsets.all(2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - 'Priority', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - '${widget.myReferralPatientModel.priorityDescription}', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], + Container( + margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Frequency', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, ), + SizedBox(height: 5,), + AppText( + widget.myReferralPatientModel + .frequencyDescription, + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ) + ] + ), + TableRow( + children: [ + Container( + margin: EdgeInsets.all(2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Priority', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, ), - Container( - margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - 'Max Response Time', - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - AppText( - Helpers.getDateFormatted(widget - .myReferralPatientModel - .mAXResponseTime), - fontSize: - 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), + SizedBox(height: 5,), + AppText( + '${widget.myReferralPatientModel.priorityDescription}', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, ) ], ), + ), + Container( + margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Max Response Time', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + SizedBox(height: 5,), + AppText( + Helpers.getDateFormatted(widget + .myReferralPatientModel + .mAXResponseTime), + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ) + ], + ), - ], - ), - Divider(color: Color(0xFF000000),height: 0.5,), - SizedBox( - height: 5, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - 'Clinic Details and Remarks', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - textAlign: TextAlign.start,), - Texts( - '${widget.myReferralPatientModel.referringDoctorRemarks}', - style: "bodyText1", - readMore: true, - textAlign: TextAlign.start, - maxLength: 100) - ], - ), - SizedBox( - height: 5, - ), - AppText( - 'Answer/Suggestions', - fontSize: 1.7 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, + ], + ), + Divider(color: Color(0xFF000000),height: 0.5,), + SizedBox( + height: 5, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Clinic Details and Remarks', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + textAlign: TextAlign.start,), + Texts( + '${widget.myReferralPatientModel.referringDoctorRemarks}', + style: "bodyText1", + readMore: true, textAlign: TextAlign.start, - ), - SizedBox( - height: 5, - ), - Form( - key: _formKey, - child: TextFields( - maxLines: 2, - minLines: 2, - hintText: 'Answer the patient', - fontWeight: FontWeight.normal, - initialValue: widget.myReferralPatientModel.referredDoctorRemarks ?? '', - readOnly: _isLoading, - validator: (value) { - if (value.isEmpty) - return "please enter answer"; - else - return null; - }, - ), - ), - SizedBox(height: 10.0), - SizedBox(height: 10.0), - Container( - width: double.infinity, - margin: EdgeInsets.only(left: 10,right: 10), - child: Button( - onTap: () async { - final form = _formKey.currentState; - if (form.validate()) { - setState(() { - _isLoading = true; - }); - try { - await Provider.of(context, listen: false).replay(answerController.text.toString(), widget.myReferralPatientModel); - setState(() { - _isLoading = false; - }); - DrAppToastMsg.showSuccesToast('Reply Successfully'); + maxLength: 100) + ], + ), + SizedBox( + height: 5, + ), + AppText( + 'Answer/Suggestions', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + textAlign: TextAlign.start, + ), + SizedBox( + height: 5, + ), + Form( + key: _formKey, + child: TextFields( + maxLines: 2, + minLines: 2, + hintText: 'Answer the patient', + fontWeight: FontWeight.normal, + initialValue: widget.myReferralPatientModel.referredDoctorRemarks ?? '', + readOnly: _isLoading, + validator: (value) { + if (value.isEmpty) + return "please enter answer"; + else + return null; + }, + ), + ), + SizedBox(height: 10.0), + SizedBox(height: 10.0), + Container( + width: double.infinity, + margin: EdgeInsets.only(left: 10,right: 10), + child: Button( + onTap: () async { + final form = _formKey.currentState; + if (form.validate()) { + setState(() { + _isLoading = true; + }); + try { + await Provider.of(context, listen: false).replay(answerController.text.toString(), widget.myReferralPatientModel); + setState(() { + _isLoading = false; + }); + DrAppToastMsg.showSuccesToast('Reply Successfully'); - } catch (e) { - setState(() { - _isLoading = false; - }); - DrAppToastMsg.showErrorToast(e); - } - } - }, - title: 'Reply', - loading: _isLoading, - ), - ) - ], + } catch (e) { + setState(() { + _isLoading = false; + }); + DrAppToastMsg.showErrorToast(e); + } + } + }, + title: 'Reply', + loading: _isLoading, ), ) + ], + ), + ) ], ), ), diff --git a/lib/widgets/patients/profile/large_avatar.dart b/lib/widgets/patients/profile/large_avatar.dart index 54cbcb30..d18fdf3d 100644 --- a/lib/widgets/patients/profile/large_avatar.dart +++ b/lib/widgets/patients/profile/large_avatar.dart @@ -54,6 +54,8 @@ class LargeAvatar extends StatelessWidget { @override Widget build(BuildContext context) { + var vlr = name; + var asd; return InkWell( onTap: disableProfileView ? null diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index c60c2d29..bc92db90 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -74,7 +74,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { child: PatientProfileButton( key: key, patient: patient, - route: PRESCRIPTIONS, + route: REFER_PATIENT, name: 'Refer Patient', icon: 'note.png')), Visibility( diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index ef8a983b..263e3848 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -1,13 +1,8 @@ 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'; - -import '../../config/size_config.dart'; import '../../presentation/doctor_app_icons.dart'; -import '../../widgets/shared/app_drawer_widget.dart'; import '../../widgets/shared/app_loader_widget.dart'; -import '../../widgets/shared/custom_shape_clipper.dart'; class AppScaffold extends StatelessWidget { String appBarTitle;