Merge branch 'master' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into develop
commit
8c46c93e86
@ -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<String, dynamic> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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<String, dynamic> 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<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -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<String, dynamic> 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<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -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<String, dynamic> 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<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -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<MyReferralPatientModel> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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: <Widget>[
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Column(
|
||||||
|
children: referralPatientProvider.listMyReferralPatientModel.map((item) {
|
||||||
|
return MyReferralPatientWidget(
|
||||||
|
myReferralPatientModel: item,
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -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<PatientReferredScreen> {
|
||||||
|
|
||||||
|
String patientType;
|
||||||
|
String patientTypetitle;
|
||||||
|
|
||||||
|
List<Map<dynamic,dynamic>>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) {
|
||||||
|
|
||||||
|
List<String>list=List();
|
||||||
|
|
||||||
|
return AppScaffold(
|
||||||
|
appBarTitle: "My Referred Patients",//patientTypetitle,
|
||||||
|
body: Center(
|
||||||
|
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
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<dynamic> getContent()
|
||||||
|
{
|
||||||
|
|
||||||
|
return ["1","2","3","4","5","6"].toList();
|
||||||
|
}
|
||||||
|
}
|
@ -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<DoctorReplyWidget> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Stack(
|
||||||
|
children: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
SizedBox(height: 18,),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(right: 15),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
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)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -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<MyReferralPatientWidget> {
|
||||||
|
bool _showDetails = false;
|
||||||
|
bool _isLoading = false;
|
||||||
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
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: <Widget>[
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Divider(color: Colors.grey),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
AppText(
|
||||||
|
'Max Response Time',
|
||||||
|
fontSize:
|
||||||
|
1.7 * SizeConfig.textMultiplier,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
AppText(
|
||||||
|
Helpers.getDateFormatted(widget
|
||||||
|
.myReferralPatientModel
|
||||||
|
.mAXResponseTime),
|
||||||
|
fontSize:
|
||||||
|
1.7 * SizeConfig.textMultiplier,
|
||||||
|
fontWeight: FontWeight.w300,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
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: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
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<MyReferralPatientProvider>(context, listen: false).replay(answerController.text.toString(), widget.myReferralPatientModel);
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
setState(() {
|
||||||
|
error = e.toString();
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
title: 'Reply',
|
||||||
|
loading: _isLoading,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -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> workingHours = Helpers.getWorkingHours(workingHoursTable.workingHours);
|
||||||
|
return CardWithBgWidgetNew(
|
||||||
|
widget: Container(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
Divider(color: Colors.grey),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
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: <Widget>[
|
||||||
|
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,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class AvatarGradients{
|
||||||
|
static List<Color> 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<List<Color>> 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];
|
||||||
|
}
|
||||||
|
}
|
@ -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()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -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<Texts> {
|
||||||
|
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: <Widget>[
|
||||||
|
Stack(
|
||||||
|
children: <Widget>[
|
||||||
|
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"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -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<TextInputFormatter> inputFormatters;
|
||||||
|
final bool autoValidate;
|
||||||
|
final EdgeInsets padding;
|
||||||
|
final bool focus;
|
||||||
|
final bool borderOnlyError;
|
||||||
|
|
||||||
|
@override
|
||||||
|
_TextFieldsState createState() => _TextFieldsState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _TextFieldsState extends State<TextFields> {
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
*@author: Amjad Amireh
|
||||||
|
*@Date:27/5/2020
|
||||||
|
*@param:listItems , headerTitle
|
||||||
|
*@return:ListItem Expand
|
||||||
|
|
||||||
|
*@desc:
|
||||||
|
*/
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class ExpandableItem extends StatefulWidget{
|
||||||
|
|
||||||
|
final List<String>listItems;
|
||||||
|
final String headerTitle;
|
||||||
|
|
||||||
|
ExpandableItem(this.headerTitle,this.listItems);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ExpandableItemState createState() => _ExpandableItemState();
|
||||||
|
|
||||||
|
}
|
||||||
|
class _ExpandableItemState extends State<ExpandableItem>
|
||||||
|
{
|
||||||
|
bool isExpand=false;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
isExpand=false;
|
||||||
|
}
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
List<String>listItem=this.widget.listItems;
|
||||||
|
return Container(
|
||||||
|
child: Padding(
|
||||||
|
padding: (isExpand==true)?const EdgeInsets.all(6.0):const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
decoration:BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: (isExpand!=true)?BorderRadius.all(Radius.circular(50)):BorderRadius.all(Radius.circular(25)),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
),
|
||||||
|
child: ExpansionTile(
|
||||||
|
key: PageStorageKey<String>(this.widget.headerTitle),
|
||||||
|
title: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
|
||||||
|
child: Text(this.widget.headerTitle,style: TextStyle(fontSize: (isExpand!=true)?18:22,color: Colors.black,fontWeight: FontWeight.bold),)),
|
||||||
|
|
||||||
|
trailing: (isExpand==true)?Icon(Icons.keyboard_arrow_up,color: Colors.black,):Icon(Icons.keyboard_arrow_down,color: Colors.black),
|
||||||
|
onExpansionChanged: (value){
|
||||||
|
setState(() {
|
||||||
|
isExpand=value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
for(final item in listItem)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: (){
|
||||||
|
print(Text("Selected Item $item "+this.widget.headerTitle ));
|
||||||
|
//========Stop Snak bar=========== Scaffold.of(context).showSnackBar(SnackBar(backgroundColor: Colors.black,duration:Duration(microseconds: 500),content: Text("Selected Item $item "+this.widget.headerTitle )));
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration:BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
|
||||||
|
border: Border(top: BorderSide(color: Theme.of(context).dividerColor))
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(item,style: TextStyle(color: Colors.black),),
|
||||||
|
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue