merge ibrahim

merge-requests/111/head
Mohammad ALjammal 5 years ago
parent 80664439d9
commit 692674fac0

@ -2,10 +2,18 @@ import 'dart:convert';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/interceptor/http_interceptor.dart';
import 'package:doctor_app_flutter/models/doctor_profile_model.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:doctor_app_flutter/util/helpers.dart';
import 'package:http/http.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();
/* /*
*@author: Mohammad Aljammal *@author: Mohammad Aljammal
@ -14,6 +22,7 @@ import 'package:http/http.dart';
*@return: *@return:
*@desc: *@desc:
*/ */
///Example ///Example
/* /*
await BaseAppClient.post('', await BaseAppClient.post('',
@ -22,24 +31,28 @@ import 'package:http/http.dart';
body: null); body: null);
* */ * */
class BaseAppClient { class BaseAppClient {
static Client client = HttpInterceptor().getClient();
static post( static post(
String endPoint, { String endPoint, {
Map<String, dynamic> body, Map<String, dynamic> body,
Function(dynamic response, int statusCode) onSuccess, Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure, Function(String error, int statusCode) onFailure,
}) async { }) async {
String url = BASE_URL + endPoint; String url = BASE_URL + endPoint;
RequestData data = RequestData(body: body,baseUrl: url,method: Method.POST);
try { try {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); if (profile != null) {
body['DoctorID'] = doctorProfile.doctorID; DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
body['EditedBy'] = doctorProfile.doctorID; body['DoctorID'] = doctorProfile?.doctorID;
body['ProjectID'] = doctorProfile.projectID; body['EditedBy'] = doctorProfile?.doctorID;
body['ClinicID'] = doctorProfile.clinicID; body['ProjectID'] = doctorProfile?.projectID;
body['TokenID'] = token; // if (!body.containsKey('ClinicID'))
body['ClinicID'] = doctorProfile?.clinicID;
}
body['TokenID'] = token ?? '';
body['LanguageID'] = LANGUAGE_ID; body['LanguageID'] = LANGUAGE_ID;
body['stamp'] = STAMP; body['stamp'] = STAMP;
body['IPAdress'] = IP_ADDRESS; body['IPAdress'] = IP_ADDRESS;
@ -48,15 +61,25 @@ class BaseAppClient {
body['SessionID'] = SESSION_ID; body['SessionID'] = SESSION_ID;
body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP;
body['PatientOutSA'] = PATIENT_OUT_SA; body['PatientOutSA'] = PATIENT_OUT_SA;
print("URL : $url");
print("Body : ${json.encode(body)}");
if (await Helpers.checkConnection()) { if (await Helpers.checkConnection()) {
final response = await client.post(url, body: json.encode(body)); final response = await http.post(url,
body: json.encode(body),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
});
final int statusCode = response.statusCode; final int statusCode = response.statusCode;
if (statusCode < 200 || statusCode >= 400 || json == null) { if (statusCode < 200 || statusCode >= 400 || json == null) {
onFailure('Error While Fetching data', statusCode); onFailure('Error While Fetching data', statusCode);
} else { } else {
var parsed = json.decode(response.body.toString()); var parsed = json.decode(response.body.toString());
if (parsed['MessageStatus'] == 1) { if (!parsed['IsAuthenticated']) {
Navigator.of(AppGlobal.CONTEX).pushNamed(LOGIN);
helpers.showErrorToast('Your session expired Please login agian');
} else if (parsed['MessageStatus'] == 1) {
onSuccess(parsed, statusCode); onSuccess(parsed, statusCode);
} else { } else {
onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],

@ -68,3 +68,7 @@ const PATIENT_OUT_SA = false;
/// Timer Info /// Timer Info
const TIMER_MIN =10; const TIMER_MIN =10;
class AppGlobal{
static var CONTEX;
}

@ -1,27 +1,31 @@
import 'dart:convert'; import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/client/app_client.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import '../models/user_model.dart'; import '../models/user_model.dart';
const LOGIN_URL = const LOGIN_URL = 'Sentry.svc/REST/MemberLogIN_New';
'Sentry.svc/REST/MemberLogIN_New'; const INSERT_DEVICE_IMEI = 'Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI';
const INSERT_DEVICE_IMEI =
'Sentry.svc/REST/DoctorApplication_INSERTDeviceIMEI';
const SELECT_DEVICE_IMEI = const SELECT_DEVICE_IMEI =
'Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI'; 'Sentry.svc/REST/DoctorApplication_SELECTDeviceIMEIbyIMEI';
const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE = const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE =
'Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType'; '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'; const GET_DOC_PROFILES = 'Doctors.svc/REST/GetDocProfiles';
class AuthProvider with ChangeNotifier {
Future<Map> login(UserModel userInfo) async {
const url = LOGIN_URL;
class AuthProvider with ChangeNotifier {
Future<dynamic> login(UserModel userInfo) async {
try { try {
final response = await AppClient.post(url, dynamic localRes;
body: json.encode({
await BaseAppClient.post(LOGIN_URL,
onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
}, body: {
"UserID": userInfo.UserID, "UserID": userInfo.UserID,
"Password": userInfo.Password, "Password": userInfo.Password,
"ProjectID": userInfo.ProjectID, "ProjectID": userInfo.ProjectID,
@ -30,76 +34,98 @@ class AuthProvider with ChangeNotifier {
"VersionID": userInfo.VersionID, "VersionID": userInfo.VersionID,
"Channel": userInfo.Channel, "Channel": userInfo.Channel,
"SessionID": userInfo.SessionID "SessionID": userInfo.SessionID
})); });
return Future.value(json.decode(response.body));
return Future.value(localRes);
} catch (error) { } catch (error) {
print(error); print(error);
throw error; throw error;
} }
} }
Future<Map> insertDeviceImei(imei) async { Future<dynamic> insertDeviceImei(imei) async {
const url = INSERT_DEVICE_IMEI;
try { try {
final response = await AppClient.post(url, body: json.encode(imei)); dynamic localRes;
return Future.value(json.decode(response.body));
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) { } catch (error) {
print(error); print(error);
throw error; throw error;
} }
} }
Future<Map> selectDeviceImei(imei) async { Future<dynamic> selectDeviceImei(imei) async {
const url = SELECT_DEVICE_IMEI;
try { try {
final response = await AppClient.post(url, body: json.encode(imei)); dynamic localRes;
return Future.value(json.decode(response.body)); 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) { } catch (error) {
print(error); print(error);
throw error; throw error;
} }
} }
Future<Map> sendActivationCodeByOtpNotificationType( Future sendActivationCodeByOtpNotificationType(
activationCodeModel) async { activationCodeModel) async {
const url = SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE;
try { try {
final response = await AppClient.post(url, body: json.encode(activationCodeModel)); var localRes;
return Future.value(json.decode(response.body)); 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) { } catch (error) {
print(error); print(error);
throw error; throw error;
} }
} }
Future<Map> memberCheckActivationCodeNew(activationCodeModel) async { Future<dynamic> memberCheckActivationCodeNew(activationCodeModel) async {
const url = MEMBER_CHECK_ACTIVATION_CODE_NEW;
try { try {
final response = await AppClient.post(url, body: json.encode(activationCodeModel)); dynamic localRes;
return Future.value(json.decode(response.body)); 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) { } catch (error) {
print(error); print(error);
throw error; throw error;
} }
} }
/* /*
*@author: Elham Rababah *@author: Elham Rababah
*@Date:17/5/2020 *@Date:17/5/2020
*@param: docInfo *@param: docInfo
*@return:Future<Map> *@return:Future<Map>
*@desc: getDocProfiles *@desc: getDocProfiles
*/ */
Future<Map> getDocProfiles(docInfo) async { Future<dynamic> getDocProfiles(docInfo) async {
const url = GET_DOC_PROFILES;
try { try {
final response = await AppClient.post(url, body: json.encode(docInfo)); dynamic localRes;
return Future.value(json.decode(response.body)); 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) { } catch (error) {
print(error); print(error);
throw error; throw error;

@ -1,11 +1,8 @@
import 'dart:convert'; import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/client/app_client.dart';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
class HospitalProvider with ChangeNotifier { class HospitalProvider with ChangeNotifier {
Future<Map> getProjectsList() async { Future<Map> getProjectsList() async {
const url = GET_PROJECTS; const url = GET_PROJECTS;
var info = { var info = {
@ -18,12 +15,17 @@ class HospitalProvider with ChangeNotifier {
"SessionID": "i1UJwCTSqt", "SessionID": "i1UJwCTSqt",
"IsLoginForDoctorApp": true "IsLoginForDoctorApp": true
}; };
try { dynamic localRes ;
final response = await AppClient.post(url, body: json.encode(info));
return Future.value(json.decode(response.body)); await BaseAppClient.post(url,
} catch (error) { onSuccess: ( response, statusCode) async {
throw error; localRes= response;
// print('error'); },
} onFailure: (String error, int statusCode) {
throw error;
},
body: info);
return Future.value(localRes);
} }
} }

@ -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/radiology_res_model.dart';
import 'package:doctor_app_flutter/models/patient/refer_to_doctor_request.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/models/prescription_report.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:flutter/cupertino.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 '../config/config.dart';
import '../interceptor/http_interceptor.dart';
import '../models/patient/lab_orders_res_model.dart'; import '../models/patient/lab_orders_res_model.dart';
import '../models/patient/patiant_info_model.dart'; import '../models/patient/patiant_info_model.dart';
import '../models/patient/patient_model.dart'; import '../models/patient/patient_model.dart';
@ -32,6 +29,7 @@ import '../models/patient/vital_sign_res_model.dart';
import '../util/helpers.dart'; import '../util/helpers.dart';
Helpers helpers = Helpers(); Helpers helpers = Helpers();
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class PatientsProvider with ChangeNotifier { class PatientsProvider with ChangeNotifier {
bool isLoading = false; bool isLoading = false;
@ -60,31 +58,26 @@ class PatientsProvider with ChangeNotifier {
var referalFrequancyList = []; var referalFrequancyList = [];
DoctorsByClinicIdRequest _doctorsByClinicIdRequest = DoctorsByClinicIdRequest _doctorsByClinicIdRequest =
DoctorsByClinicIdRequest(); DoctorsByClinicIdRequest();
STPReferralFrequencyRequest _referralFrequencyRequest = STPReferralFrequencyRequest _referralFrequencyRequest =
STPReferralFrequencyRequest(); STPReferralFrequencyRequest();
ClinicByProjectIdRequest _clinicByProjectIdRequest = ClinicByProjectIdRequest _clinicByProjectIdRequest =
ClinicByProjectIdRequest(); ClinicByProjectIdRequest();
ReferToDoctorRequest _referToDoctorRequest ; ReferToDoctorRequest _referToDoctorRequest = ReferToDoctorRequest();
Client client =
HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]);
PatiantInformtion _selectedPatient; PatiantInformtion _selectedPatient;
Future<Map> getPatientList(PatientModel patient, patientType) async { Future<dynamic> getPatientList(PatientModel patient, patientType) async {
/* const url =
BASE_URL+'DoctorApplication.svc/REST/GetMyInPatient';*/
int val = int.parse(patientType); 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 { try {
final response = await client.post(url, dynamic localRes;
body: json.encode({ 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, "ProjectID": patient.ProjectID,
"ClinicID": patient.ClinicID, "ClinicID": patient.ClinicID,
"DoctorID": patient.DoctorID, "DoctorID": patient.DoctorID,
@ -105,13 +98,12 @@ class PatientsProvider with ChangeNotifier {
"SessionID": patient.SessionID, "SessionID": patient.SessionID,
"IsLoginForDoctorApp": patient.IsLoginForDoctorApp, "IsLoginForDoctorApp": patient.IsLoginForDoctorApp,
"PatientOutSA": patient.PatientOutSA "PatientOutSA": patient.PatientOutSA
})); });
//**********************
//***********************
return Future.value(json.decode(response.body)); return Future.value(localRes);
} catch (err) { } catch (error) {
throw err; print(error);
throw error;
} }
} }
@ -133,21 +125,10 @@ class PatientsProvider with ChangeNotifier {
setBasicData(); setBasicData();
try { try {
if (await Helpers.checkConnection()) { await BaseAppClient.post(GET_PATIENT_VITAL_SIGN,
final response = await AppClient.post(GET_PATIENT_VITAL_SIGN, onSuccess: (dynamic response, int statusCode) {
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) {
patientVitalSignList = []; patientVitalSignList = [];
res['List_DoctorPatientVitalSign'].forEach((v) { response['List_DoctorPatientVitalSign'].forEach((v) {
patientVitalSignList.add(new VitalSignResModel.fromJson(v)); patientVitalSignList.add(new VitalSignResModel.fromJson(v));
}); });
@ -160,21 +141,22 @@ class PatientsProvider with ChangeNotifier {
a.vitalSignDate.microsecondsSinceEpoch; a.vitalSignDate.microsecondsSinceEpoch;
}); });
patientVitalSignOrderdSubList.clear(); 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 patientVitalSignOrderdSubList
.add(patientVitalSignOrderdSubListTemp[x]); .add(patientVitalSignOrderdSubListTemp[x]);
} }
} }
} else { isLoading = false;
isError = false;
this.error = '';
}, onFailure: (String error, int statusCode) {
isLoading = false;
isError = true; isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; this.error = error;
} }, body: patient);
}
} else {
isLoading = false;
isError = true;
error = 'Please Check The Internet Connection';
}
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -193,33 +175,20 @@ class PatientsProvider with ChangeNotifier {
setBasicData(); setBasicData();
try { try {
if (await Helpers.checkConnection()) { await BaseAppClient.post(GET_PATIENT_LAB_OREDERS,
final response = await AppClient.post(GET_PATIENT_LAB_OREDERS, onSuccess: (dynamic response, int statusCode) {
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) {
patientLabResultOrdersList = []; patientLabResultOrdersList = [];
res['List_GetLabOreders'].forEach((v) { response['List_GetLabOreders'].forEach((v) {
patientLabResultOrdersList.add(new LabOrdersResModel.fromJson(v)); patientLabResultOrdersList.add(new LabOrdersResModel.fromJson(v));
}); });
} else { isLoading = false;
isError = false;
this.error = '';
}, onFailure: (String error, int statusCode) {
isLoading = false;
isError = true; isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; this.error = error;
} }, body: patient);
}
} else {
isLoading = false;
isError = true;
error = 'Please Check The Internet Connection';
}
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -234,36 +203,21 @@ class PatientsProvider with ChangeNotifier {
*/ */
getOutPatientPrescriptions(patient) async { getOutPatientPrescriptions(patient) async {
setBasicData(); setBasicData();
try { try {
if (await Helpers.checkConnection()) { await BaseAppClient.post(GET_PRESCRIPTION,
final response = onSuccess: (dynamic response, int statusCode) {
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) {
patientPrescriptionsList = []; patientPrescriptionsList = [];
res['PatientPrescriptionList'].forEach((v) { response['PatientPrescriptionList'].forEach((v) {
patientPrescriptionsList patientPrescriptionsList.add(new PrescriptionResModel.fromJson(v));
.add(new PrescriptionResModel.fromJson(v));
}); });
} else { isLoading = false;
isError = false;
this.error = '';
}, onFailure: (String error, int statusCode) {
isLoading = false;
isError = true; isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; this.error = error;
} }, body: patient);
}
} else {
isLoading = false;
isError = true;
error = 'Please Check The Internet Connection';
}
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -284,13 +238,13 @@ class PatientsProvider with ChangeNotifier {
await BaseAppClient.post( await BaseAppClient.post(
'DoctorApplication.svc/REST/GetPrescriptionReportForInPatient', 'DoctorApplication.svc/REST/GetPrescriptionReportForInPatient',
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
response['List_PrescriptionReportForInPatient'].forEach((v) { response['List_PrescriptionReportForInPatient'].forEach((v) {
prescriptionReportForInPatientList prescriptionReportForInPatientList
.add(PrescriptionReportForInPatient.fromJson(v)); .add(PrescriptionReportForInPatient.fromJson(v));
}); });
isError = false; isError = false;
isLoading = false; isLoading = false;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
isError = true; isError = true;
isLoading = false; isLoading = false;
this.error = error; this.error = error;
@ -309,16 +263,16 @@ class PatientsProvider with ChangeNotifier {
notifyListeners(); notifyListeners();
await BaseAppClient.post('Patients.svc/REST/GetPrescriptionReport', await BaseAppClient.post('Patients.svc/REST/GetPrescriptionReport',
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
response['ListPRM'].forEach((v) { response['ListPRM'].forEach((v) {
prescriptionReport.add(PrescriptionReport.fromJson(v)); prescriptionReport.add(PrescriptionReport.fromJson(v));
}); });
isError = false; isError = false;
isLoading = false; isLoading = false;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
isError = true; isError = true;
isLoading = false; isLoading = false;
this.error = error; this.error = error;
}, body: prescriptionReqModel); }, body: prescriptionReqModel);
notifyListeners(); notifyListeners();
} }
@ -347,33 +301,20 @@ class PatientsProvider with ChangeNotifier {
// notifyListeners(); // notifyListeners();
setBasicData(); setBasicData();
try { try {
if (await Helpers.checkConnection()) { await BaseAppClient.post(GET_RADIOLOGY,
final response = onSuccess: (dynamic response, int statusCode) {
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) {
patientRadiologyList = []; patientRadiologyList = [];
res['List_GetRadOreders'].forEach((v) { response['List_GetRadOreders'].forEach((v) {
patientRadiologyList.add(new RadiologyResModel.fromJson(v)); patientRadiologyList.add(new RadiologyResModel.fromJson(v));
}); });
} else { isLoading = false;
isError = false;
this.error = '';
}, onFailure: (String error, int statusCode) {
isLoading = false;
isError = true; isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; this.error = error;
} }, body: patient);
}
} else {
isLoading = false;
isError = true;
error = 'Please Check The Internet Connection';
}
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -391,47 +332,33 @@ class PatientsProvider with ChangeNotifier {
requestLabResult.patientTypeID = labOrdersResModel.patientType; requestLabResult.patientTypeID = labOrdersResModel.patientType;
await BaseAppClient.post('DoctorApplication.svc/REST/GetPatientLabResults', await BaseAppClient.post('DoctorApplication.svc/REST/GetPatientLabResults',
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
isError = false; isError = false;
isLoading = false; isLoading = false;
response['List_GetLabNormal'].forEach((v) { response['List_GetLabNormal'].forEach((v) {
labResultList.add(new LabResult.fromJson(v)); labResultList.add(new LabResult.fromJson(v));
}); });
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
isError = true; isError = true;
isLoading = false; isLoading = false;
this.error = error; this.error = error;
}, body: requestLabResult.toJson()); }, body: requestLabResult.toJson());
notifyListeners(); notifyListeners();
} }
getPatientInsuranceApprovals(patient) async { getPatientInsuranceApprovals(patient) async {
setBasicData(); setBasicData();
try { try {
if (await Helpers.checkConnection()) { await BaseAppClient.post(PATIENT_INSURANCE_APPROVALS_URL,
final response = await AppClient.post(PATIENT_INSURANCE_APPROVALS_URL, onSuccess: (dynamic response, int statusCode) {
body: json.encode(patient)); insuranceApporvalsList = response['List_ApprovalMain_InPatient'];
final int statusCode = response.statusCode; isLoading = false;
isLoading = false; isError = false;
this.error = '';
if (statusCode < 200 || statusCode >= 400 || json == null) { }, onFailure: (String error, int statusCode) {
isError = true; isLoading = false;
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 {
isError = true; isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; this.error = error;
} }, body: patient);
}
} else {
isLoading = false;
isError = true;
error = 'Please Check The Internet Connection';
}
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -445,30 +372,17 @@ class PatientsProvider with ChangeNotifier {
getPatientProgressNote(patient) async { getPatientProgressNote(patient) async {
setBasicData(); setBasicData();
try { try {
if (await Helpers.checkConnection()) { await BaseAppClient.post(PATIENT_PROGRESS_NOTE_URL,
final response = await AppClient.post(PATIENT_PROGRESS_NOTE_URL, onSuccess: (dynamic response, int statusCode) {
body: json.encode(patient)); patientProgressNoteList = response['List_GetPregressNoteForInPatient'];
final int statusCode = response.statusCode; isLoading = false;
isLoading = false; isError = false;
this.error = '';
if (statusCode < 200 || statusCode >= 400 || json == null) { }, onFailure: (String error, int statusCode) {
isError = true; isLoading = false;
error = 'Error While Fetching data';
} else {
var res = json.decode(response.body);
print('$res');
if (res['MessageStatus'] == 1) {
patientProgressNoteList = res['List_GetPregressNoteForInPatient'];
} else {
isError = true; isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; this.error = error;
} }, body: patient);
}
} else {
isLoading = false;
isError = true;
error = 'Please Check The Internet Connection';
}
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -480,51 +394,29 @@ class PatientsProvider with ChangeNotifier {
*@desc: getDoctorsList *@desc: getDoctorsList
*/ */
getDoctorsList(String clinicId) async { getDoctorsList(String clinicId) async {
String token = await sharedPref.getString(TOKEN);
int projectID = await sharedPref.getInt(PROJECT_ID);
setBasicData(); setBasicData();
try { try {
if (await Helpers.checkConnection()) { _doctorsByClinicIdRequest.clinicID = clinicId;
_doctorsByClinicIdRequest.projectID = projectID; await BaseAppClient.post(PATIENT_GET_DOCTOR_BY_CLINIC_URL,
_doctorsByClinicIdRequest.clinicID = clinicId; onSuccess: (dynamic response, int statusCode) {
_doctorsByClinicIdRequest.tokenID = token; doctorsList = response['List_Doctors_All'];
isLoading = false;
final response = await AppClient.post(PATIENT_GET_DOCTOR_BY_CLINIC_URL, isError = false;
body: json.encode(_doctorsByClinicIdRequest)); this.error = '';
final int statusCode = response.statusCode; }, onFailure: (String error, int statusCode) {
isLoading = false;
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 {
isError = true; isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; this.error = error;
isLoading = false; }, body: _doctorsByClinicIdRequest.toJson());
}
}
} else {
isLoading = false;
isError = true;
error = 'Please Check The Internet Connection';
}
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
isLoading = false;
} }
} }
List getDoctorNameList() { List getDoctorNameList() {
var doctorNamelist = var doctorNamelist =
doctorsList.map((value) => value['DoctorName'].toString()).toList(); doctorsList.map((value) => value['DoctorName'].toString()).toList();
return doctorNamelist; return doctorNamelist;
} }
@ -533,37 +425,19 @@ class PatientsProvider with ChangeNotifier {
*@desc: getClinicsList *@desc: getClinicsList
*/ */
getClinicsList() async { getClinicsList() async {
String token = await sharedPref.getString(TOKEN);
setBasicData(); setBasicData();
try { try {
if (await Helpers.checkConnection()) { await BaseAppClient.post(PATIENT_GET_CLINIC_BY_PROJECT_URL,
int projectID = await sharedPref.getInt(PROJECT_ID); onSuccess: (dynamic response, int statusCode) {
_clinicByProjectIdRequest.projectID = projectID; clinicsList = response['List_Clinic_All'];
_clinicByProjectIdRequest.tokenID = token; isLoading = false;
isError = false;
final response = await AppClient.post(PATIENT_GET_CLINIC_BY_PROJECT_URL, this.error = '';
body: json.encode(_clinicByProjectIdRequest)); }, onFailure: (String error, int statusCode) {
final int statusCode = response.statusCode; isLoading = false;
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 {
isError = true; isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; this.error = error;
} }, body: _clinicByProjectIdRequest.toJson());
}
} else {
isLoading = false;
isError = true;
error = 'Please Check The Internet Connection';
}
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -582,33 +456,19 @@ class PatientsProvider with ChangeNotifier {
*@desc: getReferralFrequancyList *@desc: getReferralFrequancyList
*/ */
getReferralFrequancyList() async { getReferralFrequancyList() async {
String token = await sharedPref.getString(TOKEN);
setBasicData(); setBasicData();
try { try {
if (await Helpers.checkConnection()) { await BaseAppClient.post(PATIENT_GET_LIST_REFERAL_URL,
_referralFrequencyRequest.tokenID = token; onSuccess: (dynamic response, int statusCode) {
final response = await AppClient.post(PATIENT_GET_LIST_REFERAL_URL, referalFrequancyList = response['list_STPReferralFrequency'];
body: json.encode(_referralFrequencyRequest)); isLoading = false;
final int statusCode = response.statusCode; isError = false;
isLoading = false; this.error = '';
if (statusCode < 200 || statusCode >= 400 || json == null) { }, onFailure: (String error, int statusCode) {
isError = true; isLoading = false;
error = 'Error While Fetching data';
} else {
var res = json.decode(response.body);
print('$res');
if (res['MessageStatus'] == 1) {
referalFrequancyList = res['list_STPReferralFrequency'];
} else {
isError = true; isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage']; this.error = error;
} }, body: _referralFrequencyRequest.toJson());
}
} else {
isLoading = false;
isError = true;
error = 'Please Check The Internet Connection';
}
notifyListeners(); notifyListeners();
} catch (err) { } catch (err) {
handelCatchErrorCase(err); handelCatchErrorCase(err);
@ -628,23 +488,23 @@ class PatientsProvider with ChangeNotifier {
*/ */
referToDoctor(context, referToDoctor(context,
{String selectedDoctorID, {String selectedDoctorID,
String selectedClinicID, String selectedClinicID,
int admissionNo, int admissionNo,
String extension, String extension,
String priority, String priority,
String frequency, String frequency,
String referringDoctorRemarks, String referringDoctorRemarks,
int patientID, int patientID,
int patientTypeID, int patientTypeID,
String roomID, String roomID,
int projectID}) async { int projectID}) async {
setBasicData(); setBasicData();
try { try {
if (await Helpers.checkConnection()) { if (await Helpers.checkConnection()) {
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel doctorProfile =
new DoctorProfileModel.fromJson(profile); new DoctorProfileModel.fromJson(profile);
int doctorID = doctorProfile.doctorID; int doctorID = doctorProfile.doctorID;
int clinicId = doctorProfile.clinicID; int clinicId = doctorProfile.clinicID;
_referToDoctorRequest = ReferToDoctorRequest( _referToDoctorRequest = ReferToDoctorRequest(

@ -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/models/patient/topten_users_res_model.dart';
import 'package:doctor_app_flutter/providers/patients_provider.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_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_button.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_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<QrReaderScreen> { class _QrReaderScreenState extends State<QrReaderScreen> {
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
bool isLoading = false; bool isLoading = false;
bool isError = false; bool isError = false;
@ -72,9 +73,9 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
height: 7, height: 7,
), ),
AppText( AppText(
'scan Qr code to retrieve patient profile', 'scan Qr code to retrieve patient profile',
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
textAlign: TextAlign.center textAlign: TextAlign.center
), ),
SizedBox( SizedBox(
@ -123,15 +124,15 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
/// var result = await BarcodeScanner.scan(); /// var result = await BarcodeScanner.scan();
/// int patientID = get from qr result /// int patientID = get from qr result
var result = await BarcodeScanner.scan(); var result = await BarcodeScanner.scan();
// if (result.rawContent == "") { // if (result.rawContent == "") {
List<String> listOfParams = result.rawContent.split(','); List<String> listOfParams = result.rawContent.split(',');
String patientType = "1"; String patientType = "1";
setState(() { setState(() {
isLoading = true; isLoading = true;
isError = false; isError = false;
patientList = []; patientList = [];
}); });
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
// Map profile = await sharedPref.getObj(DOCTOR_PROFILE); // Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
// DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); // DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile);
// patient.PatientID = 8808; // patient.PatientID = 8808;
@ -140,57 +141,64 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
// patient.setClinicID = doctorProfile.clinicID; // patient.setClinicID = doctorProfile.clinicID;
// patient.setProjectID = doctorProfile.projectID; // patient.setProjectID = doctorProfile.projectID;
// Provider.of<PatientsProvider>(context, listen: false); // Provider.of<PatientsProvider>(context, listen: false);
patient.PatientID = 8808; patient.PatientID = 8808;
patient.TokenID = token; patient.TokenID = token;
Provider.of<PatientsProvider>(context, listen: false) Provider.of<PatientsProvider>(context, listen: false)
.getPatientList(patient, "1") .getPatientList(patient, "1")
.then((response) { .then((response) {
if (response['MessageStatus'] == 1) { if (response['MessageStatus'] == 1) {
switch (patientType) { switch (patientType) {
case "0": case "0":
if (response['List_MyOutPatient'] != null) { if (response['List_MyOutPatient'] != null) {
setState(() { setState(() {
patientList = ModelResponse.fromJson(response['List_MyOutPatient']).list; patientList = ModelResponse.fromJson(response['List_MyOutPatient']).list;
isLoading = false; isLoading = false;
}); });
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": patientList[0], "patient": patientList[0],
}); });
} else { } else {
setState(() { setState(() {
isError = true; isError = true;
error = 'No patient'; isLoading = false;
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; 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);
});
}
// }
} }

@ -1,5 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -11,8 +12,8 @@ import '../../widgets/auth/login_form.dart';
import '../../widgets/shared/app_scaffold_widget.dart'; import '../../widgets/shared/app_scaffold_widget.dart';
import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class Loginsreen extends StatefulWidget { class Loginsreen extends StatefulWidget {
@override @override
_LoginsreenState createState() => _LoginsreenState(); _LoginsreenState createState() => _LoginsreenState();
@ -40,10 +41,10 @@ class _LoginsreenState extends State<Loginsreen> {
}); });
} }
/* /*
*@author: Elham Rababah *@author: Elham Rababah
*@Date:19/4/2020 *@Date:19/4/2020
*@param: isLoading *@param: isLoading
*@return: *@return:
*@desc: Change Isloading attribute in order to show or hide loader *@desc: Change Isloading attribute in order to show or hide loader
*/ */
@ -55,6 +56,7 @@ class _LoginsreenState extends State<Loginsreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
getSharedPref(); getSharedPref();
return AppScaffold( return AppScaffold(
isLoading: _isLoading, isLoading: _isLoading,
@ -78,24 +80,24 @@ class _LoginsreenState extends State<Loginsreen> {
children: <Widget>[ children: <Widget>[
(platformImei == null) (platformImei == null)
? Column( ? Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
AuthHeader(loginType.knownUser), AuthHeader(loginType.knownUser),
LoginForm( LoginForm(
changeLoadingStata: changeLoadingStata:
changeLoadingStata, changeLoadingStata,
), ),
], ],
) )
: Column( : Column(
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
AuthHeader(loginType.unknownUser), AuthHeader(loginType.unknownUser),
KnownUserLogin(), KnownUserLogin(),
], ],
), ),
])); ]));
} }
} }

@ -15,46 +15,47 @@ class MyScheduleScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
scheduleProvider = Provider.of(context); scheduleProvider = Provider.of(context);
return Scaffold( return AppScaffold(
appBarTitle: TranslationBase.of(context).mySchedule,
body: scheduleProvider.isLoading body: scheduleProvider.isLoading
? DrAppCircularProgressIndeicator() ? DrAppCircularProgressIndeicator()
: scheduleProvider.isError : scheduleProvider.isError
? Center( ? Center(
child: AppText( child: AppText(
scheduleProvider.error, scheduleProvider.error,
color: Theme.of(context).errorColor, color: Theme.of(context).errorColor,
), ),
) )
: scheduleProvider.listDoctorWorkingHoursTable.length == 0 : scheduleProvider.listDoctorWorkingHoursTable.length == 0
? Center( ? Center(
child: AppText( child: AppText(
TranslationBase.of(context).errorNoSchedule, TranslationBase.of(context).errorNoSchedule,
color: Theme.of(context).errorColor, color: Theme.of(context).errorColor,
), ),
) )
: Container( : Container(
padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0),
child: ListView( child: ListView(
children: <Widget>[ children: <Widget>[
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
SizedBox( SizedBox(
height: 20, height: 20,
),
scheduleListByDate(),
// scheduleListByDate('Wednesday, 8 April '),
],
),
],
),
],
),
), ),
scheduleListByDate(),
// scheduleListByDate('Wednesday, 8 April '),
],
),
],
),
],
),
),
); );
} }

@ -79,116 +79,112 @@ class _RadiologyScreenState extends State<RadiologyScreen> {
body: patientsProv.isLoading body: patientsProv.isLoading
? DrAppCircularProgressIndeicator() ? DrAppCircularProgressIndeicator()
: patientsProv.isError : patientsProv.isError
? DrAppEmbeddedError(error: patientsProv.error) ? DrAppEmbeddedError(error: patientsProv.error)
: patientsProv.patientRadiologyList.length == 0 : patientsProv.patientRadiologyList.length == 0
? DrAppEmbeddedError(error: 'You don\'t have any Vital Sign') ? DrAppEmbeddedError(error: 'You don\'t have any Vital Sign')
: Container( : Container(
margin: EdgeInsets.fromLTRB( margin: EdgeInsets.fromLTRB(
SizeConfig.realScreenWidth * 0.05, SizeConfig.realScreenWidth * 0.05,
0, 0,
SizeConfig.realScreenWidth * 0.05, SizeConfig.realScreenWidth * 0.05,
0), 0),
child: Container( child: Container(
margin: EdgeInsets.symmetric(vertical: 10), margin: EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(20.0), Radius.circular(20.0),
), ),
), ),
child: ListView.builder( child: ListView.builder(
itemCount: patientsProv.patientRadiologyList.length, itemCount: patientsProv.patientRadiologyList.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return InkWell( return InkWell(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => RadiologyReportScreen(reportData: patientsProv.patientRadiologyList[index].reportData,)),); MaterialPageRoute(builder: (context) => RadiologyReportScreen(reportData: patientsProv.patientRadiologyList[index].reportData,)),);
}, },
child: Container( child: Container(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(10)), BorderRadius.all(Radius.circular(10)),
border: Border( border: Border(
bottom: BorderSide( bottom: BorderSide(
color: Colors.grey, width: 0.5), color: Colors.grey, width: 0.5),
top: BorderSide( top: BorderSide(
color: Colors.grey, width: 0.5), color: Colors.grey, width: 0.5),
left: BorderSide( left: BorderSide(
color: Colors.grey, width: 0.5), color: Colors.grey, width: 0.5),
right: BorderSide( right: BorderSide(
color: Colors.grey, width: 0.5), color: Colors.grey, width: 0.5),
),
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
LargeAvatar(
url: patientsProv
.patientRadiologyList[index]
.doctorImageURL,
),
Expanded(
child: Padding(
padding:
const EdgeInsets.fromLTRB(
8, 0, 0, 0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
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(
child: Column( ' ${patientsProv.patientRadiologyList[index].clinicName}',
crossAxisAlignment: fontSize: 2 *
CrossAxisAlignment.start, SizeConfig
children: <Widget>[ .textMultiplier,
Row( color: Theme.of(context)
children: <Widget>[ .primaryColor,
LargeAvatar( ),
url: patientsProv SizedBox(
.patientRadiologyList[index] height: 8,
.doctorImageURL, ),
name: patientsProv ],
.patientLabResultOrdersList[
index]
.doctorName,
),
Expanded(
child: Padding(
padding:
const EdgeInsets.fromLTRB(
8, 0, 0, 0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
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,
),
],
),
),
)
],
),
],
),
), ),
); ),
}), )
), ],
),
],
), ),
),
);
}),
),
),
); );
} }
} }

