Merge branch 'ibrahim-merge' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into development

 Conflicts:
	lib/client/base_app_client.dart
	lib/config/config.dart
	lib/screens/auth/login_screen.dart
	lib/screens/medicine/medicine_search_screen.dart
	lib/widgets/auth/verfiy_account.dart
merge-requests/113/head
Mohammad ALjammal 6 years ago
commit c7f1c6d174

@ -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);

@ -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<Map> login(UserModel userInfo) async {
const url = LOGIN_URL;
class AuthProvider with ChangeNotifier {
Future<dynamic> 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,57 +34,75 @@ 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<Map> insertDeviceImei(imei) async {
const url = INSERT_DEVICE_IMEI;
Future<dynamic> 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<Map> selectDeviceImei(imei) async {
const url = SELECT_DEVICE_IMEI;
Future<dynamic> 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<Map> 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<Map> memberCheckActivationCodeNew(activationCodeModel) async {
const url = MEMBER_CHECK_ACTIVATION_CODE_NEW;
Future<dynamic> 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;
@ -94,12 +116,16 @@ class AuthProvider with ChangeNotifier {
*@return:Future<Map>
*@desc: getDocProfiles
*/
Future<Map> getDocProfiles(docInfo) async {
const url = GET_DOC_PROFILES;
Future<dynamic> 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;

@ -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<Map> 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) {
dynamic localRes ;
await BaseAppClient.post(url,
onSuccess: ( response, statusCode) async {
localRes= response;
},
onFailure: (String error, int statusCode) {
throw error;
// print('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/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;
@ -65,26 +63,21 @@ class PatientsProvider with ChangeNotifier {
STPReferralFrequencyRequest();
ClinicByProjectIdRequest _clinicByProjectIdRequest =
ClinicByProjectIdRequest();
ReferToDoctorRequest _referToDoctorRequest ;
Client client =
HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]);
ReferToDoctorRequest _referToDoctorRequest = ReferToDoctorRequest();
PatiantInformtion _selectedPatient;
Future<Map> getPatientList(PatientModel patient, patientType) async {
/* const url =
BASE_URL+'DoctorApplication.svc/REST/GetMyInPatient';*/
Future<dynamic> 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 {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isLoading = false;
isError = false;
this.error = '';
}, onFailure: (String error, int statusCode) {
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 {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isLoading = false;
isError = false;
this.error = '';
}, onFailure: (String error, int statusCode) {
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 {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isLoading = false;
isError = false;
this.error = '';
}, onFailure: (String error, int statusCode) {
isLoading = false;
isError = true;
error = 'Please Check The Internet Connection';
}
this.error = error;
}, body: patient);
notifyListeners();
} catch (err) {
handelCatchErrorCase(err);
@ -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 {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isLoading = false;
isError = false;
this.error = '';
}, onFailure: (String error, int statusCode) {
isLoading = false;
isError = true;
error = 'Please Check The Internet Connection';
}
this.error = error;
}, body: patient);
notifyListeners();
} catch (err) {
handelCatchErrorCase(err);
@ -407,31 +348,17 @@ class PatientsProvider with ChangeNotifier {
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;
await BaseAppClient.post(PATIENT_INSURANCE_APPROVALS_URL,
onSuccess: (dynamic response, int statusCode) {
insuranceApporvalsList = response['List_ApprovalMain_InPatient'];
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 {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isError = false;
this.error = '';
}, onFailure: (String error, int statusCode) {
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;
await BaseAppClient.post(PATIENT_PROGRESS_NOTE_URL,
onSuccess: (dynamic response, int statusCode) {
patientProgressNoteList = response['List_GetPregressNoteForInPatient'];
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 {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isError = false;
this.error = '';
}, onFailure: (String error, int statusCode) {
isLoading = false;
isError = true;
error = 'Please Check The Internet Connection';
}
this.error = error;
}, body: patient);
notifyListeners();
} catch (err) {
handelCatchErrorCase(err);
@ -480,45 +394,23 @@ 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 {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
await BaseAppClient.post(PATIENT_GET_DOCTOR_BY_CLINIC_URL,
onSuccess: (dynamic response, int statusCode) {
doctorsList = response['List_Doctors_All'];
isLoading = false;
}
}
} else {
isError = false;
this.error = '';
}, onFailure: (String error, int statusCode) {
isLoading = false;
isError = true;
error = 'Please Check The Internet Connection';
}
this.error = error;
}, body: _doctorsByClinicIdRequest.toJson());
notifyListeners();
} catch (err) {
handelCatchErrorCase(err);
isLoading = false;
}
}
@ -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;
await BaseAppClient.post(PATIENT_GET_CLINIC_BY_PROJECT_URL,
onSuccess: (dynamic response, int statusCode) {
clinicsList = response['List_Clinic_All'];
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;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isError = false;
this.error = '';
}, onFailure: (String error, int statusCode) {
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;
await BaseAppClient.post(PATIENT_GET_LIST_REFERAL_URL,
onSuccess: (dynamic response, int statusCode) {
referalFrequancyList = response['list_STPReferralFrequency'];
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 {
isError = true;
error = res['ErrorMessage'] ?? res['ErrorEndUserMessage'];
}
}
} else {
isError = false;
this.error = '';
}, onFailure: (String error, int statusCode) {
isLoading = false;
isError = true;
error = 'Please Check The Internet Connection';
}
this.error = error;
}, body: _referralFrequencyRequest.toJson());
notifyListeners();
} catch (err) {
handelCatchErrorCase(err);

@ -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';
@ -159,9 +160,9 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
} else {
setState(() {
isError = true;
error = 'No patient';
isLoading = false;
});
DrAppToastMsg.showErrorToast('No patient');
}
break;
case "1":
@ -176,20 +177,27 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
});
} else {
setState(() {
error = 'No patient';
isError = true;
isLoading = false;
});
DrAppToastMsg.showErrorToast('No patient');
break;
}
}
} else {
setState(() {
error = response['ErrorEndUserMessage'] ?? response['ErrorMessage'] ;
isLoading = false;
isError = true;
});
DrAppToastMsg.showErrorToast(response['ErrorEndUserMessage'] ?? response['ErrorMessage']);
}
}).catchError((error){
setState(() {
isLoading = false;
});
helpers.showErrorToast(error);
//DrAppToastMsg.showErrorToast(error);
});
}
// }

