forked from yaso_meth/mih-project
Patien View page added to display selected patient.
This commit is contained in:
@@ -14,10 +14,15 @@ class BuildPatientsList extends StatefulWidget {
|
||||
State<BuildPatientsList> createState() => _BuildPatientsListState();
|
||||
}
|
||||
|
||||
int indexOn = 0;
|
||||
|
||||
class _BuildPatientsListState extends State<BuildPatientsList> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.builder(
|
||||
return ListView.separated(
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider();
|
||||
},
|
||||
itemCount: widget.patients.length,
|
||||
itemBuilder: (context, index) {
|
||||
//final patient = widget.patients[index].id_no.contains(widget.searchString);
|
||||
@@ -27,6 +32,13 @@ class _BuildPatientsListState extends State<BuildPatientsList> {
|
||||
" " +
|
||||
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: Icon(Icons.arrow_forward),
|
||||
)
|
||||
: Container();
|
||||
},
|
||||
|
||||
@@ -56,4 +56,8 @@ class Patient {
|
||||
_ => throw const FormatException('Failed to load album.'),
|
||||
};
|
||||
}
|
||||
|
||||
String getIDNum() {
|
||||
return id_no;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,14 +48,6 @@ class _PatientManagerState extends State<PatientManager> {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
// void filterSearchResults(String query) {
|
||||
// setState(() {
|
||||
// futurePatients = futurePatientsList
|
||||
// .where((item) => item.toLowerCase().contains(query.toLowerCase()))
|
||||
// .toList();
|
||||
// });
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -69,27 +61,33 @@ class _PatientManagerState extends State<PatientManager> {
|
||||
} else if (snapshot.hasData) {
|
||||
final patientsList = snapshot.data!;
|
||||
|
||||
return Column(children: [
|
||||
//spacer
|
||||
const SizedBox(height: 10),
|
||||
MySearchField(
|
||||
controller: searchController,
|
||||
hintText: "ID Search",
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
searchString = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 10),
|
||||
Expanded(
|
||||
child: BuildPatientsList(
|
||||
patients: patientsList,
|
||||
searchString: searchString,
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(children: [
|
||||
//spacer
|
||||
const SizedBox(height: 10),
|
||||
MySearchField(
|
||||
controller: searchController,
|
||||
hintText: "ID Search",
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
searchString = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 10),
|
||||
Expanded(
|
||||
child: BuildPatientsList(
|
||||
patients: patientsList,
|
||||
searchString: searchString,
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
]);
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return const MyAppDrawer(drawerTitle: "Error pulling email");
|
||||
}
|
||||
|
||||
23
Frontend/patient_manager/lib/pages/patientView.dart
Normal file
23
Frontend/patient_manager/lib/pages/patientView.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:patient_manager/components/myAppBar.dart';
|
||||
import 'package:patient_manager/objects/patients.dart';
|
||||
|
||||
class PatientView extends StatefulWidget {
|
||||
final Patient selectedPatient;
|
||||
const PatientView({super.key, required this.selectedPatient});
|
||||
|
||||
@override
|
||||
State<PatientView> createState() => _PatientViewState();
|
||||
}
|
||||
|
||||
class _PatientViewState extends State<PatientView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: const MyAppBar(barTitle: "Patient View"),
|
||||
body: Center(
|
||||
child: Text(widget.selectedPatient.first_name),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:patient_manager/Authentication/authCheck.dart';
|
||||
import 'package:patient_manager/components/myAppBar.dart';
|
||||
import 'package:patient_manager/components/signInOrRegister.dart';
|
||||
import 'package:patient_manager/objects/patients.dart';
|
||||
import 'package:patient_manager/pages/home.dart';
|
||||
import 'package:patient_manager/pages/patientManager.dart';
|
||||
import 'package:patient_manager/pages/patientView.dart';
|
||||
|
||||
class RouteGenerator {
|
||||
static Route<dynamic> generateRoute(RouteSettings settings) {
|
||||
@@ -24,6 +26,15 @@ class RouteGenerator {
|
||||
);
|
||||
}
|
||||
return _errorRoute();
|
||||
case '/patient-manager/patient':
|
||||
if (args is Patient) {
|
||||
return MaterialPageRoute(
|
||||
builder: (_) => PatientView(
|
||||
selectedPatient: args,
|
||||
),
|
||||
);
|
||||
}
|
||||
return _errorRoute();
|
||||
case '/signin':
|
||||
return MaterialPageRoute(builder: (_) => const SignInOrRegister());
|
||||
// //case '/signIn':
|
||||
|
||||
Reference in New Issue
Block a user