change UP to cater for new med aid fields
This commit is contained in:
@@ -3,12 +3,12 @@ import 'package:patient_manager/objects/patients.dart';
|
||||
|
||||
class BuildPatientsList extends StatefulWidget {
|
||||
final List<Patient> patients;
|
||||
final searchString;
|
||||
//final searchString;
|
||||
|
||||
const BuildPatientsList({
|
||||
super.key,
|
||||
required this.patients,
|
||||
required this.searchString,
|
||||
//required this.searchString,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -16,6 +16,22 @@ class BuildPatientsList extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _BuildPatientsListState extends State<BuildPatientsList> {
|
||||
Widget isMainMember(int index) {
|
||||
if (widget.patients[index].medical_aid_main_member == "Yes") {
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
const Icon(Icons.star_border_rounded),
|
||||
Text(
|
||||
"${widget.patients[index].first_name} ${widget.patients[index].last_name}"),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return Text(
|
||||
"${widget.patients[index].first_name} ${widget.patients[index].last_name}");
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.separated(
|
||||
@@ -26,20 +42,18 @@ class _BuildPatientsListState extends State<BuildPatientsList> {
|
||||
itemBuilder: (context, index) {
|
||||
//final patient = widget.patients[index].id_no.contains(widget.searchString);
|
||||
//print(index);
|
||||
return widget.patients[index].id_no.contains(widget.searchString)
|
||||
? ListTile(
|
||||
title: Text(
|
||||
"${widget.patients[index].first_name} ${widget.patients[index].last_name}"),
|
||||
subtitle: Text(widget.patients[index].id_no),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
Navigator.of(context).pushNamed('/patient-manager/patient',
|
||||
arguments: widget.patients[index]);
|
||||
});
|
||||
},
|
||||
trailing: const Icon(Icons.arrow_forward),
|
||||
)
|
||||
: null;
|
||||
return ListTile(
|
||||
title: isMainMember(index),
|
||||
subtitle: Text(
|
||||
"ID No.: ${widget.patients[index].id_no}\nMedical Aid No.: ${widget.patients[index].medical_aid_no}"),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
Navigator.of(context).pushNamed('/patient-manager/patient',
|
||||
arguments: widget.patients[index]);
|
||||
});
|
||||
},
|
||||
trailing: const Icon(Icons.arrow_forward),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user