@ -56,7 +56,7 @@ class _LoginsreenState extends State<Loginsreen> {
@override
Widget build(BuildContext context) {
AppGlobal.CONTEX = context;
getSharedPref();
return AppScaffold(
isLoading: _isLoading,

@ -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;

@ -63,10 +63,11 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
),
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: <Widget>[
@ -86,15 +87,18 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
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,12 +108,12 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
style: TextStyle(
color: Theme.of(context).errorColor),
),
):ListView.builder(
)
: 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"],
@ -119,7 +123,8 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
builder: (context) =>
ChangeNotifierProvider(
create: (_) => MedicineProvider(),
child: PharmaciesListScreen(
itemID: data[index]["ItemID"], url: data[index]["ProductImageBase64"]),

@ -132,10 +132,6 @@ class _RadiologyScreenState extends State<RadiologyScreen> {
url: patientsProv
.patientRadiologyList[index]
.doctorImageURL,
name: patientsProv
.patientLabResultOrdersList[
index]
.doctorName,
),
Expanded(
child: Padding(

@ -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);
}
}

@ -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,6 +164,7 @@ class Helpers {
),
);
}
/*
*@author: Amjad Amireh
*@Date:5/5/2020
@ -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
@ -307,7 +310,8 @@ static String checkDate(String dateString) {
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);
}
}

@ -69,6 +69,17 @@ class _LoginFormState extends State<LoginForm> {
_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<LoginForm> {
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<LoginForm> {
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<LoginForm> {
}),
buildSizedBox(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
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);
@ -214,7 +212,16 @@ class _LoginFormState extends State<LoginForm> {
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<LoginForm> {
}
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<LoginForm> {
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<LoginForm> {
}).catchError((err) {
print('$err');
changeLoadingStata(false);
helpers.showErrorToast();
helpers.showErrorToast(err);
});
} else {
changeLoadingStata(false);

@ -266,7 +266,16 @@ class _VerifyAccountState extends State<VerifyAccount> {
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),
),
);
}
/*
@ -384,7 +393,7 @@ class _VerifyAccountState extends State<VerifyAccount> {
Map<String, dynamic> profile, Function changeLoadingStata) {
changeLoadingStata(false);
sharedPref.setObj(DOCTOR_PROFILE, profile);
Navigator.of(context).pushNamed(HOME);
Navigator.of(context).pushReplacementNamed(HOME);
}
Future<dynamic> _asyncSimpleDialog(

@ -251,11 +251,12 @@ class _VerificationMethodsState extends State<VerificationMethods> {
*@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<String,dynamic> model = {
"LogInTokenID": _loggedUser['LogInTokenID'],
"Channel": 9,
"MobileNumber": _loggedUser['MobileNumber'],
@ -270,7 +271,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
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']);

@ -42,7 +42,13 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
InkWell(
onTap: () {
setState(() {
_showDetails = !_showDetails;
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
AppText(
@ -50,17 +56,13 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
fontSize: 2.5 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
),
InkWell(
onTap: () {
setState(() {
_showDetails = !_showDetails;
});
},
child: Icon(_showDetails
Icon(_showDetails
? Icons.keyboard_arrow_up
: Icons.keyboard_arrow_down)),
: Icons.keyboard_arrow_down),
],
),
),
!_showDetails
? Container()
: AnimatedContainer(
@ -87,6 +89,7 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
),
SizedBox(height: 5,),
AppText(
'${widget.myReferralPatientModel.referringDoctor}',
fontSize:
@ -108,6 +111,7 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
),
SizedBox(height: 5,),
AppText(
widget.myReferralPatientModel
.referringClinicDescription,
@ -135,6 +139,7 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
),
SizedBox(height: 5,),
AppText(
'${widget.myReferralPatientModel.referringClinicDescription}',
fontSize:
@ -157,6 +162,7 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
),
SizedBox(height: 5,),
AppText(
widget.myReferralPatientModel
.frequencyDescription,
@ -184,6 +190,7 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
),
SizedBox(height: 5,),
AppText(
'${widget.myReferralPatientModel.priorityDescription}',
fontSize:
@ -206,6 +213,7 @@ class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
1.7 * SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
),
SizedBox(height: 5,),
AppText(
Helpers.getDateFormatted(widget
.myReferralPatientModel

@ -54,6 +54,8 @@ class LargeAvatar extends StatelessWidget {
@override
Widget build(BuildContext context) {
var vlr = name;
var asd;
return InkWell(
onTap: disableProfileView
? null

@ -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(

@ -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;

Loading…
Cancel
Save