@ -36,7 +36,7 @@ class _LoginFormState extends State<LoginForm> {
String _platformImei = 'Unknown'; String _platformImei = 'Unknown';
String uniqueId = "Unknown"; String uniqueId = "Unknown";
var projectsList = []; var projectsList = [];
bool _isInit = true;
FocusNode focusPass; FocusNode focusPass;
FocusNode focusProject; FocusNode focusProject;
@ -56,14 +56,22 @@ class _LoginFormState extends State<LoginForm> {
initPlatformState(); initPlatformState();
} }
@override
void didChangeDependencies() {
super.didChangeDependencies();
if (_isInit) {
if (projectsList.length == 0) {
getProjectsList();
}
}
_isInit = false;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final focusPass = FocusNode(); final focusPass = FocusNode();
final focusProject = FocusNode(); final focusProject = FocusNode();
if (projectsList.length == 0) {
getProjectsList();
}
AuthProvider authProv = Provider.of<AuthProvider>(context); AuthProvider authProv = Provider.of<AuthProvider>(context);
return Form( return Form(
@ -89,8 +97,9 @@ class _LoginFormState extends State<LoginForm> {
userInfo.UserID = value.trim(); userInfo.UserID = value.trim();
}, },
onFieldSubmitted: (_) { onFieldSubmitted: (_) {
FocusScope.of(context).requestFocus(focusPass); FocusScope.of(context).nextFocus();
}, },
autofocus: false,
), ),
buildSizedBox(), buildSizedBox(),
TextFormField( TextFormField(
@ -109,7 +118,7 @@ class _LoginFormState extends State<LoginForm> {
userInfo.Password = value; userInfo.Password = value;
}, },
onFieldSubmitted: (_) { onFieldSubmitted: (_) {
FocusScope.of(context).requestFocus(focusProject); FocusScope.of(context).nextFocus();
helpers.showCupertinoPicker( helpers.showCupertinoPicker(
context, projectsList, 'Name', onSelectProject); context, projectsList, 'Name', onSelectProject);
}, },
@ -134,22 +143,8 @@ class _LoginFormState extends State<LoginForm> {
}), }),
buildSizedBox(), buildSizedBox(),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Checkbox(
value: true,
activeColor: Theme.of(context).primaryColor,
onChanged: (bool newValue) {}),
Text("Remember me",
style: TextStyle(
fontSize: 2 * SizeConfig.textMultiplier)),
],
),
),
RaisedButton( RaisedButton(
onPressed: () { onPressed: () {
login(context, authProv, widget.changeLoadingStata); login(context, authProv, widget.changeLoadingStata);
@ -194,17 +189,26 @@ class _LoginFormState extends State<LoginForm> {
*/ */
InputDecoration buildInputDecoration(BuildContext context, hint, asset) { InputDecoration buildInputDecoration(BuildContext context, hint, asset) {
return InputDecoration( return InputDecoration(
prefixIcon: Image.asset(asset), prefixIcon: Image.asset(asset),
hintText: hint, hintText: hint,
hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier), hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(20)), borderRadius: BorderRadius.all(Radius.circular(20)),
borderSide: BorderSide(color: Hexcolor('#CCCCCC')), borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)), borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).primaryColor), 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() { SizedBox buildSizedBox() {
@ -214,6 +218,11 @@ class _LoginFormState extends State<LoginForm> {
} }
login(context, AuthProvider authProv, Function changeLoadingStata) { login(context, AuthProvider authProv, Function changeLoadingStata) {
FocusScopeNode currentFocus = FocusScope.of(context);
// if (!currentFocus.hasPrimaryFocus) {
// currentFocus.unfocus();
// }
changeLoadingStata(true); changeLoadingStata(true);
if (loginFormKey.currentState.validate()) { if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save(); loginFormKey.currentState.save();
@ -227,7 +236,7 @@ class _LoginFormState extends State<LoginForm> {
sharedPref.setString(TOKEN, res['LogInTokenID']); sharedPref.setString(TOKEN, res['LogInTokenID']);
print("token" + res['LogInTokenID']); print("token" + res['LogInTokenID']);
Navigator.of(context).pushNamed(VERIFICATION_METHODS); Navigator.of(context).pushReplacementNamed(VERIFICATION_METHODS);
} else { } else {
// handel error // handel error
// widget.showCenterShortLoadingToast("watting"); // widget.showCenterShortLoadingToast("watting");
@ -237,7 +246,7 @@ class _LoginFormState extends State<LoginForm> {
}).catchError((err) { }).catchError((err) {
print('$err'); print('$err');
changeLoadingStata(false); changeLoadingStata(false);
helpers.showErrorToast(); helpers.showErrorToast(err);
}); });
} else { } else {
changeLoadingStata(false); changeLoadingStata(false);
@ -285,7 +294,7 @@ class _LoginFormState extends State<LoginForm> {
// Platform messages may fail, so we use a try/catch PlatformException. // Platform messages may fail, so we use a try/catch PlatformException.
try { try {
platformImei = platformImei =
await ImeiPlugin.getImei(shouldShowRequestPermissionRationale: false); await ImeiPlugin.getImei(shouldShowRequestPermissionRationale: false);
idunique = await ImeiPlugin.getId(); idunique = await ImeiPlugin.getId();
} on PlatformException { } on PlatformException {
platformImei = 'Failed to get platform version.'; platformImei = 'Failed to get platform version.';

@ -93,7 +93,7 @@ class _VerifyAccountState extends State<VerifyAccount> {
buildSizedBox(30), buildSizedBox(30),
Row( Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceAround, MainAxisAlignment.spaceAround,
children: <Widget>[ children: <Widget>[
Container( Container(
width: SizeConfig.realScreenWidth * 0.20, width: SizeConfig.realScreenWidth * 0.20,
@ -131,7 +131,7 @@ class _VerifyAccountState extends State<VerifyAccount> {
style: buildTextStyle(), style: buildTextStyle(),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
decoration: decoration:
buildInputDecoration(context), buildInputDecoration(context),
onSaved: (val) { onSaved: (val) {
verifyAccountFormValue['digit2'] = verifyAccountFormValue['digit2'] =
val; val;
@ -158,7 +158,7 @@ class _VerifyAccountState extends State<VerifyAccount> {
style: buildTextStyle(), style: buildTextStyle(),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
decoration: decoration:
buildInputDecoration(context), buildInputDecoration(context),
onSaved: (val) { onSaved: (val) {
verifyAccountFormValue['digit3'] = verifyAccountFormValue['digit3'] =
val; val;
@ -183,7 +183,7 @@ class _VerifyAccountState extends State<VerifyAccount> {
style: buildTextStyle(), style: buildTextStyle(),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
decoration: decoration:
buildInputDecoration(context), buildInputDecoration(context),
onSaved: (val) { onSaved: (val) {
verifyAccountFormValue['digit4'] = verifyAccountFormValue['digit4'] =
val; val;
@ -191,20 +191,13 @@ class _VerifyAccountState extends State<VerifyAccount> {
validator: validateCodeDigit)) validator: validateCodeDigit))
], ],
), ),
// buildSizedBox(40),
buildSizedBox(20), buildSizedBox(20),
buildText(), buildText(),
// buildSizedBox(10.0),
// Text()
buildSizedBox(40), buildSizedBox(40),
// buildSizedBox(),
RaisedButton( RaisedButton(
onPressed: () { onPressed: () {
verifyAccount( verifyAccount(
authProv, widget.changeLoadingStata); authProv, widget.changeLoadingStata);
// Navigator.of(context).pushNamed(HOME);
}, },
elevation: 0.0, elevation: 0.0,
child: Container( child: Container(
@ -216,7 +209,7 @@ class _VerifyAccountState extends State<VerifyAccount> {
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: fontSize:
3 * SizeConfig.textMultiplier), 3 * SizeConfig.textMultiplier),
), ),
), ),
), ),
@ -264,16 +257,25 @@ class _VerifyAccountState extends State<VerifyAccount> {
*/ */
InputDecoration buildInputDecoration(BuildContext context) { InputDecoration buildInputDecoration(BuildContext context) {
return InputDecoration( return InputDecoration(
// ts/images/password_icon.png // ts/images/password_icon.png
contentPadding: EdgeInsets.only(top: 30, bottom: 30), contentPadding: EdgeInsets.only(top: 30, bottom: 30),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10)), borderRadius: BorderRadius.all(Radius.circular(10)),
borderSide: BorderSide(color: Colors.black), borderSide: BorderSide(color: Colors.black),
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)), borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).primaryColor), 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),
),
);
} }
/* /*
@ -284,17 +286,27 @@ class _VerifyAccountState extends State<VerifyAccount> {
*@desc: buildText *@desc: buildText
*/ */
RichText buildText() { RichText buildText() {
String medthodName;
switch (model['OTP_SendType']) {
case 1:
medthodName = 'SMS';
break;
case 2:
medthodName = 'WhatsApp';
break;
default:
}
var text = RichText( var text = RichText(
text: new TextSpan( text: new TextSpan(
style: new TextStyle( style: new TextStyle(
fontSize: 3.0 * SizeConfig.textMultiplier, color: Colors.black), fontSize: 3.0 * SizeConfig.textMultiplier, color: Colors.black),
children: <TextSpan>[ children: <TextSpan>[
new TextSpan(text: 'You will receive a '), new TextSpan(text: 'You will receive a '),
new TextSpan( new TextSpan(
text: 'Login Code ', text: 'Login Code ',
style: TextStyle(fontWeight: FontWeight.w700)), style: TextStyle(fontWeight: FontWeight.w700)),
new TextSpan(text: 'By SMS, Please enter the code') new TextSpan(text: 'By ${medthodName}, Please enter the code')
])); ]));
return text; return text;
} }
@ -322,7 +334,7 @@ class _VerifyAccountState extends State<VerifyAccount> {
verifyAccountFormValue['digit4']; verifyAccountFormValue['digit4'];
print(activationCode); print(activationCode);
int projectID = await sharedPref.getInt(PROJECT_ID); int projectID = await sharedPref.getInt(PROJECT_ID);
Map model = { Map<String, dynamic> model = {
"activationCode": activationCode, "activationCode": activationCode,
"DoctorID": _loggedUser['DoctorID'], "DoctorID": _loggedUser['DoctorID'],
"LogInTokenID": _loggedUser['LogInTokenID'], "LogInTokenID": _loggedUser['LogInTokenID'],
@ -348,7 +360,7 @@ class _VerifyAccountState extends State<VerifyAccount> {
res['List_DoctorProfile'][0], changeLoadingStata); res['List_DoctorProfile'][0], changeLoadingStata);
} else { } else {
_asyncSimpleDialog(context, res['List_DoctorsClinic'], 'ClinicName', _asyncSimpleDialog(context, res['List_DoctorsClinic'], 'ClinicName',
'Please Select Clinic') 'Please Select Clinic')
.then((clinicInfo) { .then((clinicInfo) {
ClinicModel clinic = ClinicModel.fromJson(clinicInfo); ClinicModel clinic = ClinicModel.fromJson(clinicInfo);
print(clinicInfo); print(clinicInfo);
@ -381,7 +393,7 @@ class _VerifyAccountState extends State<VerifyAccount> {
Map<String, dynamic> profile, Function changeLoadingStata) { Map<String, dynamic> profile, Function changeLoadingStata) {
changeLoadingStata(false); changeLoadingStata(false);
sharedPref.setObj(DOCTOR_PROFILE, profile); sharedPref.setObj(DOCTOR_PROFILE, profile);
Navigator.of(context).pushNamed(HOME); Navigator.of(context).pushReplacementNamed(HOME);
} }
Future<dynamic> _asyncSimpleDialog( Future<dynamic> _asyncSimpleDialog(
@ -407,7 +419,7 @@ class _VerifyAccountState extends State<VerifyAccount> {
} }
/* /*
*@author: Elham Rababah *@author: Elham Rababah
*@Date:17/5/2020 *@Date:17/5/2020
*@param: ClinicModel clinicInfo, Function changeLoadingStata *@param: ClinicModel clinicInfo, Function changeLoadingStata
*@return: *@return:
@ -421,7 +433,7 @@ class _VerifyAccountState extends State<VerifyAccount> {
projectID: clinicInfo.projectID, projectID: clinicInfo.projectID,
tokenID: '', tokenID: '',
languageID: 2); languageID: 2);
authProv.getDocProfiles(docInfo).then((res) { authProv.getDocProfiles(docInfo.toJson()).then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
print("DoctorProfileList ${res['DoctorProfileList'][0]}"); print("DoctorProfileList ${res['DoctorProfileList'][0]}");
loginProcessCompleted(res['DoctorProfileList'][0], changeLoadingStata); loginProcessCompleted(res['DoctorProfileList'][0], changeLoadingStata);

@ -50,7 +50,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
super.didChangeDependencies(); super.didChangeDependencies();
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
verificationMethod = verificationMethod =
routeArgs != null ? routeArgs['verificationMethod'] : null; routeArgs != null ? routeArgs['verificationMethod'] : null;
} }
@override @override
@ -101,17 +101,17 @@ class _VerificationMethodsState extends State<VerificationMethods> {
child: buildFingerprintMethod( child: buildFingerprintMethod(
context, authProv), context, authProv),
replacement: replacement:
buildWhatsAppMethod(context, authProv), buildWhatsAppMethod(context, authProv),
), ),
Visibility( Visibility(
visible: hideSilentMethods() ? false : true, visible: hideSilentMethods() ? false : true,
child: buildFaceIDMethod(context, authProv), child: buildFaceIDMethod(context, authProv),
replacement: replacement:
buildSMSMethod(context, authProv), buildSMSMethod(context, authProv),
), ),
Visibility( Visibility(
visible: visible:
hideSilentMethods() ? false : true, hideSilentMethods() ? false : true,
child: buildWhatsAppMethod( child: buildWhatsAppMethod(
context, authProv)), context, authProv)),
Visibility( Visibility(
@ -126,8 +126,8 @@ class _VerificationMethodsState extends State<VerificationMethods> {
// height: 500, // height: 500,
), ),
SizedBox( SizedBox(
// height: 20, // height: 20,
) )
], ],
), ),
); );
@ -136,7 +136,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
}); });
} }
/* /*
*@author: Elham Rababah *@author: Elham Rababah
*@Date:28/5/2020 *@Date:28/5/2020
*@param: BuildContext context, AuthProvider authProv *@param: BuildContext context, AuthProvider authProv
@ -149,7 +149,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
sendActivationCodeByOtpNotificationType(1, authProv); sendActivationCodeByOtpNotificationType(1, authProv);
}); });
} }
/* /*
*@author: Elham Rababah *@author: Elham Rababah
*@Date:28/5/2020 *@Date:28/5/2020
*@param: BuildContext context, AuthProvider authProv *@param: BuildContext context, AuthProvider authProv
@ -159,9 +159,9 @@ class _VerificationMethodsState extends State<VerificationMethods> {
Center buildWhatsAppMethod(BuildContext context, AuthProvider authProv) { Center buildWhatsAppMethod(BuildContext context, AuthProvider authProv) {
return buildVerificationMethod( return buildVerificationMethod(
context, 'assets/images/verification_whatsapp_icon.png', 'WhatsApp', context, 'assets/images/verification_whatsapp_icon.png', 'WhatsApp',
() { () {
sendActivationCodeByOtpNotificationType(2, authProv); sendActivationCodeByOtpNotificationType(2, authProv);
}); });
} }
/* /*
*@author: Elham Rababah *@author: Elham Rababah
@ -186,8 +186,8 @@ class _VerificationMethodsState extends State<VerificationMethods> {
Center buildFingerprintMethod(BuildContext context, AuthProvider authProv) { Center buildFingerprintMethod(BuildContext context, AuthProvider authProv) {
return buildVerificationMethod(context, return buildVerificationMethod(context,
'assets/images/verification_fingerprint_icon.png', 'Fingerprint', () { 'assets/images/verification_fingerprint_icon.png', 'Fingerprint', () {
sendActivationCodeByOtpNotificationType(4, authProv); sendActivationCodeByOtpNotificationType(4, authProv);
}); });
} }
/* /*
@ -212,7 +212,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
width: 1, width: 1,
color: Hexcolor( color: Hexcolor(
'#CCCCCC') // <--- border width here '#CCCCCC') // <--- border width here
), ),
borderRadius: BorderRadius.all(Radius.circular(10))), borderRadius: BorderRadius.all(Radius.circular(10))),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
@ -251,11 +251,12 @@ class _VerificationMethodsState extends State<VerificationMethods> {
*@desc: send Activation Code By Otp Notification Type *@desc: send Activation Code By Otp Notification Type
*/ */
sendActivationCodeByOtpNotificationType(oTPSendType, AuthProvider authProv) { sendActivationCodeByOtpNotificationType(oTPSendType, AuthProvider authProv) {
// TODO : build enum for verfication method // TODO : build enum for verfication method
if (oTPSendType == 1 || oTPSendType == 2) { if (oTPSendType == 1 || oTPSendType == 2) {
widget.changeLoadingStata(true); widget.changeLoadingStata(true);
Map model = { Map<String,dynamic> model = {
"LogInTokenID": _loggedUser['LogInTokenID'], "LogInTokenID": _loggedUser['LogInTokenID'],
"Channel": 9, "Channel": 9,
"MobileNumber": _loggedUser['MobileNumber'], "MobileNumber": _loggedUser['MobileNumber'],
@ -270,7 +271,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
widget.changeLoadingStata(false); widget.changeLoadingStata(false);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
Navigator.of(context).pushNamed(VERIFY_ACCOUNT, arguments: {'model':model}); Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT, arguments: {'model':model});
} else { } else {
print(res['ErrorEndUserMessage']); print(res['ErrorEndUserMessage']);
helpers.showErrorToast(res['ErrorEndUserMessage']); helpers.showErrorToast(res['ErrorEndUserMessage']);

@ -42,269 +42,277 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Row( InkWell(
mainAxisAlignment: MainAxisAlignment.spaceBetween, onTap: () {
children: <Widget>[ setState(() {
AppText( _showDetails = !_showDetails;
'${widget.myReferralPatientModel.firstName} ${widget.myReferralPatientModel.lastName}', });
fontSize: 2.5 * SizeConfig.textMultiplier, },
fontWeight: FontWeight.bold, child: Row(
), mainAxisAlignment: MainAxisAlignment.spaceBetween,
InkWell( children: <Widget>[
onTap: () { AppText(
setState(() { '${widget.myReferralPatientModel.firstName} ${widget.myReferralPatientModel.lastName}',
_showDetails = !_showDetails; fontSize: 2.5 * SizeConfig.textMultiplier,
}); fontWeight: FontWeight.bold,
}, ),
child: Icon(_showDetails Icon(_showDetails
? Icons.keyboard_arrow_up ? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down)), : Icons.keyboard_arrow_down),
],
],
),
), ),
!_showDetails !_showDetails
? Container() ? Container()
: AnimatedContainer( : AnimatedContainer(
duration: Duration(milliseconds: 200), duration: Duration(milliseconds: 200),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
SizedBox(height: 5,), SizedBox(height: 5,),
Divider(color: Color(0xFF000000),height: 0.5,), Divider(color: Color(0xFF000000),height: 0.5,),
Table( Table(
border: TableBorder.symmetric(inside: BorderSide(width: 0.5),), border: TableBorder.symmetric(inside: BorderSide(width: 0.5),),
children: [
TableRow(
children: [ children: [
TableRow( Container(
children: [ margin: EdgeInsets.all(2.5),
Container( padding: EdgeInsets.all(5),
margin: EdgeInsets.all(2.5), child: Column(
padding: EdgeInsets.all(5), crossAxisAlignment: CrossAxisAlignment.start,
child: Column( children: <Widget>[
crossAxisAlignment: CrossAxisAlignment.start, AppText(
children: <Widget>[ 'File No',
AppText( fontSize:
'File No', 1.7 * SizeConfig.textMultiplier,
fontSize: fontWeight: FontWeight.bold,
1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
),
AppText(
'${widget.myReferralPatientModel.referringDoctor}',
fontSize:
1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.w300,
)
],
), ),
), SizedBox(height: 5,),
Container( AppText(
margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5), '${widget.myReferralPatientModel.referringDoctor}',
padding: EdgeInsets.all(5), fontSize:
child: Column( 1.7 * SizeConfig.textMultiplier,
crossAxisAlignment: CrossAxisAlignment.start, fontWeight: FontWeight.w300,
children: <Widget>[ )
AppText( ],
'Referring Doctor', ),
fontSize: ),
1.7 * SizeConfig.textMultiplier, Container(
fontWeight: FontWeight.bold, margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5),
), padding: EdgeInsets.all(5),
AppText( child: Column(
widget.myReferralPatientModel crossAxisAlignment: CrossAxisAlignment.start,
.referringClinicDescription, children: <Widget>[
fontSize: AppText(
1.7 * SizeConfig.textMultiplier, 'Referring Doctor',
fontWeight: FontWeight.w300, 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( TableRow(
margin: EdgeInsets.all(2.5), children: [
padding: EdgeInsets.all(5), Container(
child: Column( margin: EdgeInsets.all(2.5),
crossAxisAlignment: padding: EdgeInsets.all(5),
CrossAxisAlignment.start, child: Column(
children: <Widget>[ crossAxisAlignment:
AppText( CrossAxisAlignment.start,
'Referring Clinic', children: <Widget>[
fontSize: AppText(
1.7 * SizeConfig.textMultiplier, 'Referring Clinic',
fontWeight: FontWeight.bold, fontSize:
), 1.7 * SizeConfig.textMultiplier,
AppText( fontWeight: FontWeight.bold,
'${widget.myReferralPatientModel.referringClinicDescription}',
fontSize:
1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.w300,
)
],
),
), ),
Container( SizedBox(height: 5,),
margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5), AppText(
padding: EdgeInsets.all(5), '${widget.myReferralPatientModel.referringClinicDescription}',
child: Column( fontSize:
crossAxisAlignment: 1.7 * SizeConfig.textMultiplier,
CrossAxisAlignment.start, fontWeight: FontWeight.w300,
children: <Widget>[
AppText(
'Frequency',
fontSize:
1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
),
AppText(
widget.myReferralPatientModel
.frequencyDescription,
fontSize:
1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.w300,
)
],
),
) )
] ],
),
), ),
TableRow( Container(
children: [ margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5),
Container( padding: EdgeInsets.all(5),
margin: EdgeInsets.all(2.5), child: Column(
padding: EdgeInsets.all(5), crossAxisAlignment:
child: Column( CrossAxisAlignment.start,
crossAxisAlignment: children: <Widget>[
CrossAxisAlignment.start, AppText(
children: <Widget>[ 'Frequency',
AppText( fontSize:
'Priority', 1.7 * SizeConfig.textMultiplier,
fontSize: fontWeight: FontWeight.bold,
1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
),
AppText(
'${widget.myReferralPatientModel.priorityDescription}',
fontSize:
1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.w300,
)
],
), ),
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: <Widget>[
AppText(
'Priority',
fontSize:
1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
), ),
Container( SizedBox(height: 5,),
margin: EdgeInsets.only(left: 4,top: 2.5,right: 2.5,bottom: 2.5), AppText(
padding: EdgeInsets.all(5), '${widget.myReferralPatientModel.priorityDescription}',
child: Column( fontSize:
crossAxisAlignment: 1.7 * SizeConfig.textMultiplier,
CrossAxisAlignment.start, fontWeight: FontWeight.w300,
children: <Widget>[
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,
)
],
),
) )
], ],
), ),
),
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: <Widget>[
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,), Divider(color: Color(0xFF000000),height: 0.5,),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
AppText( AppText(
'Clinic Details and Remarks', 'Clinic Details and Remarks',
fontSize: 1.7 * SizeConfig.textMultiplier, fontSize: 1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
textAlign: TextAlign.start,), textAlign: TextAlign.start,),
Texts( Texts(
'${widget.myReferralPatientModel.referringDoctorRemarks}', '${widget.myReferralPatientModel.referringDoctorRemarks}',
style: "bodyText1", style: "bodyText1",
readMore: true, readMore: true,
textAlign: TextAlign.start,
maxLength: 100)
],
),
SizedBox(
height: 5,
),
AppText(
'Answer/Suggestions',
fontSize: 1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
textAlign: TextAlign.start, textAlign: TextAlign.start,
), maxLength: 100)
SizedBox( ],
height: 5, ),
), SizedBox(
Form( height: 5,
key: _formKey, ),
child: TextFields( AppText(
maxLines: 2, 'Answer/Suggestions',
minLines: 2, fontSize: 1.7 * SizeConfig.textMultiplier,
hintText: 'Answer the patient', fontWeight: FontWeight.bold,
fontWeight: FontWeight.normal, textAlign: TextAlign.start,
initialValue: widget.myReferralPatientModel.referredDoctorRemarks ?? '', ),
readOnly: _isLoading, SizedBox(
validator: (value) { height: 5,
if (value.isEmpty) ),
return "please enter answer"; Form(
else key: _formKey,
return null; child: TextFields(
}, maxLines: 2,
), minLines: 2,
), hintText: 'Answer the patient',
SizedBox(height: 10.0), fontWeight: FontWeight.normal,
SizedBox(height: 10.0), initialValue: widget.myReferralPatientModel.referredDoctorRemarks ?? '',
Container( readOnly: _isLoading,
width: double.infinity, validator: (value) {
margin: EdgeInsets.only(left: 10,right: 10), if (value.isEmpty)
child: Button( return "please enter answer";
onTap: () async { else
final form = _formKey.currentState; return null;
if (form.validate()) { },
setState(() { ),
_isLoading = true; ),
}); SizedBox(height: 10.0),
try { SizedBox(height: 10.0),
await Provider.of<MyReferralPatientProvider>(context, listen: false).replay(answerController.text.toString(), widget.myReferralPatientModel); Container(
setState(() { width: double.infinity,
_isLoading = false; margin: EdgeInsets.only(left: 10,right: 10),
}); child: Button(
DrAppToastMsg.showSuccesToast('Reply Successfully'); onTap: () async {
final form = _formKey.currentState;
if (form.validate()) {
setState(() {
_isLoading = true;
});
try {
await Provider.of<MyReferralPatientProvider>(context, listen: false).replay(answerController.text.toString(), widget.myReferralPatientModel);
setState(() {
_isLoading = false;
});
DrAppToastMsg.showSuccesToast('Reply Successfully');
} catch (e) { } catch (e) {
setState(() { setState(() {
_isLoading = false; _isLoading = false;
}); });
DrAppToastMsg.showErrorToast(e); DrAppToastMsg.showErrorToast(e);
} }
} }
}, },
title: 'Reply', title: 'Reply',
loading: _isLoading, loading: _isLoading,
),
)
],
), ),
) )
],
),
)
], ],
), ),
), ),

@ -7,12 +7,12 @@ import 'avatar_gradients.dart';
class LargeAvatar extends StatelessWidget { class LargeAvatar extends StatelessWidget {
LargeAvatar( LargeAvatar(
{Key key, {Key key,
this.name, this.name,
this.url, this.url,
this.disableProfileView: false, this.disableProfileView: false,
this.radius = 60.0, this.radius = 60.0,
this.width = 90, this.width = 90,
this.height = 90}) this.height = 90})
: super(key: key); : super(key: key);
final String name; final String name;
@ -35,31 +35,33 @@ class LargeAvatar extends StatelessWidget {
), ),
), ),
); );
} else if (name == null || name.isEmpty) { } else if (name != null || name.isNotEmpty) {
return Center( return Center(
child: AppText( child: AppText(
'DR', name[0].toUpperCase(),
color: Colors.white, color: Colors.white,
)); fontSize: 18,
fontWeight: FontWeight.bold,
));
} else { } else {
return Center( return Center(
child: AppText( child: AppText(
name[0].toUpperCase(), 'DR',
color: Colors.white, color: Colors.white,
fontSize: 18, ));
fontWeight: FontWeight.bold,
));
} }
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var vlr = name;
var asd;
return InkWell( return InkWell(
onTap: disableProfileView onTap: disableProfileView
? null ? null
: () { : () {
//TODO when we need that //TODO when we need that
}, },
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(

Loading…
Cancel
Save