split waiting room and patient search and add toggles to switch

This commit is contained in:
2024-08-24 06:47:34 +02:00
parent 1d7eb2f655
commit 2b4cf224cc

View File

@@ -47,6 +47,7 @@ class _PatientManagerState extends State<PatientManager> {
var formatter = DateFormat('yyyy-MM-dd'); var formatter = DateFormat('yyyy-MM-dd');
late String formattedDate; late String formattedDate;
bool start = true; bool start = true;
int _selectedIndex = 0;
late Future<List<Patient>> patientSearchResults; late Future<List<Patient>> patientSearchResults;
late Future<List<PatientQueue>> patientQueueResults; late Future<List<PatientQueue>> patientQueueResults;
@@ -429,6 +430,20 @@ class _PatientManagerState extends State<PatientManager> {
} }
} }
Widget showSelection(int index, double screenWidth, double screenHeight) {
if (index == 0) {
return SizedBox(
width: 660,
child: patientQueue(screenWidth, screenHeight),
);
} else {
return SizedBox(
width: 660,
child: patientSearch(screenWidth, screenHeight),
);
}
}
@override @override
void dispose() { void dispose() {
searchController.dispose(); searchController.dispose();
@@ -474,30 +489,42 @@ class _PatientManagerState extends State<PatientManager> {
// color: MzanziInnovationHub.of(context)!.theme.primaryColor(), // color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
// ), // ),
// ), // ),
body: SingleChildScrollView( body: Padding(
child: Padding( padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0),
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0), child: Column(
child: SizedBox( mainAxisAlignment: MainAxisAlignment.center,
width: double.infinity, crossAxisAlignment: CrossAxisAlignment.center,
child: Wrap( children: [
spacing: 10.0, Row(
runSpacing: 10.0, crossAxisAlignment: CrossAxisAlignment.end,
direction: Axis.horizontal, mainAxisAlignment: MainAxisAlignment.end,
alignment: WrapAlignment.center,
runAlignment: WrapAlignment.center,
crossAxisAlignment: WrapCrossAlignment.center,
children: [ children: [
SizedBox( IconButton(
width: 660, onPressed: () {
child: patientQueue(screenWidth, screenHeight), setState(() {
_selectedIndex = 0;
});
},
icon: const Icon(
Icons.people,
size: 35,
),
), ),
SizedBox( IconButton(
width: 660, onPressed: () {
child: patientSearch(screenWidth, screenHeight), setState(() {
_selectedIndex = 1;
});
},
icon: const Icon(
Icons.search,
size: 35,
),
), ),
], ],
), ),
), showSelection(_selectedIndex, screenWidth, screenHeight),
],
), ),
), ),
); );