diff --git a/.gitignore b/.gitignore index 6b5418ff..ebdaebb7 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,5 @@ lib/generated_plugin_registrant.dart .vscode/settings.json .vscode/settings.json .vscode/settings.json +.vscode/settings.json +.vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json index 501a6f1f..e592e48b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "commentBox.styles": { "defaultStyle": { - "commentStartToken": "/* \n *@author: ibrahim albitar \n *@Date:27/4/2020 \n *@param: \n *@return:\n *@desc: ", + "commentStartToken": "/* \n *@author: Amjad Amireh \n *@Date:27/4/2020 \n *@param: \n *@return:\n *@desc: ", "commentEndToken": "\n */", "leftEdgeToken": " * ", "rightEdgeToken": "", diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart new file mode 100644 index 00000000..10164c4b --- /dev/null +++ b/lib/client/base_app_client.dart @@ -0,0 +1,67 @@ +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/interceptor/http_interceptor.dart'; +import 'package:doctor_app_flutter/models/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:http/http.dart'; + +/* + *@author: Mohammad Aljammal + *@Date:28/5/2020 + *@param: url, onSuccess callBack, onFailure callBack + *@return: + *@desc: convert DateTime to data formatted + */ +class BaseAppClient { + static Client client = HttpInterceptor().getClient(); + + static post( + String endPoint, { + Map body, + Function(dynamic response, int statusCode) onSuccess, + Function(String error, int statusCode) onFailure, + }) async { + String url = BASE_URL + endPoint; + try { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + String token = await sharedPref.getString(TOKEN); + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + body['DoctorID'] = doctorProfile.doctorID; + body['EditedBy'] = doctorProfile.doctorID; + body['ProjectID'] = doctorProfile.projectID; + body['ClinicID'] = doctorProfile.clinicID; + body['TokenID'] = token; + body['LanguageID'] = LANGUAGE_ID; + body['stamp'] = STAMP; + body['IPAdress'] = IP_ADDRESS; + body['VersionID'] = VERSION_ID; + body['Channel'] = CHANNEL; + body['SessionID'] = SESSION_ID; + body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; + body['PatientOutSA'] = PATIENT_OUT_SA; + + if (await Helpers.checkConnection()) { + final response = await client.post(url, body: json.encode(body)); + final int statusCode = response.statusCode; + if (statusCode < 200 || statusCode >= 400 || json == null) { + onFailure('Error While Fetching data', statusCode); + } else { + var parsed = json.decode(response.body.toString()); + if (parsed['MessageStatus'] == 1) { + onSuccess(parsed, statusCode); + } else { + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], + statusCode); + } + } + } else { + onFailure('Please Check The Internet Connection', -1); + } + } catch (e) { + print(e); + onFailure(e.toString(), -1); + } + } +} diff --git a/lib/config/config.dart b/lib/config/config.dart index 6b269bad..f1a58489 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -58,6 +58,6 @@ const STAMP = '2020-04-27T12:17:17.721Z'; const IP_ADDRESS = '11.11.11.11'; const VERSION_ID = 1.2; const CHANNEL = 9; -const SESSION_ID = '2Z7FX4Lokp'; +const SESSION_ID = 'BlUSkYymTt'; const IS_LOGIN_FOR_DOCTOR_APP = true; const PATIENT_OUT_SA = false; diff --git a/lib/main.dart b/lib/main.dart index 869d0b88..98331b4a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -43,10 +43,12 @@ class MyApp extends StatelessWidget { const Locale('en', ''), // English ], theme: ThemeData( - primarySwatch: Colors.blue, + primarySwatch: Colors.grey, primaryColor: Hexcolor('#B8382C'), buttonColor: Hexcolor('#B8382C'), fontFamily: 'WorkSans', + dividerColor: Colors.grey[200], + backgroundColor: Color.fromRGBO(255,255,255, 1) ), initialRoute: INIT_ROUTE, routes: routes, diff --git a/lib/models/list_doctor_working_hours_table_model.dart b/lib/models/list_doctor_working_hours_table_model.dart index d8ca8a04..cb103c8a 100644 --- a/lib/models/list_doctor_working_hours_table_model.dart +++ b/lib/models/list_doctor_working_hours_table_model.dart @@ -1,12 +1,14 @@ +import 'package:doctor_app_flutter/util/helpers.dart'; + class ListDoctorWorkingHoursTable { - String date; + DateTime date; String dayName; String workingHours; ListDoctorWorkingHoursTable({this.date, this.dayName, this.workingHours}); ListDoctorWorkingHoursTable.fromJson(Map json) { - date = json['Date'] ; + date = Helpers.convertStringToDate(json['Date']) ; dayName = json['DayName']; workingHours = json['WorkingHours']; } @@ -19,3 +21,10 @@ class ListDoctorWorkingHoursTable { return data; } } + +class WorkingHours { + String from; + String to; + WorkingHours({this.from,this.to}); + +} diff --git a/lib/models/list_gt_my_pationents_question_model.dart b/lib/models/list_gt_my_pationents_question_model.dart index 8e7eac9c..b743ade6 100644 --- a/lib/models/list_gt_my_pationents_question_model.dart +++ b/lib/models/list_gt_my_pationents_question_model.dart @@ -1,3 +1,5 @@ +import 'package:doctor_app_flutter/util/helpers.dart'; + class ListGtMyPatientsQuestions { String setupID; int projectID; @@ -6,7 +8,7 @@ class ListGtMyPatientsQuestions { int patientID; int doctorID; int requestType; - String requestDate; + DateTime requestDate; String requestTime; String remarks; int status; @@ -58,7 +60,7 @@ class ListGtMyPatientsQuestions { patientID = json['PatientID']; doctorID = json['DoctorID']; requestType = json['RequestType']; - requestDate = json['RequestDate']; + requestDate = Helpers.convertStringToDate(json['RequestDate']) ; requestTime = json['RequestTime']; remarks = json['Remarks']; status = json['Status']; diff --git a/lib/models/my_referral_patient_model.dart b/lib/models/my_referral_patient_model.dart new file mode 100644 index 00000000..e18dd546 --- /dev/null +++ b/lib/models/my_referral_patient_model.dart @@ -0,0 +1,210 @@ +import 'package:doctor_app_flutter/util/helpers.dart'; + +class MyReferralPatientModel { + int projectID; + int lineItemNo; + int doctorID; + int patientID; + String doctorName; + String doctorNameN; + String firstName; + String middleName; + String lastName; + String firstNameN; + String middleNameN; + String lastNameN; + int gender; + String dateofBirth; + String mobileNumber; + String emailAddress; + String patientIdentificationNo; + int patientType; + String admissionNo; + String admissionDate; + String roomID; + String bedID; + String nursingStationID; + String description; + String nationalityName; + String nationalityNameN; + String clinicDescription; + String clinicDescriptionN; + int referralDoctor; + int referringDoctor; + int referralClinic; + int referringClinic; + int referralStatus; + String referralDate; + String referringDoctorRemarks; + String referredDoctorRemarks; + String referralResponseOn; + int priority; + int frequency; + DateTime mAXResponseTime; + String age; + String frequencyDescription; + String genderDescription; + bool isDoctorLate; + bool isDoctorResponse; + String nursingStationName; + String priorityDescription; + String referringClinicDescription; + String referringDoctorName; + + MyReferralPatientModel( + {this.projectID, + this.lineItemNo, + this.doctorID, + this.patientID, + this.doctorName, + this.doctorNameN, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.gender, + this.dateofBirth, + this.mobileNumber, + this.emailAddress, + this.patientIdentificationNo, + this.patientType, + this.admissionNo, + this.admissionDate, + this.roomID, + this.bedID, + this.nursingStationID, + this.description, + this.nationalityName, + this.nationalityNameN, + this.clinicDescription, + this.clinicDescriptionN, + this.referralDoctor, + this.referringDoctor, + this.referralClinic, + this.referringClinic, + this.referralStatus, + this.referralDate, + this.referringDoctorRemarks, + this.referredDoctorRemarks, + this.referralResponseOn, + this.priority, + this.frequency, + this.mAXResponseTime, + this.age, + this.frequencyDescription, + this.genderDescription, + this.isDoctorLate, + this.isDoctorResponse, + this.nursingStationName, + this.priorityDescription, + this.referringClinicDescription, + this.referringDoctorName}); + + MyReferralPatientModel.fromJson(Map json) { + projectID = json['ProjectID']; + lineItemNo = json['LineItemNo']; + doctorID = json['DoctorID']; + patientID = json['PatientID']; + doctorName = json['DoctorName']; + doctorNameN = json['DoctorNameN']; + firstName = json['FirstName']; + middleName = json['MiddleName']; + lastName = json['LastName']; + firstNameN = json['FirstNameN']; + middleNameN = json['MiddleNameN']; + lastNameN = json['LastNameN']; + gender = json['Gender']; + dateofBirth = json['DateofBirth']; + mobileNumber = json['MobileNumber']; + emailAddress = json['EmailAddress']; + patientIdentificationNo = json['PatientIdentificationNo']; + patientType = json['PatientType']; + admissionNo = json['AdmissionNo']; + admissionDate = json['AdmissionDate']; + roomID = json['RoomID']; + bedID = json['BedID']; + nursingStationID = json['NursingStationID']; + description = json['Description']; + nationalityName = json['NationalityName']; + nationalityNameN = json['NationalityNameN']; + clinicDescription = json['ClinicDescription']; + clinicDescriptionN = json['ClinicDescriptionN']; + referralDoctor = json['ReferralDoctor']; + referringDoctor = json['ReferringDoctor']; + referralClinic = json['ReferralClinic']; + referringClinic = json['ReferringClinic']; + referralStatus = json['ReferralStatus']; + referralDate = json['ReferralDate']; + referringDoctorRemarks = json['ReferringDoctorRemarks']; + referredDoctorRemarks = json['ReferredDoctorRemarks']; + referralResponseOn = json['ReferralResponseOn']; + priority = json['Priority']; + frequency = json['Frequency']; + mAXResponseTime = Helpers.convertStringToDate(json['MAXResponseTime']); + age = json['Age']; + frequencyDescription = json['FrequencyDescription']; + genderDescription = json['GenderDescription']; + isDoctorLate = json['IsDoctorLate']; + isDoctorResponse = json['IsDoctorResponse']; + nursingStationName = json['NursingStationName']; + priorityDescription = json['PriorityDescription']; + referringClinicDescription = json['ReferringClinicDescription']; + referringDoctorName = json['ReferringDoctorName']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['LineItemNo'] = this.lineItemNo; + data['DoctorID'] = this.doctorID; + data['PatientID'] = this.patientID; + data['DoctorName'] = this.doctorName; + data['DoctorNameN'] = this.doctorNameN; + data['FirstName'] = this.firstName; + data['MiddleName'] = this.middleName; + data['LastName'] = this.lastName; + data['FirstNameN'] = this.firstNameN; + data['MiddleNameN'] = this.middleNameN; + data['LastNameN'] = this.lastNameN; + data['Gender'] = this.gender; + data['DateofBirth'] = this.dateofBirth; + data['MobileNumber'] = this.mobileNumber; + data['EmailAddress'] = this.emailAddress; + data['PatientIdentificationNo'] = this.patientIdentificationNo; + data['PatientType'] = this.patientType; + data['AdmissionNo'] = this.admissionNo; + data['AdmissionDate'] = this.admissionDate; + data['RoomID'] = this.roomID; + data['BedID'] = this.bedID; + data['NursingStationID'] = this.nursingStationID; + data['Description'] = this.description; + data['NationalityName'] = this.nationalityName; + data['NationalityNameN'] = this.nationalityNameN; + data['ClinicDescription'] = this.clinicDescription; + data['ClinicDescriptionN'] = this.clinicDescriptionN; + data['ReferralDoctor'] = this.referralDoctor; + data['ReferringDoctor'] = this.referringDoctor; + data['ReferralClinic'] = this.referralClinic; + data['ReferringClinic'] = this.referringClinic; + data['ReferralStatus'] = this.referralStatus; + data['ReferralDate'] = this.referralDate; + data['ReferringDoctorRemarks'] = this.referringDoctorRemarks; + data['ReferredDoctorRemarks'] = this.referredDoctorRemarks; + data['ReferralResponseOn'] = this.referralResponseOn; + data['Priority'] = this.priority; + data['Frequency'] = this.frequency; + data['MAXResponseTime'] = this.mAXResponseTime; + data['Age'] = this.age; + data['FrequencyDescription'] = this.frequencyDescription; + data['GenderDescription'] = this.genderDescription; + data['IsDoctorLate'] = this.isDoctorLate; + data['IsDoctorResponse'] = this.isDoctorResponse; + data['NursingStationName'] = this.nursingStationName; + data['PriorityDescription'] = this.priorityDescription; + data['ReferringClinicDescription'] = this.referringClinicDescription; + data['ReferringDoctorName'] = this.referringDoctorName; + return data; + } +} diff --git a/lib/models/request_add_referred_doctor_remarks.dart b/lib/models/request_add_referred_doctor_remarks.dart new file mode 100644 index 00000000..0799c7ba --- /dev/null +++ b/lib/models/request_add_referred_doctor_remarks.dart @@ -0,0 +1,78 @@ +import 'package:doctor_app_flutter/config/config.dart'; + +class RequestAddReferredDoctorRemarks { + int projectID; + String admissionNo; + int lineItemNo; + String referredDoctorRemarks; + int editedBy; + int patientID; + int referringDoctor; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + + RequestAddReferredDoctorRemarks( + {this.projectID, + this.admissionNo, + this.lineItemNo, + this.referredDoctorRemarks, + this.editedBy, + this.patientID, + this.referringDoctor, + this.languageID = LANGUAGE_ID, + this.stamp = STAMP, + this.iPAdress = IP_ADDRESS, + this.versionID = VERSION_ID, + this.channel= CHANNEL, + this.tokenID, + this.sessionID = SESSION_ID, + this.isLoginForDoctorApp = IS_LOGIN_FOR_DOCTOR_APP, + this.patientOutSA = PATIENT_OUT_SA}); + + RequestAddReferredDoctorRemarks.fromJson(Map json) { + projectID = json['ProjectID']; + admissionNo = json['AdmissionNo']; + lineItemNo = json['LineItemNo']; + referredDoctorRemarks = json['ReferredDoctorRemarks']; + editedBy = json['EditedBy']; + patientID = json['PatientID']; + referringDoctor = json['ReferringDoctor']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['AdmissionNo'] = this.admissionNo; + data['LineItemNo'] = this.lineItemNo; + data['ReferredDoctorRemarks'] = this.referredDoctorRemarks; + data['EditedBy'] = this.editedBy; + data['PatientID'] = this.patientID; + data['ReferringDoctor'] = this.referringDoctor; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + return data; + } +} diff --git a/lib/models/request_doctor_reply.dart b/lib/models/request_doctor_reply.dart index e93850a2..707336d6 100644 --- a/lib/models/request_doctor_reply.dart +++ b/lib/models/request_doctor_reply.dart @@ -15,18 +15,18 @@ class RequestDoctorReply { bool patientOutSA; RequestDoctorReply( - {this.projectID , - this.doctorID , - this.transactionNo = TRANSACTION_NO, - this.languageID = LANGUAGE_ID, - this.stamp = STAMP, - this.iPAdress = IP_ADDRESS, - this.versionID = VERSION_ID, - this.channel = CHANNEL, - this.tokenID , - this.sessionID = SESSION_ID, - this.isLoginForDoctorApp = IS_LOGIN_FOR_DOCTOR_APP, - this.patientOutSA = PATIENT_OUT_SA}); + {this.projectID , + this.doctorID , + this.transactionNo = TRANSACTION_NO , + this.languageID , + this.stamp , + this.iPAdress, + this.versionID , + this.channel, + this.tokenID , + this.sessionID, + this.isLoginForDoctorApp , + this.patientOutSA }); RequestDoctorReply.fromJson(Map json) { projectID = json['ProjectID']; diff --git a/lib/models/request_my_referral_patient_model.dart b/lib/models/request_my_referral_patient_model.dart new file mode 100644 index 00000000..adaf9e5c --- /dev/null +++ b/lib/models/request_my_referral_patient_model.dart @@ -0,0 +1,94 @@ +import 'package:doctor_app_flutter/config/config.dart'; + +class RequestMyReferralPatientModel { + int projectID; + int clinicID; + int doctorID; + String firstName; + String middleName; + String lastName; + String patientMobileNumber; + String patientIdentificationID; + int patientID; + String from; + String to; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + bool patientOutSA; + + RequestMyReferralPatientModel( + {this.projectID, + this.clinicID, + this.doctorID, + this.firstName = "0", + this.middleName = "0", + this.lastName = "0", + this.patientMobileNumber = "0", + this.patientIdentificationID = "0", + this.patientID = 0, + this.from = "0", + this.to = "0", + this.languageID , + this.stamp , + this.iPAdress , + this.versionID , + this.channel , + this.tokenID, + this.sessionID , + this.isLoginForDoctorApp , + this.patientOutSA }); + + RequestMyReferralPatientModel.fromJson(Map json) { + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + firstName = json['FirstName']; + middleName = json['MiddleName']; + lastName = json['LastName']; + patientMobileNumber = json['PatientMobileNumber']; + patientIdentificationID = json['PatientIdentificationID']; + patientID = json['PatientID']; + from = json['From']; + to = json['To']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + patientOutSA = json['PatientOutSA']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['FirstName'] = this.firstName; + data['MiddleName'] = this.middleName; + data['LastName'] = this.lastName; + data['PatientMobileNumber'] = this.patientMobileNumber; + data['PatientIdentificationID'] = this.patientIdentificationID; + data['PatientID'] = this.patientID; + data['From'] = this.from; + data['To'] = this.to; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + data['PatientOutSA'] = this.patientOutSA; + return data; + } +} diff --git a/lib/models/request_schedule.dart b/lib/models/request_schedule.dart index d704e9bb..949f07eb 100644 --- a/lib/models/request_schedule.dart +++ b/lib/models/request_schedule.dart @@ -16,21 +16,21 @@ class RequestSchedule { bool patientOutSA; int patientTypeID; - RequestSchedule({ - this.projectID, - this.clinicID, - this.doctorID, - this.doctorWorkingHoursDays = 7, - this.languageID = LANGUAGE_ID, - this.stamp = STAMP, - this.iPAdress = IP_ADDRESS, - this.versionID = VERSION_ID, - this.channel = CHANNEL, - this.tokenID, - this.sessionID = SESSION_ID, - this.isLoginForDoctorApp = IS_LOGIN_FOR_DOCTOR_APP, - this.patientOutSA = PATIENT_OUT_SA, - this.patientTypeID = 1}); + RequestSchedule( + {this.projectID, + this.clinicID, + this.doctorID, + this.doctorWorkingHoursDays = 7, + this.languageID, + this.stamp, + this.iPAdress, + this.versionID, + this.channel, + this.tokenID, + this.sessionID, + this.isLoginForDoctorApp, + this.patientOutSA, + this.patientTypeID = 1}); RequestSchedule.fromJson(Map json) { projectID = json['ProjectID']; diff --git a/lib/providers/doctor_reply_provider.dart b/lib/providers/doctor_reply_provider.dart index d28d12cd..c7e48afa 100644 --- a/lib/providers/doctor_reply_provider.dart +++ b/lib/providers/doctor_reply_provider.dart @@ -1,22 +1,12 @@ -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/client/base_app_client.dart'; import 'package:doctor_app_flutter/models/request_doctor_reply.dart'; import 'package:doctor_app_flutter/models/list_gt_my_pationents_question_model.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/cupertino.dart'; -import 'package:http/http.dart'; -import 'package:http_interceptor/http_client_with_interceptor.dart'; -import '../interceptor/http_interceptor.dart'; class DoctorReplyProvider with ChangeNotifier { - Client client = - HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); - List listDoctorWorkingHoursTable = []; + bool isLoading = true; bool isError = false; String error = ''; @@ -27,41 +17,22 @@ class DoctorReplyProvider with ChangeNotifier { } getDoctorReply() async { - const url = BASE_URL + 'DoctorApplication.svc/REST/GtMyPatientsQuestions'; - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - String token = await sharedPref.getString(TOKEN); - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - _requestDoctorReply.doctorID = doctorProfile.doctorID; - _requestDoctorReply.projectID = doctorProfile.projectID; - _requestDoctorReply.tokenID = token; try { - if (await Helpers.checkConnection()) { - final response = await client.post(url, - body: json.encode(_requestDoctorReply.toJson())); - final int statusCode = response.statusCode; - if (statusCode < 200 || statusCode >= 400 || json == null) { - isLoading = false; - isError = true; - error = 'Error While Fetching data'; - } else { - var parsed = json.decode(response.body.toString()); - if (parsed['MessageStatus'] == 1) { - parsed['List_GtMyPatientsQuestions'].forEach((v) { - listDoctorWorkingHoursTable.add( ListGtMyPatientsQuestions.fromJson(v)); - }); + await BaseAppClient.post('DoctorApplication.svc/REST/GtMyPatientsQuestions', + body: _requestDoctorReply.toJson(), + onSuccess: (dynamic response, int statusCode) { + response['List_GtMyPatientsQuestions'].forEach((v) { + listDoctorWorkingHoursTable.add(ListGtMyPatientsQuestions.fromJson(v)); isError = false; isLoading = false; - } else { - isError = true; - isLoading = false; - error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'] ; - } - } - } else { - isLoading = false; - isError = true; - error = 'Please Check The Internet Connection'; - } + }); + }, + onFailure: (String error, int statusCode) { + isError = true; + isLoading = false; + this.error= error; + }); + notifyListeners(); } catch (error) { throw error; diff --git a/lib/providers/referral_patient_provider.dart b/lib/providers/referral_patient_provider.dart new file mode 100644 index 00000000..782bced7 --- /dev/null +++ b/lib/providers/referral_patient_provider.dart @@ -0,0 +1,74 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/models/my_referral_patient_model.dart'; +import 'package:doctor_app_flutter/models/request_add_referred_doctor_remarks.dart'; +import 'package:doctor_app_flutter/models/request_my_referral_patient_model.dart'; +import 'package:flutter/cupertino.dart'; + + +class MyReferralPatientProvider with ChangeNotifier { + List listMyReferralPatientModel = []; + + bool isLoading = true; + bool isError = false; + String error = ''; + + RequestMyReferralPatientModel _requestMyReferralPatient = RequestMyReferralPatientModel(); + RequestAddReferredDoctorRemarks _requestAddReferredDoctorRemarks = RequestAddReferredDoctorRemarks(); + + MyReferralPatientProvider() { + getMyReferralPatient(); + } + + getMyReferralPatient() async { + try { + await BaseAppClient.post( + 'DoctorApplication.svc/REST/GtMyReferralPatient', + body: _requestMyReferralPatient.toJson(), + onSuccess: (dynamic response, int statusCode) { + response['List_MyReferralPatient'].forEach((v) { + listMyReferralPatientModel.add(MyReferralPatientModel.fromJson(v)); + }); + isError = false; + isLoading = false; + }, + onFailure: (String error, int statusCode) { + isError = true; + isLoading = false; + this.error = error; + }, + ); + notifyListeners(); + } catch (error) { + isLoading = false; + isError = true; + this.error = 'Something wrong happened, please contact the admin'; + notifyListeners(); + } + } + + Future replay( + String referredDoctorRemarks, MyReferralPatientModel model) async { + try { + _requestAddReferredDoctorRemarks.admissionNo = model.admissionNo; + _requestAddReferredDoctorRemarks.patientID = model.patientID; + _requestAddReferredDoctorRemarks.referredDoctorRemarks = referredDoctorRemarks; + _requestAddReferredDoctorRemarks.lineItemNo = model.lineItemNo; + _requestAddReferredDoctorRemarks.referringDoctor = model.referringDoctor; + await BaseAppClient.post( + 'DoctorApplication.svc/REST/AddReferredDoctorRemarks', + body: _requestAddReferredDoctorRemarks.toJson(), + onSuccess: (dynamic body, int statusCode) { + model.referredDoctorRemarks = referredDoctorRemarks; + listMyReferralPatientModel[ + listMyReferralPatientModel.indexOf(model)] = model; + notifyListeners(); + }, + onFailure: (String error, int statusCode) { + throw (error); + }, + ); + } catch (error) { + throw error; + } + } +} diff --git a/lib/providers/schedule_provider.dart b/lib/providers/schedule_provider.dart index 65945f52..057219a1 100644 --- a/lib/providers/schedule_provider.dart +++ b/lib/providers/schedule_provider.dart @@ -1,21 +1,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/util/helpers.dart'; +import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:flutter/cupertino.dart'; -import 'package:http/http.dart'; -import 'package:http_interceptor/http_client_with_interceptor.dart'; - -import '../interceptor/http_interceptor.dart'; import '../models/list_doctor_working_hours_table_model.dart'; import '../models/request_schedule.dart'; class ScheduleProvider with ChangeNotifier { - - Client client = HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); - List listDoctorWorkingHoursTable = []; bool isLoading = true; bool isError = false; @@ -27,41 +15,26 @@ class ScheduleProvider with ChangeNotifier { } getDoctorSchedule() async { - const url = BASE_URL + 'Doctors.svc/REST/GetDoctorWorkingHoursTable'; - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - String token = await sharedPref.getString(TOKEN); - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - requestSchedule.doctorID = doctorProfile.doctorID; - requestSchedule.projectID = doctorProfile.projectID; - requestSchedule.clinicID = doctorProfile.clinicID; - requestSchedule.tokenID = token; try { - - if (await Helpers.checkConnection()) { - final response = await client.post(url, body: json.encode(requestSchedule.toJson())); - final int statusCode = response.statusCode; - if (statusCode < 200 || statusCode >= 400 || json == null) { - isLoading = false; - isError = true; - error = 'Error While Fetching data'; - } else { - var parsed = json.decode(response.body.toString()); - parsed['List_DoctorWorkingHoursTable'].forEach((v) { - listDoctorWorkingHoursTable - .add(new ListDoctorWorkingHoursTable.fromJson(v)); - }); - isError = false; - isLoading = false; - } - } else { + await BaseAppClient.post('Doctors.svc/REST/GetDoctorWorkingHoursTable', + body: requestSchedule.toJson(), + onSuccess: (dynamic response, int statusCode) { + response['List_DoctorWorkingHoursTable'].forEach((v) { + listDoctorWorkingHoursTable.add(new ListDoctorWorkingHoursTable.fromJson(v)); + }); + isError = false; + isLoading = false; + }, onFailure: (String error, int statusCode) { isLoading = false; isError = true; - error = 'Please Check The Internet Connection'; - } - + this.error = error; + }); + notifyListeners(); + } catch (e) { + isLoading = false; + isError = true; + error = 'Something wrong happened, please contact the admin'; notifyListeners(); - } catch (error) { - throw error; } } } diff --git a/lib/routes.dart b/lib/routes.dart index c53868c9..9c87ff2f 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,3 +1,4 @@ + import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/screens/patients/profile/insurance_approvals_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/patient_orders_screen.dart'; @@ -18,6 +19,7 @@ import './screens/doctor/services_screen.dart'; import './screens/medicine/medicine_search_screen.dart'; import './screens/medicine/pharmacies_list_screen.dart'; import './screens/patients/patient_search_screen.dart'; +import './screens/patients/patients_referred_screen.dart'; import './screens/patients/patients_screen.dart'; import './screens/patients/profile/lab_result/lab_orders_screen.dart'; import './screens/patients/profile/patient_profile_screen.dart'; @@ -41,6 +43,7 @@ const String QR_READER = 'qr-reader'; const String PATIENT_SEARCH = 'patients/patient-search'; const String PATIENTS = 'patients/patients'; const String PATIENTS_PROFILE = 'patients/patients-profile'; +const String PATIENTS_REFERRED = 'patients/patients-referred'; const String BLOOD_BANK = 'blood-bank'; const String DOCTOR_REPLY = 'doctor-reply'; const String MEDICINE_SEARCH = 'medicine/medicine-search'; @@ -64,6 +67,7 @@ var routes = { PROFILE: (_) => ProfileScreen(), MY_SCHEDULE: (_) => MyScheduleScreen(), PATIENT_SEARCH: (_) => PatientSearchScreen(), + PATIENTS_REFERRED:(_)=>PatientReferredScreen(), PATIENTS: (_) => PatientsScreen(), QR_READER: (_) => QrReaderScreen(), BLOOD_BANK: (_) => BloodBankScreen(), diff --git a/lib/screens/QR_reader_screen.dart b/lib/screens/QR_reader_screen.dart index 4750b38e..bbbe327a 100644 --- a/lib/screens/QR_reader_screen.dart +++ b/lib/screens/QR_reader_screen.dart @@ -108,28 +108,6 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); ], ), ):Container(), - Column( - children: patientList.map((item) { - return InkWell( - onTap: (){ - Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { - "patient": item, - }); - }, - child: AnimatedContainer( - duration: Duration(milliseconds: 200), - child: CardWithBgWidget( - widget: Container( - child: AppText( - '${item.firstName} ${item.lastName}', - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - ), - ), - ), - ); - }).toList() - ), ], ), @@ -172,11 +150,12 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); case "0": if (response['List_MyOutPatient'] != null) { setState(() { - patientList = ModelResponse - .fromJson(response['List_MyOutPatient']) - .list; + patientList = ModelResponse.fromJson(response['List_MyOutPatient']).list; isLoading = false; }); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": patientList[0], + }); } else { setState(() { isError = true; @@ -192,6 +171,9 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); isLoading = false; error = ""; }); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": patientList[0], + }); } else { setState(() { error = 'No patient'; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 2146e547..d2a777f1 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/providers/doctor_reply_provider.dart'; import 'package:doctor_app_flutter/providers/medicine_provider.dart'; import 'package:doctor_app_flutter/providers/hospital_provider.dart'; +import 'package:doctor_app_flutter/providers/referral_patient_provider.dart'; import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -16,6 +17,7 @@ import '../widgets/dashboard/dashboard_item_icons_texts.dart'; import '../widgets/dashboard/dashboard_item_texts_widget.dart'; import '../widgets/shared/rounded_container_widget.dart'; import 'doctor/doctor_reply_screen.dart'; +import 'doctor/my_referral_patient_screen.dart'; class DashboardScreen extends StatefulWidget { DashboardScreen({Key key, this.title}) : super(key: key); @@ -271,12 +273,25 @@ class _DashboardScreenState extends State { ), Expanded( flex: 2, - child: new DashboardItemIconText( - DoctorApp.home_icon, - "", - "Discharge Patient", - showBorder: false, - backgroundColor: Colors.brown[400], + child: InkWell( + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChangeNotifierProvider( + create: (_) => MyReferralPatientProvider(), + child: MyReferralPatient(), + ), + ), + ); + }, + child: DashboardItemIconText( + DoctorApp.home_icon, + "", + "My Referral Patient", + showBorder: false, + backgroundColor: Colors.brown[400], + ), ), ), ], diff --git a/lib/screens/doctor/doctor_reply_screen.dart b/lib/screens/doctor/doctor_reply_screen.dart index 9f73feea..73585593 100644 --- a/lib/screens/doctor/doctor_reply_screen.dart +++ b/lib/screens/doctor/doctor_reply_screen.dart @@ -1,11 +1,16 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/providers/doctor_reply_provider.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/doctor/doctor_reply_widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.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/card_with_bgNew_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -40,81 +45,9 @@ class DoctorReplyScreen extends StatelessWidget { children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: _doctorReplyProvider.listDoctorWorkingHoursTable.map((reply) { - return CardWithBgWidget( - widget: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - reply.patientName, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - SizedBox( - height: 8, - ), - AppText( - reply.remarks, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - SizedBox( - height: 5, - ), - Row( - children: [ - AppText( - TranslationBase.of(context).time, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - Container( - margin: EdgeInsets.only(left: 10), - child: AppText( - reply.requestTime, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - ), - ], - ), - SizedBox( - height: 5, - ), - Row( - children: [ - AppText( - TranslationBase.of(context).fileNo, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - Container( - margin: EdgeInsets.only(left: 10), - child: AppText( - '${reply.patientID}', - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - ), - ], - ), - SizedBox( - height: 5, - ), - Row( - children: [ - AppText( - TranslationBase.of(context).mobileNo, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - Container( - margin: EdgeInsets.only(left: 10), - child: AppText( - reply.mobileNumber, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - ), - ], - ), - ], - ), - ), - ); + return DoctorReplyWidget( reply: reply); }).toList(), ) ], diff --git a/lib/screens/doctor/my_referral_patient_screen.dart b/lib/screens/doctor/my_referral_patient_screen.dart new file mode 100644 index 00000000..e2e10e82 --- /dev/null +++ b/lib/screens/doctor/my_referral_patient_screen.dart @@ -0,0 +1,65 @@ +import 'package:doctor_app_flutter/providers/referral_patient_provider.dart'; +import 'package:doctor_app_flutter/providers/schedule_provider.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/doctor/my_referral_patient_widget.dart'; +import 'package:doctor_app_flutter/widgets/doctor/my_schedule_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../../widgets/shared/app_scaffold_widget.dart'; + +class MyReferralPatient extends StatelessWidget { + MyReferralPatientProvider referralPatientProvider; + + @override + Widget build(BuildContext context) { + referralPatientProvider = Provider.of(context); + return AppScaffold( + showBottomBar: false, + showAppDrawer: false, + appBarTitle: TranslationBase.of(context).mySchedule, + body: referralPatientProvider.isLoading + ? DrAppCircularProgressIndeicator() + : referralPatientProvider.isError + ? Center( + child: AppText( + referralPatientProvider.error, + color: Theme.of(context).errorColor, + ), + ) + : referralPatientProvider.listMyReferralPatientModel.length == 0 + ? Center( + child: AppText( + TranslationBase.of(context).errorNoSchedule, + color: Theme.of(context).errorColor, + ), + ) + : Container( + padding: EdgeInsetsDirectional.fromSTEB(20, 0, 20, 0), + child: ListView( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + Container( + child: Column( + children: referralPatientProvider.listMyReferralPatientModel.map((item) { + return MyReferralPatientWidget( + myReferralPatientModel: item, + ); + }).toList(), + ), + ), + ], + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/doctor/my_schedule_screen.dart b/lib/screens/doctor/my_schedule_screen.dart index b9f60889..dd40dada 100644 --- a/lib/screens/doctor/my_schedule_screen.dart +++ b/lib/screens/doctor/my_schedule_screen.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/providers/schedule_provider.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/doctor/my_schedule_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:flutter/material.dart'; @@ -7,7 +8,6 @@ import 'package:provider/provider.dart'; import '../../config/size_config.dart'; import '../../widgets/shared/app_scaffold_widget.dart'; -import '../../widgets/shared/card_with_bg_widget.dart'; class MyScheduleScreen extends StatelessWidget { ScheduleProvider scheduleProvider; @@ -49,9 +49,7 @@ class MyScheduleScreen extends StatelessWidget { SizedBox( height: 20, ), - AppText(TranslationBase.of(context).mySchedule, - fontSize: - 2.5 * SizeConfig.textMultiplier), + scheduleListByDate(), // scheduleListByDate('Wednesday, 8 April '), ], @@ -74,40 +72,7 @@ class MyScheduleScreen extends StatelessWidget { Container( child: Column( children: scheduleProvider.listDoctorWorkingHoursTable.map((item) { - return CardWithBgWidget( - widget: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText(item.dayName, - fontSize: 2.5 * SizeConfig.textMultiplier), - SizedBox( - height: 8, - ), - !item.workingHours.contains('and') - ? AppText(item.workingHours, - fontSize: 2.5 * SizeConfig.textMultiplier) - : Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - item.workingHours.substring( - 0, item.workingHours.indexOf('a')), - fontSize: 2.5 * SizeConfig.textMultiplier), - AppText( - item.workingHours.substring( - item.workingHours.indexOf('d') + 2, - ), - fontSize: 2.5 * SizeConfig.textMultiplier), - ], - ), - SizedBox( - width: 8, - ) - ], - ), - ), - ); + return MyScheduleWidget(workingHoursTable: item,); }).toList(), ), ), @@ -115,8 +80,4 @@ class MyScheduleScreen extends StatelessWidget { ); } - TextStyle textStyle(size, [FontWeight weight]) { - return TextStyle( - fontSize: size * SizeConfig.textMultiplier, fontWeight: weight); - } } diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 6dd0478c..2c0963cd 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -58,7 +58,16 @@ class _PatientSearchScreenState extends State { PatientOutSA: false); void _validateInputs() async { +print("============== _selectedType============"+ _selectedType); + if(_selectedType!='3') + { try { + + //==================== + //_selectedType=='3'? + //===================== + + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); @@ -93,6 +102,15 @@ class _PatientSearchScreenState extends State { } catch (err) { handelCatchErrorCase(err); } + } + else + { + Navigator.of(context).pushNamed(PATIENTS_REFERRED, arguments: { + "patientSearchForm": _patientSearchFormValues, + "selectedType": _selectedType + }); + + } } handelCatchErrorCase(err) { diff --git a/lib/screens/patients/patients_referred_screen.dart b/lib/screens/patients/patients_referred_screen.dart new file mode 100644 index 00000000..70a84f03 --- /dev/null +++ b/lib/screens/patients/patients_referred_screen.dart @@ -0,0 +1,102 @@ +/* + *@author: Amjad Amireh Modified Referred Patients + *@Date:27/5/2020 + + + *@desc: + */ + +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable_item_widget.dart'; +import 'package:flutter/material.dart'; + +class PatientReferredScreen extends StatefulWidget { + PatientReferredScreen({Key key}) : super(key: key); + + @override + _PatientReferredScreenState createState() => _PatientReferredScreenState(); +} + +class _PatientReferredScreenState extends State { + + String patientType; + String patientTypetitle; + + List>list_product; + @override + void initState() { + super.initState(); + list_product=new List(); + for(var k=1;k<=5;k++) + { + Map map=Map(); + map.putIfAbsent(getName(k), ()=>getContent()); + list_product.add(map); + + } + list_product.map((s){ + + }).map((list)=>list).toList();} + + + + @override + Widget build(BuildContext context) { + + Listlist=List(); + + return AppScaffold( + appBarTitle: "My Referred Patients",//patientTypetitle, + body: Center( + + child: ListView( + children: [ + for(final map in list_product) + for(final keys in map.keys) + ExpandableItem(keys,map[keys].toList()) + , + ], + ) + ), + + ); + } + + + String getName(int month) + { + switch(month) + { + case 1: + return "Mahmoud Shrouf"; + case 2: + return "Mahmoud Shrouf"; + case 3: + return "Mahmoud Shrouf"; + case 4: + return "Mahmoud Shrouf"; + case 5: + return "Mahmoud Shrouf"; + case 6: + return "Mahmoud Shrouf"; + case 7: + return "Mahmoud Shrouf"; + case 8: + return "Mahmoud Shrouf"; + case 9: + return "Mahmoud Shrouf"; + case 10: + return "Mahmoud Shrouf"; + case 11: + return "Mahmoud Shrouf"; + case 12: + return "Mahmoud Shrouf"; + } + } + + List getContent() + { + + return ["1","2","3","4","5","6"].toList(); + } +} \ No newline at end of file diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 68f01fd8..d945e38d 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -374,8 +374,7 @@ class _PatientsScreenState extends State { .start, children: [ Image.network( - "https://p.kindpng.com/picc/s/404-4042774_profile-photo-circle-circle-profile-picture-png-transparent.png", - + "https://p.kindpng.com/picc/s/404-4042774_profile-photo-circle-circle-profile-picture-png-transparent.png", height: 100, width: 100), ], @@ -472,8 +471,9 @@ class _PatientsScreenState extends State { ), ), SizedBox( - width:60, - ), + width: + 60, + ), Container( child: AppText( diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart index a7155e01..d2cb5380 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart @@ -1,16 +1,70 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign_req_model.dart'; +import 'package:doctor_app_flutter/providers/patients_provider.dart'; import 'package:doctor_app_flutter/routes.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import '../../../../config/size_config.dart'; import '../../../../models/patient/vital_sign_res_model.dart'; import '../../../../widgets/patients/profile/profile_medical_info_widget.dart'; import '../../../../widgets/shared/app_scaffold_widget.dart'; -import '../../../../widgets/shared/rounded_container_widget.dart'; +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); -class VitalSignDetailsScreen extends StatelessWidget { +class VitalSignDetailsScreen extends StatefulWidget { // VitalSignDetailsScreen({Key key, this.vitalSing}) : super(key: key); + @override + _VitalSignDetailsScreenState createState() => _VitalSignDetailsScreenState(); +} + +class _VitalSignDetailsScreenState extends State { VitalSignResModel vitalSing; String url = "assets/images/"; + + PatientsProvider patientsProv; + var _isInit = true; + + /* + *@author: Elham Rababah + *@Date:28/4/2020 + *@param: context + *@return: + *@desc: getVitalSignList Function + */ + getVitalSignList(context) async { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + String token = await sharedPref.getString(TOKEN); + String type = await sharedPref.getString(SLECTED_PATIENT_TYPE); + int inOutpatientType = 1; + if (type == '0') { + inOutpatientType = 2; + } + print(type); + VitalSignReqModel vitalSignReqModel = VitalSignReqModel( + patientID: patient.patientId, + projectID: patient.projectId, + tokenID: token, + patientTypeID: patient.patientType, + inOutpatientType: inOutpatientType, + languageID: 2, + transNo: + patient.admissionNo != null ? int.parse(patient.admissionNo) : 0); + patientsProv.getPatientVitalSign(vitalSignReqModel.toJson()); + } + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + if (_isInit) { + patientsProv = Provider.of(context); + getVitalSignList(context); + } + _isInit = false; + } + final double contWidth = SizeConfig.realScreenWidth * 0.70; @override @@ -19,58 +73,54 @@ class VitalSignDetailsScreen extends StatelessWidget { vitalSing = routeArgs['vitalSing']; return AppScaffold( appBarTitle: "vital Sing ", - body: RoundedContainer( - height: SizeConfig.realScreenHeight * 0.7, - child: CustomScrollView( - primary: false, - slivers: [ - SliverPadding( - padding: const EdgeInsets.all(10), - sliver: SliverGrid.count( - childAspectRatio: 0.7, - crossAxisSpacing: 10, - mainAxisSpacing: 0, - crossAxisCount: 3, - children: [ - InkWell( - onTap: (){ - Navigator.of(context).pushNamed(BODY_MEASUREMENTS); - }, - child: CircleAvatarWidget( - des: 'Body Measurements', - url: url + 'heartbeat.png', - ), - ), - CircleAvatarWidget( - des: 'Temperature', - url: url + 'heartbeat.png', - ), - CircleAvatarWidget( - des: 'Pulse', - url: url + 'heartbeat.png', - ), - CircleAvatarWidget( - des: 'Respiration', - url: url + 'heartbeat.png', - ), - CircleAvatarWidget( - des: 'Blood Pressure', - url: url + 'heartbeat.png', - ), - CircleAvatarWidget( - des: 'Oxygenation', - url: url + 'heartbeat.png', - ), - CircleAvatarWidget( - des: 'Pain Scale', + body: CustomScrollView( + primary: false, + slivers: [ + SliverPadding( + padding: const EdgeInsets.all(10), + sliver: SliverGrid.count( + childAspectRatio: 0.7, + crossAxisSpacing: 10, + mainAxisSpacing: 0, + crossAxisCount: 3, + children: [ + InkWell( + onTap: (){ + Navigator.of(context).pushNamed(BODY_MEASUREMENTS); + }, + child: CircleAvatarWidget( + des: 'Body Measurements', url: url + 'heartbeat.png', ), - ], - ), + ), + CircleAvatarWidget( + des: 'Temperature', + url: url + 'heartbeat.png', + ), + CircleAvatarWidget( + des: 'Pulse', + url: url + 'heartbeat.png', + ), + CircleAvatarWidget( + des: 'Respiration', + url: url + 'heartbeat.png', + ), + CircleAvatarWidget( + des: 'Blood Pressure', + url: url + 'heartbeat.png', + ), + CircleAvatarWidget( + des: 'Oxygenation', + url: url + 'heartbeat.png', + ), + CircleAvatarWidget( + des: 'Pain Scale', + url: url + 'heartbeat.png', + ), + ], ), - ], - ), - // height: 500, + ), + ], )); } } diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index de75f0ec..156457ff 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/models/list_doctor_working_hours_table_model.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -17,7 +18,8 @@ DrAppToastMsg toastMsg = DrAppToastMsg(); */ class Helpers { int cupertinoPickerIndex = 0; -/* + +/* *@author: Elham Rababah *@Date:12/4/2020 *@param: context, items, decKey, onSelectFun @@ -42,7 +44,8 @@ class Helpers { mainAxisAlignment: MainAxisAlignment.end, children: [ CupertinoButton( - child: Text('Cancel'.toUpperCase(), style: textStyle(context)), + child: Text('Cancel'.toUpperCase(), + style: textStyle(context)), onPressed: () { Navigator.pop(context); }, @@ -78,9 +81,9 @@ class Helpers { TextStyle textStyle(context) => TextStyle(color: Theme.of(context).primaryColor); -/* - *@author: Elham Rababah - *@Date:12/4/2020 +/* + *@author: Elham Rababah + *@Date:12/4/2020 *@param: context, List items, decKey, onSelectFun *@return: Container widget *@desc: buildPickerIterm this function will build the items of the cupertino @@ -88,7 +91,8 @@ class Helpers { buildPickerItems(context, List items, decKey, onSelectFun) { return CupertinoPicker( magnification: 1.5, - scrollController: FixedExtentScrollController(initialItem: cupertinoPickerIndex), + scrollController: + FixedExtentScrollController(initialItem: cupertinoPickerIndex), // backgroundColor: Colors.black87, children: items.map((item) { @@ -98,7 +102,8 @@ class Helpers { ); }).toList(), - itemExtent: 25, //height of each item + itemExtent: 25, + //height of each item looping: true, onSelectedItemChanged: (int index) { // selectitem =index; @@ -107,11 +112,11 @@ class Helpers { ); } -/* - *@author: Elham Rababah - *@Date:12/4/2020 +/* + *@author: Elham Rababah + *@Date:12/4/2020 *@param: msg - *@return: + *@return: *@desc: showErrorToast */ showErrorToast([msg = null]) { @@ -142,6 +147,179 @@ class Helpers { } } + /* + *@author: Mohammad Aljammal + *@Date:26/5/2020 + *@param: date in String formatted + *@return: DateTime + *@desc: convert String to DateTime + */ + static DateTime convertStringToDate(String date) { + const start = "/Date("; + const end = "+0300)"; + final startIndex = date.indexOf(start); + final endIndex = date.indexOf(end, startIndex + start.length); + return DateTime.fromMillisecondsSinceEpoch( + int.parse( + date.substring(startIndex + start.length, endIndex), + ), + ); + } + /* + *@author: Amjad Amireh + *@Date:5/5/2020 + *@param: checkDate + *@return: DateTime + *@desc: convert String to DateTime + */ +static String checkDate(String dateString) { + DateTime checkedTime = DateTime.parse(dateString); + DateTime currentTime = DateTime.now(); + + if ((currentTime.year == checkedTime.year) && + (currentTime.month == checkedTime.month) && + (currentTime.day == checkedTime.day)) { + return "Today"; + } else if ((currentTime.year == checkedTime.year) && + (currentTime.month == checkedTime.month)) { + if ((currentTime.day - checkedTime.day) == 1) { + return "YESTERDAY"; + } else if ((currentTime.day - checkedTime.day) == -1) { + return "Tomorrow"; + } + + if ((currentTime.day - checkedTime.day) <= -2) { + return "Next Week"; + } else { + return "Old Date"; + } + } + return "Old Date"; + } + + /* + *@author: Mohammad Aljammal + *@Date:26/5/2020 + *@param: month in int formatted + *@return: DateTime + *@desc: convert month in int to month name + */ + static getMonth(int month) { + switch (month) { + case 1: + return "Jan"; + case 2: + return "Feb"; + case 3: + return "Mar"; + case 4: + return "Apr"; + case 5: + return "May"; + case 6: + return "Jun"; + case 7: + return "Jul"; + case 8: + return "Aug"; + case 9: + return "Sep"; + case 10: + return "Oct"; + case 11: + return "Nov"; + case 12: + return "Dec"; + } + } + + /* + *@author: Mohammad Aljammal + *@Date:26/5/2020 + *@param: week day in int formatted + *@return: DateTime + *@desc: convert week day in int to week day name + */ + static getWeekDay(int weekDay) { + switch (weekDay) { + case 1: + return "Monday"; + case 2: + return "Tuesday"; + case 3: + return "Wednesday"; + case 4: + return "Thursday"; + case 5: + return "Friday"; + case 6: + return "Saturday "; + case 7: + return "Sunday"; + } + } + /* + *@author: Mohammad Aljammal + *@Date:26/5/2020 + *@param: DateTime + *@return: data formatted like Apr 26,2020 + *@desc: convert DateTime to data formatted + */ + static String getDate(DateTime dateTime) { + print(dateTime); + if (dateTime != null) + return getMonth(dateTime.month) + + " " + + dateTime.day.toString() + + "," + + dateTime.year.toString(); + else + return ""; + } + /* + *@author: Mohammad Aljammal + *@Date:26/5/2020 + *@param: DateTime + *@return: data formatted like 26/4/2020 + *@desc: convert DateTime to data formatted + */ + static String getDateFormatted(DateTime dateTime) { + print(dateTime); + if (dateTime != null) + return dateTime.day.toString() + + "/" + + dateTime.month.toString() + + "/" + + dateTime.year.toString(); + else + return ""; + } + + /* + *@author: Mohammad Aljammal + *@Date:26/5/2020 + *@param: String workingHours + *@return: List + *@desc: convert workingHours string to List + */ + static List getWorkingHours(String workingHours ){ + List myWorkingHours =[]; + List listOfHours = workingHours.split('a'); + + listOfHours.forEach((element) { + WorkingHours workingHours = WorkingHours(); + var from = element.substring(element.indexOf('m ') + 2 , element.indexOf('To')-2); + workingHours.from = from.trim(); + var to = element.substring(element.indexOf('To') + 2); + workingHours.to = to.trim(); + myWorkingHours.add(workingHours); + }); + return myWorkingHours; + } + + + + /* *@author: Elham Rababah *@Date:12/5/2020 diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index 0eb11866..061d85c6 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -1,4 +1,5 @@ -import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'dart:io' show Platform; + import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -31,6 +32,7 @@ class _VerificationMethodsState extends State { MainAxisAlignment spaceBetweenMethods = MainAxisAlignment.spaceBetween; Future _loggedUserFuture; var _loggedUser; + var verificationMethod; @override void initState() { super.initState(); @@ -43,6 +45,14 @@ class _VerificationMethodsState extends State { }); } + @override + void didChangeDependencies() { + super.didChangeDependencies(); + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + verificationMethod = + routeArgs != null ? routeArgs['verificationMethod'] : null; + } + @override Widget build(BuildContext context) { AuthProvider authProv = Provider.of(context); @@ -63,7 +73,9 @@ class _VerificationMethodsState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Please choose one of the Following option to verify", + hideSilentMethods() + ? 'As a first step, you need to verify by one of those methods' + : 'Please choose one of the Following option to verify', style: TextStyle( fontSize: 3.5 * SizeConfig.textMultiplier, ), @@ -84,30 +96,28 @@ class _VerificationMethodsState extends State { mainAxisSpacing: 5, crossAxisCount: 2, children: [ - buildVerificationMethod( - context, - 'assets/images/verification_fingerprint_icon.png', - 'Fingerprint', - () {}), - buildVerificationMethod( - context, - 'assets/images/verification_faceid_icon.png', - 'Face ID', - () {}), - buildVerificationMethod( - context, - 'assets/images/verification_whatsapp_icon.png', - 'WhatsApp', () { - sendActivationCodeByOtpNotificationType( - 2, authProv); - }), - buildVerificationMethod( - context, - 'assets/images/verification_sms_icon.png', - 'SMS', () { - sendActivationCodeByOtpNotificationType( - 1, authProv); - }), + Visibility( + visible: hideSilentMethods() ? false : true, + child: buildFingerprintMethod( + context, authProv), + replacement: + buildWhatsAppMethod(context, authProv), + ), + Visibility( + visible: hideSilentMethods() ? false : true, + child: buildFaceIDMethod(context, authProv), + replacement: + buildSMSMethod(context, authProv), + ), + Visibility( + visible: + hideSilentMethods() ? false : true, + child: buildWhatsAppMethod( + context, authProv)), + Visibility( + visible: hideSilentMethods() ? false : true, + child: buildSMSMethod(context, authProv), + ), ], ), ), @@ -115,9 +125,9 @@ class _VerificationMethodsState extends State { ), // height: 500, ), - SizedBox( - // height: 20, - ) + SizedBox( + // height: 20, + ) ], ), ); @@ -126,6 +136,67 @@ class _VerificationMethodsState extends State { }); } + /* + *@author: Elham Rababah + *@Date:28/5/2020 + *@param: BuildContext context, AuthProvider authProv + *@return: Center widget + *@desc: buildSMSMethod Methods widget + */ + Center buildSMSMethod(BuildContext context, AuthProvider authProv) { + return buildVerificationMethod( + context, 'assets/images/verification_sms_icon.png', 'SMS', () { + sendActivationCodeByOtpNotificationType(1, authProv); + }); + } + /* + *@author: Elham Rababah + *@Date:28/5/2020 + *@param: BuildContext context, AuthProvider authProv + *@return: Center widget + *@desc: build WhatsApp Methods widget + */ + Center buildWhatsAppMethod(BuildContext context, AuthProvider authProv) { + return buildVerificationMethod( + context, 'assets/images/verification_whatsapp_icon.png', 'WhatsApp', + () { + sendActivationCodeByOtpNotificationType(2, authProv); + }); + } +/* + *@author: Elham Rababah + *@Date:28/5/2020 + *@param: BuildContext context, AuthProvider authProv + *@return: Center widget + *@desc: build FaceID Methods widget + */ + Center buildFaceIDMethod(BuildContext context, AuthProvider authProv) { + return buildVerificationMethod( + context, 'assets/images/verification_faceid_icon.png', 'Face ID', () { + sendActivationCodeByOtpNotificationType(3, authProv); + }); + } +/* + *@author: Elham Rababah + *@Date:28/5/2020 + *@param: BuildContext context, AuthProvider authProv + *@return: Center widget + *@desc: build Fingerprint Methods widget + */ + Center buildFingerprintMethod(BuildContext context, AuthProvider authProv) { + return buildVerificationMethod(context, + 'assets/images/verification_fingerprint_icon.png', 'Fingerprint', () { + sendActivationCodeByOtpNotificationType(4, authProv); + }); + } + + /* + *@author: Elham Rababah + *@Date:28/5/2020 + *@param: BuildContext context, AuthProvider authProv + *@return: Center widget + *@desc: build Verification Methods widget + */ Center buildVerificationMethod(context, url, dec, Function fun) { return Center( child: InkWell( @@ -168,6 +239,10 @@ class _VerificationMethodsState extends State { ); } + bool hideSilentMethods() { + return verificationMethod == 4 || verificationMethod == 3 ? true : false; + } + /* *@author: Elham Rababah *@Date:15/4/2020 @@ -176,9 +251,10 @@ class _VerificationMethodsState extends State { *@desc: send Activation Code By Otp Notification Type */ sendActivationCodeByOtpNotificationType(oTPSendType, AuthProvider authProv) { - widget.changeLoadingStata(true); // TODO : build enum for verfication method if (oTPSendType == 1 || oTPSendType == 2) { + widget.changeLoadingStata(true); + Map model = { "LogInTokenID": _loggedUser['LogInTokenID'], "Channel": 9, @@ -190,10 +266,7 @@ class _VerificationMethodsState extends State { "UserName": _loggedUser['List_MemberInformation'][0]['MemberID'], "OTP_SendType": oTPSendType }; - // print('$_loggedUser'); - // print(oTPSendType); authProv.sendActivationCodeByOtpNotificationType(model).then((res) { - // Navigator.of(context).pushNamed(VERIFY_ACCOUNT); widget.changeLoadingStata(false); if (res['MessageStatus'] == 1) { @@ -202,7 +275,6 @@ class _VerificationMethodsState extends State { print(res['ErrorEndUserMessage']); helpers.showErrorToast(res['ErrorEndUserMessage']); } - // Navigator.of(context).pushNamed(HOME); }).catchError((err) { print('$err'); widget.changeLoadingStata(false); @@ -211,6 +283,12 @@ class _VerificationMethodsState extends State { }); } else { // TODO route to this page with parameters to inicate we should present 2 option + if (Platform.isAndroid && oTPSendType == 3) { + helpers.showErrorToast('Your device not support this feature'); + } else { + Navigator.of(context).pushNamed(VERIFICATION_METHODS, + arguments: {'verificationMethod': oTPSendType}); + } } } } diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/widgets/doctor/doctor_reply_widget.dart new file mode 100644 index 00000000..5ec30858 --- /dev/null +++ b/lib/widgets/doctor/doctor_reply_widget.dart @@ -0,0 +1,177 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/list_gt_my_pationents_question_model.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class DoctorReplyWidget extends StatefulWidget { + final ListGtMyPatientsQuestions reply; + bool isShowMore = false; + + DoctorReplyWidget({Key key, this.reply}); + + @override + _DoctorReplyWidgetState createState() => _DoctorReplyWidgetState(); +} + +class _DoctorReplyWidgetState extends State { + @override + Widget build(BuildContext context) { + return Stack( + children: [ + Container( + margin: EdgeInsets.symmetric(vertical: 10.0), + width: double.infinity, + decoration: BoxDecoration( + color: Hexcolor('#FFFFFF'), + borderRadius: BorderRadius.all( + Radius.circular(20.0), + ), + ), + child: Container( + margin: EdgeInsets.all(5), + child: Column( + children: [ + SizedBox(height: 18,), + Container( + margin: EdgeInsets.only(right: 15), + child: Row( + children: [ + SizedBox(width: 5,), + LargeAvatar(name: widget.reply.patientName,url: '',), + SizedBox(width: 15,), + Expanded( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + widget.reply.patientName, + fontSize: 1.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + SizedBox( + height: 5, + ), + + Row( + children: [ + AppText( + TranslationBase.of(context).fileNo, + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + Container( + margin: EdgeInsets.only(left: 5), + child: AppText( + '${widget.reply.patientID}', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + SizedBox( + height: 5, + ), + Row( + children: [ + AppText( + TranslationBase.of(context).mobileNo, + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + Container( + margin: EdgeInsets.only(left: 5), + child: AppText( + widget.reply.mobileNumber, + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + SizedBox( + height: 5, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 70, + height: 20, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(60.0)), + color: Colors.green[600] + ), + child: Center( + child: AppText( + widget.reply.requestTime, + fontSize: 1.5 * SizeConfig.textMultiplier, + color: Colors.white, + ), + ), + ), + Container( + + child: AppText( + '${Helpers.getDate(widget.reply.requestDate)}', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + ], + ), + + ], + ), + ), + ) + + ], + ), + ), + + !widget.isShowMore ? SizedBox(height: 18,) : + AnimatedContainer( + duration: Duration(milliseconds: 200), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Divider(color: Colors.grey), + SizedBox(height: 5,), + AppText( + widget.reply.remarks, + fontSize: 2.5 * SizeConfig.textMultiplier, + //fontWeight: FontWeight.bold, + ), + SizedBox(height: 10,) + ], + ), + ), + + ], + ), + ), + ), + Positioned( + right: 5, + top: 20, + child: InkWell( + onTap: (){ + setState(() { + widget.isShowMore = !widget.isShowMore; + }); + }, + child: Icon(widget.isShowMore? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down)), + ) + ], + + ); + } +} diff --git a/lib/widgets/doctor/my_referral_patient_widget.dart b/lib/widgets/doctor/my_referral_patient_widget.dart new file mode 100644 index 00000000..433b9593 --- /dev/null +++ b/lib/widgets/doctor/my_referral_patient_widget.dart @@ -0,0 +1,338 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/my_referral_patient_model.dart'; +import 'package:doctor_app_flutter/providers/referral_patient_provider.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_button.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class MyReferralPatientWidget extends StatefulWidget { + final MyReferralPatientModel myReferralPatientModel; + + MyReferralPatientWidget({Key key, this.myReferralPatientModel}); + + @override + _MyReferralPatientWidgetState createState() => + _MyReferralPatientWidgetState(); +} + +class _MyReferralPatientWidgetState extends State { + bool _showDetails = false; + bool _isLoading = false; + final _formKey = GlobalKey(); + String error; + TextEditingController answerController; + + @override + void initState() { + answerController = new TextEditingController(text: widget.myReferralPatientModel.referredDoctorRemarks ?? ''); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return CardWithBgWidgetNew( + widget: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + AppText( + '${widget.myReferralPatientModel.firstName} ${widget.myReferralPatientModel.lastName}', + fontSize: 2.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + InkWell( + onTap: () { + setState(() { + _showDetails = !_showDetails; + }); + }, + child: Icon(_showDetails + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down)), + ], + ), + !_showDetails + ? Container() + : AnimatedContainer( + duration: Duration(milliseconds: 200), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Divider(color: Colors.grey), + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'File No', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + AppText( + '${widget.myReferralPatientModel.referringDoctor}', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + + ), + Container( + height: SizeConfig.realScreenWidth * 0.1, + width: 0.8, + color: Colors.grey, + margin: EdgeInsets.only(left: 15, right: 15), + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + 'Referring Doctor', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + AppText( + widget.myReferralPatientModel + .referringClinicDescription, + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ), + ], + ), + + Divider(color: Colors.grey), + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Referring Clinic', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + AppText( + '${widget.myReferralPatientModel.referringClinicDescription}', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ), + Container( + height: SizeConfig.realScreenWidth * 0.1, + width: 0.8, + color: Colors.grey, + margin: EdgeInsets.only(left: 15, right: 15), + ), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Frequency', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + AppText( + widget.myReferralPatientModel + .frequencyDescription, + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ), + ], + ), + Divider(color: Colors.grey), + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Priority', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + AppText( + '${widget.myReferralPatientModel.priorityDescription}', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ), + Container( + height: SizeConfig.realScreenWidth * 0.1, + width: 0.8, + color: Colors.grey, + margin: EdgeInsets.only(left: 15, right: 15), + ), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + 'Max Response Time', + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + AppText( + Helpers.getDateFormatted(widget + .myReferralPatientModel + .mAXResponseTime), + fontSize: + 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ), + ], + ), + Divider(color: Colors.grey), + AppText( + 'Clinic Details and Remarks', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + textAlign: TextAlign.start, + ), + SizedBox( + height: 5, + ), + Texts( + '73 years old female known case of HTN and dm on regular medication one day prior the patient had rt sided weakness suddenly and reduced level of conscoiusness no vomting no headache no bluriing of vision no other relevant symptoms.\r\nPMH:No history of similar condition no history of surgey or blood transfusions\r\nCT brain was done apparently effaced left insular cortex', + style: "bodyText1", + readMore: true, + textAlign: TextAlign.start, + maxLength: 100), + SizedBox( + height: 5, + ), + AppText( + 'Answer/Suggestions', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + textAlign: TextAlign.start, + ), + SizedBox( + height: 5, + ), + Form( + key: _formKey, + child: TextFields( + maxLines: 2, + minLines: 2, + hintText: 'Answer the patient', + initialValue: widget.myReferralPatientModel.referredDoctorRemarks ?? '', + readOnly: _isLoading, + validator: (value) { + if (value.isEmpty) + return "please enter answer"; + else + return null; + }, + ), + ), + SizedBox(height: 10.0), + if (error != null && error.isNotEmpty) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Theme.of(context) + .errorColor + .withOpacity(0.06), + ), + padding: EdgeInsets.symmetric( + vertical: 8.0, horizontal: 12.0), + child: Row( + children: [ + Expanded( + child: Texts(error ?? "", + style: "bodyText1", + color: Theme.of(context) + .errorColor)), + ], + ), + ), + SizedBox(height: 10.0), + ], + ), + SizedBox(height: 10.0), + Container( + width: double.infinity, + child: Button( + onTap: () async { + final form = _formKey.currentState; + if (form.validate()) { + setState(() { + _isLoading = true; + }); + try { + await Provider.of(context, listen: false).replay(answerController.text.toString(), widget.myReferralPatientModel); + setState(() { + _isLoading = false; + }); + } catch (e) { + setState(() { + error = e.toString(); + _isLoading = false; + }); + } + } + }, + title: 'Reply', + loading: _isLoading, + ), + ) + ], + ) + ], + ), + ) + ], + ), + ), + ); + } +} diff --git a/lib/widgets/doctor/my_schedule_widget.dart b/lib/widgets/doctor/my_schedule_widget.dart new file mode 100644 index 00000000..c37d09ad --- /dev/null +++ b/lib/widgets/doctor/my_schedule_widget.dart @@ -0,0 +1,79 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/list_doctor_working_hours_table_model.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class MyScheduleWidget extends StatelessWidget { + final ListDoctorWorkingHoursTable workingHoursTable; + + MyScheduleWidget({Key key, this.workingHoursTable}); + + @override + Widget build(BuildContext context) { + List workingHours = Helpers.getWorkingHours(workingHoursTable.workingHours); + return CardWithBgWidgetNew( + widget: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AppText(workingHoursTable.dayName, + fontSize: 2.5 * SizeConfig.textMultiplier), + AppText( + ' ${workingHoursTable.date.day}/${workingHoursTable.date.month}/${workingHoursTable.date.year}', + fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.w300,), + ], + ), + SizedBox( + height: 8, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: workingHours.map((work) { + return Container( + child: Column( + children: [ + Divider(color: Colors.grey), + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText('From',fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.bold,), + AppText(work.from,fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.w300,) + ], + ), + ), + Container(height: SizeConfig.realScreenWidth * 0.1 ,width: 0.8,color: Colors.grey, + margin: EdgeInsets.only(left: 15,right: 15),), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText('To',fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.bold,), + AppText(work.to,fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.w300,) + ], + ), + ), + ], + ) + + ], + ), + ); + }).toList(), + ), + SizedBox( + width: 8, + ) + ], + ), + ), + ); + } +} diff --git a/lib/widgets/patients/profile/avatar_gradients.dart b/lib/widgets/patients/profile/avatar_gradients.dart new file mode 100644 index 00000000..a6cce98d --- /dev/null +++ b/lib/widgets/patients/profile/avatar_gradients.dart @@ -0,0 +1,42 @@ +import 'package:flutter/material.dart'; + +class AvatarGradients{ + static List getGradients (String name) { + + int code = (name?.length ?? 0) > 0 ? name.toUpperCase()[0].codeUnits[0] : 1; + code += (name?.length ?? 0) > 1 ? name.toUpperCase()[1].codeUnits[0] : 0; + + List> colors = [ + [ + Color.fromRGBO(150, 222, 218, 1.0), + Color.fromRGBO(80, 201, 195, 1.0), + ], + [ + Color.fromRGBO(102, 126, 254, 1.0), + Color.fromRGBO(148, 75, 192, 1.0), + ], + [ + Color.fromRGBO(255, 177, 153, 1.0), + Color.fromRGBO(255, 8, 68, 1.0), + ], + [ + Color.fromRGBO(100, 210, 255, 1.0), + Color.fromRGBO(10, 60, 255, 1.0), + ], + [ + Color.fromRGBO(83, 120, 149, 1.0), + Color.fromRGBO(9, 32, 63, 1.0), + ], + [ + Color.fromRGBO(48, 210, 190, 1.0), + Color.fromRGBO(53, 132, 167, 1.0), + ], + [ + Color.fromRGBO(255, 179, 169, 1.0), + Color.fromRGBO(245, 103, 144, 1.0), + ] + ]; + + return colors[code % colors.length]; + } +} \ No newline at end of file diff --git a/lib/widgets/patients/profile/large_avatar.dart b/lib/widgets/patients/profile/large_avatar.dart new file mode 100644 index 00000000..ab28b9fe --- /dev/null +++ b/lib/widgets/patients/profile/large_avatar.dart @@ -0,0 +1,74 @@ +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'avatar_gradients.dart'; + +class LargeAvatar extends StatelessWidget { + LargeAvatar({Key key, this.name, this.url, this.disableProfileView: false}) + : super(key: key); + + final String name; + final String url; + final bool disableProfileView; + + Widget _getAvatar() { + if (url != null && url.isNotEmpty && Uri.parse(url).isAbsolute) { + return Center( + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(60.0)), + child: Image.network( + url.trim(), + fit: BoxFit.cover, + width: 90.0, + height: 90.0, + ), + ), + ); + } else if (name == null || name.isEmpty) { + return Center( + child: AppText( + 'DR', + color: Colors.white, + )); + } else { + return Center( + child: AppText( + name[0].toUpperCase(), + color: Colors.white,fontSize: 18,fontWeight: FontWeight.bold, + )); + } + } + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: disableProfileView + ? null + : () { + //TODO when we need that + }, + child: Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment(-1, -1), + end: Alignment(1, 1), + colors: [ + Colors.grey[100], + Colors.grey[800], + ] + ), + boxShadow: [ + BoxShadow( + color: Color.fromRGBO(0, 0, 0, 0.08), + offset: Offset(0.0, 5.0), + blurRadius: 16.0) + ], + borderRadius: BorderRadius.all(Radius.circular(50.0)), + ), + width: 90.0, + height: 90.0, + child: _getAvatar()), + ); + } +} diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 3f40204b..657690be 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -47,7 +47,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { children: [ InkWell( onTap: () { - navigator(context, VITAL_SIGN); + navigator(context, VITAL_SIGN_DETAILS); }, child: CircleAvatarWidget( des: 'Vital Sign', diff --git a/lib/widgets/shared/Text.dart b/lib/widgets/shared/Text.dart new file mode 100644 index 00000000..76402617 --- /dev/null +++ b/lib/widgets/shared/Text.dart @@ -0,0 +1,239 @@ +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class Texts extends StatefulWidget { + + final String text; + final String variant; + final Color color; + final bool bold; + final bool regular; + final bool medium; + final int maxLength; + final bool italic; + final TextAlign textAlign; + final int maxLines; + final bool readMore; + final String style; + final bool allowExpand; + + Texts(this.text, {Key key, this.variant, this.color, + this.bold, this.regular, this.medium, this.allowExpand = true, + this.italic:false, this.textAlign, this.maxLength=60, + this.maxLines, this.readMore=false, this.style + }) : super(key: key); + + @override + _TextsState createState() => _TextsState(); +} + +class _TextsState extends State { + bool hidden = false; + String text = ""; + + @override + void didUpdateWidget(Texts oldWidget) { + setState(() { + if (widget.style=="overline") + text = widget.text.toUpperCase(); + else { + text = widget.text; + } + }); + super.didUpdateWidget(oldWidget); + } + + @override + void initState() { + hidden = widget.readMore; + if (widget.style=="overline") + text = widget.text.toUpperCase(); + else { + text = widget.text; + } + super.initState(); + } + + double _getFontSize () { + switch (widget.variant) { + case "heading0": + return 40.0; + case "heading": + return 32.0; + case "heading2": + return 28.0; + case "heading3": + return 18.0; + case "body1": + return 18.0; + case "body2": + return 20.0; + case "body2Link": + return 16.0; + case "caption": + return 16.0; + case "caption2": + return 14.0; + case "bodyText": + return 15.0; + case "bodyText2": + return 17.0; + case "caption3": + return 12.0; + case "caption4": + return 9.0; + case "overline": + return 11.0; + case "date": + return 24.0; + default: + return 16.0; + } + } + + FontWeight _getFontWeight () { + if (widget.bold ?? false) { + return FontWeight.w900; + } else if (widget.regular ?? false) { + return FontWeight.w500; + } else if (widget.medium ?? false) { + return FontWeight.w800; + } + else { + if (widget.style==null) { + switch (widget.variant) { + case "heading": + return FontWeight.w900; + case "heading2": + return FontWeight.w900; + case "heading3": + return FontWeight.w900; + case "body1": + return FontWeight.w800; + case "body2": + return FontWeight.w900; + case "body2Link": + return FontWeight.w800; + case "caption": + return FontWeight.w700; + case "caption2": + return FontWeight.w700; + case "bodyText": + return FontWeight.w500; + case "bodyText2": + return FontWeight.w500; + case "caption3": + return FontWeight.w600; + case "caption4": + return FontWeight.w600; + case "overline": + return FontWeight.w800; + case "date": + return FontWeight.w900; + default: + return FontWeight.w500; + } + } else { + return null; + } + + } + } + + @override + Widget build(BuildContext context) { + + TextStyle _getFontStyle () { + switch (widget.style) { + case "headline2": + return Theme.of(context).textTheme.headline2; + case "headline3": + return Theme.of(context).textTheme.headline3; + case "headline4": + return Theme.of(context).textTheme.headline4; + case "headline5": + return Theme.of(context).textTheme.headline5; + case "headline6": + return Theme.of(context).textTheme.headline6; + case "bodyText2": + return Theme.of(context).textTheme.bodyText2; + case "bodyText_15": + return Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 15.0); + case "bodyText1": + return Theme.of(context).textTheme.bodyText1; + case "caption": + return Theme.of(context).textTheme.caption; + case "overline": + return Theme.of(context).textTheme.overline; + case "button": + return Theme.of(context).textTheme.button; + default : + return TextStyle(); + } + } + + return Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + Text(!hidden ? text : (text.substring(0, text.length > widget.maxLength ? widget.maxLength : text.length)), + textAlign: widget.textAlign, + overflow: widget.maxLines!=null ? ((widget.maxLines > 1) ? TextOverflow.fade : TextOverflow.ellipsis) : null, + maxLines: widget.maxLines ?? null, + style: widget.style != null ? _getFontStyle().copyWith( + fontStyle: widget.italic ? FontStyle.italic : null, + color: widget.color!=null ? widget.color : null, + fontWeight: _getFontWeight(), + ) : TextStyle( + fontStyle: widget.italic ? FontStyle.italic : null, + color: widget.color!=null ? widget.color : Colors.black, + fontSize: _getFontSize(), + letterSpacing: widget.variant=="overline" ? 1.5 : null, + fontWeight: _getFontWeight(), + ) + ), + if (widget.readMore && text.length > widget.maxLength && hidden) + Positioned( + bottom: 0, + left: 0, + right: 0, + child: Container( + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [ + Theme.of(context).backgroundColor, + Theme.of(context).backgroundColor.withOpacity(0), + ], + begin: Alignment.bottomCenter, + end: Alignment.topCenter + ) + ), + height: 30, + ), + ) + ], + ), + if (widget.allowExpand && widget.readMore && text.length > widget.maxLength) + Padding( + padding: EdgeInsets.only(top: 8.0, right: 8.0, bottom: 8.0), + child: InkWell( + onTap: () { + setState(() { + hidden=!hidden; + }); + }, + child: Text(hidden ? "Read More" : "Read less", + style: _getFontStyle().copyWith( + color: Hexcolor('#515b5d'), + fontWeight: FontWeight.w800, + fontFamily: "WorkSans" + ) + ), + ), + ), + ], + ); + } +} diff --git a/lib/widgets/shared/TextFields.dart b/lib/widgets/shared/TextFields.dart new file mode 100644 index 00000000..269ad660 --- /dev/null +++ b/lib/widgets/shared/TextFields.dart @@ -0,0 +1,185 @@ +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + + + +class TextFields extends StatefulWidget { + + TextFields({Key key, this.type, this.hintText, this.suffixIcon, this.autoFocus, this.onChanged, this.initialValue, this.minLines, this.maxLines, this.inputFormatters, this.padding, this.focus=false, this.maxLengthEnforced=true, + this.suffixIconColor, this.inputAction, this.onSubmit, this.keepPadding=true, this.textCapitalization = TextCapitalization.none, this.onTap, this.controller, this.keyboardType, this.validator, this.borderOnlyError=false, + this.onSaved, this.onSuffixTap, this.readOnly: false, this.maxLength, this.prefixIcon, this.bare=false, this.fontSize=16.0, this.fontWeight=FontWeight.w700, this.autoValidate=false}) : super(key: key); + + final String hintText; + final String initialValue; + final String type; + final bool autoFocus; + final IconData suffixIcon; + final Color suffixIconColor; + final IconData prefixIcon; + final VoidCallback onTap; + final TextEditingController controller; + final TextInputType keyboardType; + final FormFieldValidator validator; + final Function onSaved; + final Function onSuffixTap; + final Function onChanged; + final Function onSubmit; + final bool readOnly; + final int maxLength; + final int minLines; + final int maxLines; + final bool maxLengthEnforced; + final bool bare; + final TextInputAction inputAction; + final double fontSize; + final FontWeight fontWeight; + final bool keepPadding; + final TextCapitalization textCapitalization; + final List inputFormatters; + final bool autoValidate; + final EdgeInsets padding; + final bool focus; + final bool borderOnlyError; + + @override + _TextFieldsState createState() => _TextFieldsState(); +} + +class _TextFieldsState extends State { + final FocusNode _focusNode = FocusNode(); + bool focus = false; + bool view = false; + + @override + void initState() { + super.initState(); + _focusNode.addListener(() { + setState(() { + focus = _focusNode.hasFocus; + }); + }); + } + + @override + void didUpdateWidget(TextFields oldWidget) { + if (widget.focus) + _focusNode.requestFocus(); + super.didUpdateWidget(oldWidget); + } + + @override + void dispose() { + _focusNode.dispose(); + super.dispose(); + } + + Widget _buildSuffixIcon() { + switch (widget.type) { + case "password": + { return Padding( + padding: const EdgeInsets.only(right: 8.0), + child: view ? + InkWell(onTap: () {this.setState(() { view= false; });}, child: Icon(EvaIcons.eye, size: 24.0, color: Color.fromRGBO(78, 62, 253, 1.0))) + : + InkWell(onTap: () {this.setState(() { view= true; });}, child: Icon(EvaIcons.eyeOff, size: 24.0, color: Colors.grey[500])) + );} + + break; + default: + if (widget.suffixIcon!=null) + return InkWell(onTap: widget.onSuffixTap, child: Icon(widget.suffixIcon, size: 22.0, color: widget.suffixIconColor!=null ? widget.suffixIconColor : Colors.grey[500])); + else + return null; + } + } + + bool _determineReadOnly() { + if (widget.readOnly!=null && widget.readOnly) { + _focusNode.unfocus(); + return true; + } else { + return false; + } + } + + @override + Widget build(BuildContext context) { + return ( + AnimatedContainer( + duration: Duration(milliseconds: 300), + decoration: widget.bare ? null :BoxDecoration( + boxShadow: [BoxShadow(color: Color.fromRGBO(70, 68, 167, focus ? 0.20 : 0), offset: Offset(0.0, 13.0), blurRadius: focus ? 34.0 : 12.0)] + ), + child: TextFormField( + keyboardAppearance: Theme.of(context).brightness, + scrollPhysics: BouncingScrollPhysics(), + autovalidate: widget.autoValidate, + textCapitalization: widget.textCapitalization, + onFieldSubmitted: widget.inputAction==TextInputAction.next ? (widget.onSubmit!=null ? widget.onSubmit : (val) { _focusNode.nextFocus(); }) : widget.onSubmit, + textInputAction: widget.inputAction, + minLines: widget.minLines ?? 1, + maxLines: widget.maxLines ?? 1, + maxLengthEnforced: widget.maxLengthEnforced, + initialValue: widget.initialValue, + onChanged: widget.onChanged, + focusNode: _focusNode, + maxLength: widget.maxLength ?? null, + controller: widget.controller, + keyboardType: widget.keyboardType, + readOnly: _determineReadOnly(), + obscureText: widget.type=="password" && !view ? true : false, + autofocus: widget.autoFocus ?? false, + validator: widget.validator, + onSaved: widget.onSaved, + style: Theme.of(context).textTheme.body2.copyWith( fontSize: widget.fontSize, fontWeight: widget.fontWeight ), + inputFormatters: widget.inputFormatters, + decoration: InputDecoration( + counterText: "", + hintText: widget.hintText, + hintStyle: TextStyle(fontSize: widget.fontSize, fontWeight: widget.fontWeight, color: Theme.of(context).hintColor), + + contentPadding: widget.padding!=null ? widget.padding : EdgeInsets.symmetric(vertical: (widget.bare && !widget.keepPadding) ? 0.0 : 10.0, horizontal: 16.0), + filled: true, + fillColor: widget.bare ? Colors.transparent : Theme.of(context).backgroundColor, + + suffixIcon: _buildSuffixIcon(), + prefixIcon: widget.type!="search" ? + widget.prefixIcon!=null ? + Padding( + padding: EdgeInsets.only(left: 28.0, top: 14.0, bottom: 14.0, right: 0), + child: Text("\$", style: TextStyle( fontSize: 14, fontWeight: FontWeight.w800),), + ) + : + null + : + Icon(EvaIcons.search, size: 20.0, color: Colors.grey[500]), + + errorStyle: TextStyle(fontSize: 14.0, fontWeight: widget.fontWeight, height: widget.borderOnlyError ? 0.0 : null), + errorBorder: OutlineInputBorder( + borderSide: BorderSide(color: Theme.of(context).errorColor.withOpacity(widget.bare ? 0.0 : 0.5 ), width: 2.0), + borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide(color: Theme.of(context).errorColor.withOpacity(widget.bare ? 0.0 : 0.5 ), width: 2.0), + borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Theme.of(context).dividerColor.withOpacity(widget.bare ? 0.0 : 1.0 ), width: 2.0), + borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Theme.of(context).dividerColor.withOpacity(widget.bare ? 0.0 : 1.0 ), width: 2.0), + borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Theme.of(context).dividerColor.withOpacity(widget.bare ? 0.0 : 1.0 ), width: 2.0), + borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0) + ) + + ), + ), + ) + ); + } +} diff --git a/lib/widgets/shared/app_button.dart b/lib/widgets/shared/app_button.dart index 522255df..32f5b139 100644 --- a/lib/widgets/shared/app_button.dart +++ b/lib/widgets/shared/app_button.dart @@ -86,8 +86,7 @@ class _ButtonState extends State