in patient list improve performace

merge-requests/829/head
Elham Rababh 4 years ago
parent 9317173c05
commit a1f9729091

@ -258,6 +258,14 @@ class PatientSearchViewModel extends BaseViewModel {
}
}
removeOnFilteredList() {
if (lastSubsetIndex-inPatientPageSize - 1 > 0) {
filteredInPatientItems
.removeAt(lastSubsetIndex-inPatientPageSize - 1);
setState(ViewState.Idle);
}
}
filterByHospital({int hospitalId}) {
filteredInPatientItems = [];
for (var i = 0; i < inPatientList.length; i++) {

@ -48,8 +48,9 @@ class _InPatientListPageState extends State<InPatientListPage> {
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if(!widget.isMyInPatient)
Container(
margin: EdgeInsets.only(left: 10.0,right: 10, top: 10),
margin: EdgeInsets.only(left: 10.0, right: 10, top: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@ -120,7 +121,7 @@ class _InPatientListPageState extends State<InPatientListPage> {
),
),
Container(
margin: EdgeInsets.only(left: 16, right: 16, bottom: 16, top:5),
margin: EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 5),
child: Stack(
children: [
AppTextFieldCustom(
@ -155,8 +156,8 @@ class _InPatientListPageState extends State<InPatientListPage> {
// padding: EdgeInsets.only(bottom: 30),
onPressed: () {
GifLoaderDialogUtils.showMyDialog(context);
widget.patientSearchViewModel
.sortInPatient(isDes: isSortDes, isAllClinic:isAllClinic);
widget.patientSearchViewModel.sortInPatient(
isDes: isSortDes, isAllClinic: isAllClinic);
isSortDes = !isSortDes;
GifLoaderDialogUtils.hideDialog(context);
},
@ -286,11 +287,19 @@ class _InPatientListPageState extends State<InPatientListPage> {
}),
onNotification: (t) {
if (isAllClinic && !hasQuery) if (t
is ScrollUpdateNotification &&
t.metrics.pixels >=
t.metrics.maxScrollExtent - 50) {
widget.patientSearchViewModel
.addOnFilteredList();
is ScrollUpdateNotification) {
if (t.metrics.pixels >=
t.metrics.maxScrollExtent - 50) {
widget.patientSearchViewModel
.addOnFilteredList();
}
if (t.metrics.pixels <=
t.metrics.minScrollExtent - 50) {
widget.patientSearchViewModel
.removeOnFilteredList();
}
}
return;
},

@ -349,21 +349,22 @@ class PatientCard extends StatelessWidget {
),
Expanded(
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomRow(
label: TranslationBase.of(context).fileNumber,
label:
TranslationBase.of(context).fileNumber,
value: patientInfo.patientId.toString(),
),
CustomRow(
label: TranslationBase.of(context).age + " : ",
label:
TranslationBase.of(context).age + " : ",
value:
"${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}",
),
if (isInpatient)
CustomRow(
label: patientInfo.admissionDate == null
@ -377,33 +378,46 @@ class PatientCard extends StatelessWidget {
),
if (patientInfo.admissionDate != null)
CustomRow(
label: TranslationBase.of(context).numOfDays +
label: TranslationBase.of(context)
.numOfDays +
" : ",
value:
"${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}",
),
if (patientInfo.admissionDate != null)
CustomRow(
// TODO Elham* add translation
label:
"Clinic Name" +
" : ",
value: "${patientInfo.clinicDescription}",
),
if (patientInfo.admissionDate != null)
CustomRow(
label:
TranslationBase.of(context).roomNo + " : ",
TranslationBase.of(context).roomNo +
" : ",
value: "${patientInfo.roomId}",
),
if (isFromLiveCare)
Column(
children: [
CustomRow(
label: TranslationBase.of(context).clinic +
label: TranslationBase.of(context)
.clinic +
" : ",
value: patientInfo.clinicName,
),
],
),
]),
),
Icon(Icons.arrow_forward, size: 24,),
],
))
),
Icon(
Icons.arrow_forward,
size: 24,
),
],
))
]),
isFromLiveCare
? Row(
@ -458,5 +472,3 @@ class PatientCard extends StatelessWidget {
));
}
}

Loading…
Cancel
Save