organise components in subfolders

This commit is contained in:
2024-08-13 10:15:39 +02:00
parent 7a6ba04220
commit 187e4fb604
34 changed files with 77 additions and 77 deletions

View File

@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
class BuildFileView extends StatefulWidget {
final String link;
final String path;
const BuildFileView({
super.key,
required this.link,
required this.path,
});
@override
State<BuildFileView> createState() => _BuildFileViewState();
}
class _BuildFileViewState extends State<BuildFileView> {
late PdfViewerController pdfViewerController = PdfViewerController();
String getExtType(String path) {
//print(pdfLink.split(".")[1]);
return path.split(".").last;
}
@override
Widget build(BuildContext context) {
if (getExtType(widget.path).toLowerCase() == "pdf") {
//print(widget.pdfLink);
return SizedBox(
width: 700,
child: Column(
children: [
Expanded(
child: SfPdfViewer.network(
widget.link,
controller: pdfViewerController,
),
),
],
),
);
} else {
return InteractiveViewer(
maxScale: 5.0,
//minScale: 0.,
child: Image.network(widget.link),
);
}
}
}

View File

@@ -0,0 +1,322 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:patient_manager/components/builders/BuildFileView.dart';
import 'package:patient_manager/components/popUpMessages/mihDeleteMessage.dart';
import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart';
import 'package:patient_manager/components/popUpMessages/mihSuccessMessage.dart';
import 'package:patient_manager/components/inputsAndButtons/mihButton.dart';
import 'package:patient_manager/env/env.dart';
import 'package:patient_manager/main.dart';
import 'package:patient_manager/objects/appUser.dart';
import 'package:patient_manager/objects/files.dart';
import 'package:supertokens_flutter/http.dart' as http;
import "package:universal_html/html.dart" as html;
class BuildFilesList extends StatefulWidget {
final AppUser signedInUser;
final List<PFile> files;
const BuildFilesList({
super.key,
required this.files,
required this.signedInUser,
});
@override
State<BuildFilesList> createState() => _BuildFilesListState();
}
class _BuildFilesListState extends State<BuildFilesList> {
int indexOn = 0;
final baseAPI = AppEnviroment.baseApiUrl;
final basefile = AppEnviroment.baseFileUrl;
String fileUrl = "";
Future<String> getFileUrlApiCall(String filePath) async {
if (AppEnviroment.getEnv() == "Dev") {
return "$basefile/mih/$filePath";
} else {
var url = "$baseAPI/minio/pull/file/$filePath/prod";
//print(url);
var response = await http.get(Uri.parse(url));
// print("here1");
//print(response.statusCode);
if (response.statusCode == 200) {
//print("here2");
String body = response.body;
//print(body);
//print("here3");
var decodedData = jsonDecode(body);
//print("Dedoced: ${decodedData['minioURL']}");
return decodedData['minioURL'];
//AppUser u = AppUser.fromJson(decodedData);
// print(u.email);
//return "AlometThere";
} else {
throw Exception(
"Error: GetUserData status code ${response.statusCode}");
}
}
//print(url);
// var response = await http.get(Uri.parse(url));
// // print("here1");
// //print(response.statusCode);
// if (response.statusCode == 200) {
// //print("here2");
// String body = response.body;
// //print(body);
// //print("here3");
// var decodedData = jsonDecode(body);
// //print("Dedoced: ${decodedData['minioURL']}");
// return decodedData['minioURL'];
// //AppUser u = AppUser.fromJson(decodedData);
// // print(u.email);
// //return "AlometThere";
// } else {
// throw Exception("Error: GetUserData status code ${response.statusCode}");
// }
}
Future<void> deleteFileApiCall(String filePath, int fileID) async {
// delete file from minio
var response = await http.delete(
Uri.parse("$baseAPI/minio/delete/file/"),
headers: <String, String>{
"Content-Type": "application/json; charset=UTF-8"
},
body: jsonEncode(<String, dynamic>{"file_path": filePath}),
);
//print("Here4");
//print(response.statusCode);
if (response.statusCode == 200) {
//SQL delete
var response2 = await http.delete(
Uri.parse("$baseAPI/files/delete/"),
headers: <String, String>{
"Content-Type": "application/json; charset=UTF-8"
},
body: jsonEncode(<String, dynamic>{"idpatient_files": fileID}),
);
if (response2.statusCode == 200) {
Navigator.of(context).pop();
Navigator.of(context).pop();
Navigator.of(context)
.pushNamed('/patient-profile', arguments: widget.signedInUser);
setState(() {});
String message =
"The File has been deleted successfully. This means it will no longer be visible on your and cannot be used for future appointments.";
successPopUp(message);
} else {
internetConnectionPopUp();
}
} else {
internetConnectionPopUp();
}
}
void internetConnectionPopUp() {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(errorType: "Internet Connection");
},
);
}
void successPopUp(String message) {
showDialog(
context: context,
builder: (context) {
return MIHSuccessMessage(
successType: "Success",
successMessage: message,
);
},
);
}
void deleteFilePopUp(String filePath, int fileID) {
showDialog(
context: context,
barrierDismissible: false,
builder: (context) => MIHDeleteMessage(
deleteType: "File",
onTap: () {
deleteFileApiCall(filePath, fileID);
},
),
);
}
void viewFilePopUp(String fileName, String filePath, int fileID, String url) {
showDialog(
context: context,
barrierDismissible: false,
builder: (context) => Dialog(
child: Stack(
children: [
Container(
padding: const EdgeInsets.all(10.0),
width: 800.0,
//height: 475.0,
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(
height: 25,
),
Text(
fileName,
textAlign: TextAlign.center,
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 25.0),
Expanded(
child: BuildFileView(
link: url,
path: filePath,
//pdfLink: '${AppEnviroment.baseFileUrl}/mih/$filePath',
)),
SizedBox(
width: 300,
height: 100,
child: MIHButton(
onTap: () {
html.window.open(
url,
// '${AppEnviroment.baseFileUrl}/mih/$filePath',
'download');
},
buttonText: "Dowload",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
)
],
),
),
Positioned(
top: 5,
right: 5,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.close,
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
size: 35,
),
),
),
Positioned(
top: 5,
left: 5,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
deleteFilePopUp(filePath, fileID);
},
icon: Icon(
Icons.delete,
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
),
],
),
),
);
}
@override
Widget build(BuildContext context) {
if (widget.files.isNotEmpty) {
return SizedBox(
height: 290.0,
child: ListView.separated(
shrinkWrap: true,
separatorBuilder: (BuildContext context, int index) {
return Divider(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
);
},
itemCount: widget.files.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(
widget.files[index].file_name,
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
subtitle: Text(
widget.files[index].insert_date,
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
trailing: Icon(
Icons.arrow_forward,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
onTap: () async {
await getFileUrlApiCall(widget.files[index].file_path)
.then((urlHere) {
//print(url);
setState(() {
fileUrl = urlHere;
});
});
viewFilePopUp(
widget.files[index].file_name,
widget.files[index].file_path,
widget.files[index].idpatient_files,
fileUrl);
},
);
},
),
);
} else {
return const SizedBox(
height: 290.0,
child: Center(
child: Text(
"No Files Available",
style: TextStyle(fontSize: 25, color: Colors.grey),
textAlign: TextAlign.center,
),
),
);
}
}
}

View File

@@ -0,0 +1,63 @@
import 'package:flutter/material.dart';
import 'package:patient_manager/main.dart';
import 'package:patient_manager/objects/medicine.dart';
class BuildMedicinesList extends StatefulWidget {
final TextEditingController contoller;
final List<Medicine> medicines;
//final searchString;
const BuildMedicinesList({
super.key,
required this.contoller,
required this.medicines,
//required this.searchString,
});
@override
State<BuildMedicinesList> createState() => _BuildMedicinesListState();
}
class _BuildMedicinesListState extends State<BuildMedicinesList> {
int indexOn = 0;
@override
Widget build(BuildContext context) {
return ListView.separated(
separatorBuilder: (BuildContext context, int index) {
return Divider(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
);
},
itemCount: widget.medicines.length,
itemBuilder: (context, index) {
//final patient = widget.patients[index].id_no.contains(widget.searchString);
return ListTile(
title: Text(
widget.medicines[index].name,
style: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
subtitle: Text(
"${widget.medicines[index].unit} - ${widget.medicines[index].form}",
style: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
onTap: () {
setState(() {
widget.contoller.text =
"${widget.medicines[index].name}%t${widget.medicines[index].unit}%t${widget.medicines[index].form}";
Navigator.of(context).pop();
});
},
trailing: Icon(
Icons.arrow_forward,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
);
},
);
}
}

View File

@@ -0,0 +1,249 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:patient_manager/components/popUpMessages/mihDeleteMessage.dart';
import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart';
import 'package:patient_manager/components/inputsAndButtons/mihMLTextInput.dart';
import 'package:patient_manager/components/popUpMessages/mihSuccessMessage.dart';
import 'package:patient_manager/env/env.dart';
import 'package:patient_manager/main.dart';
import 'package:patient_manager/objects/appUser.dart';
//import 'package:patient_manager/components/mybutton.dart';
import 'package:patient_manager/objects/notes.dart';
import 'package:supertokens_flutter/http.dart' as http;
class BuildNotesList extends StatefulWidget {
final AppUser signedInUser;
final List<Note> notes;
const BuildNotesList({
super.key,
required this.notes,
required this.signedInUser,
});
@override
State<BuildNotesList> createState() => _BuildNotesListState();
}
class _BuildNotesListState extends State<BuildNotesList> {
final noteTextController = TextEditingController();
int indexOn = 0;
final baseAPI = AppEnviroment.baseApiUrl;
Future<void> deleteNoteApiCall(int NoteId) async {
var response = await http.delete(
Uri.parse("$baseAPI/notes/delete/"),
headers: <String, String>{
"Content-Type": "application/json; charset=UTF-8"
},
body: jsonEncode(<String, dynamic>{"idpatient_notes": NoteId}),
);
//print("Here4");
//print(response.statusCode);
if (response.statusCode == 200) {
Navigator.of(context).pop();
Navigator.of(context).pop();
Navigator.of(context)
.pushNamed('/patient-profile', arguments: widget.signedInUser);
setState(() {});
String message =
"The note has been deleted successfully. This means it will no longer be visible on your and cannot be used for future appointments.";
successPopUp(message);
} else {
internetConnectionPopUp();
}
}
void internetConnectionPopUp() {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(errorType: "Internet Connection");
},
);
}
void successPopUp(String message) {
showDialog(
context: context,
builder: (context) {
return MIHSuccessMessage(
successType: "Success",
successMessage: message,
);
},
);
}
void deletePatientPopUp(int NoteId) {
showDialog(
context: context,
barrierDismissible: false,
builder: (context) => MIHDeleteMessage(
deleteType: "Note",
onTap: () {
deleteNoteApiCall(NoteId);
},
),
);
}
void viewNotePopUp(String title, String note, int noteId) {
setState(() {
noteTextController.text = note;
});
showDialog(
context: context,
barrierDismissible: false,
builder: (context) => Dialog(
child: Stack(
children: [
Container(
padding: const EdgeInsets.all(15.0),
width: 700.0,
//height: 475.0,
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0),
),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
const SizedBox(
height: 25,
),
Text(
title,
textAlign: TextAlign.center,
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 25.0),
Expanded(
child: MIHMLTextField(
controller: noteTextController,
hintText: "Note Details",
editable: false,
required: false,
),
),
//const SizedBox(height: 25.0),
// SizedBox(
// width: 300,
// height: 100,
// child: MIHButton(
// onTap: () {
// Navigator.pop(context);
// },
// buttonText: "Close",
// buttonColor: Colors.blueAccent,
// textColor: Colors.white,
// ),
// )
],
),
),
Positioned(
top: 5,
right: 5,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.close,
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
size: 35,
),
),
),
Positioned(
top: 5,
left: 5,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
deletePatientPopUp(noteId);
},
icon: Icon(
Icons.delete,
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
),
],
),
),
);
}
@override
Widget build(BuildContext context) {
if (widget.notes.isNotEmpty) {
return SizedBox(
height: 290.0,
child: ListView.separated(
shrinkWrap: true,
separatorBuilder: (BuildContext context, int index) {
return Divider(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
);
},
itemCount: widget.notes.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(
widget.notes[index].note_name,
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
subtitle: Text(
"${widget.notes[index].insert_date}:\n${widget.notes[index].note_text}",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
), //Text(widget.notes[index].note_text),
trailing: Icon(
Icons.arrow_forward,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
onTap: () {
viewNotePopUp(
widget.notes[index].note_name,
"${widget.notes[index].insert_date}:\n${widget.notes[index].note_text}",
widget.notes[index].idpatient_notes);
},
);
},
),
);
} else {
return const SizedBox(
height: 290.0,
child: Center(
child: Text(
"No Notes Available",
style: TextStyle(fontSize: 25, color: Colors.grey),
textAlign: TextAlign.center,
),
),
);
}
}
}

View File

@@ -0,0 +1,221 @@
import 'package:flutter/material.dart';
import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart';
import 'package:patient_manager/components/inputsAndButtons/mihButton.dart';
import 'package:patient_manager/main.dart';
import 'package:patient_manager/objects/appUser.dart';
import 'package:patient_manager/objects/patients.dart';
class BuildPatientsList extends StatefulWidget {
final List<Patient> patients;
final AppUser signedInUser;
const BuildPatientsList({
super.key,
required this.patients,
required this.signedInUser,
});
@override
State<BuildPatientsList> createState() => _BuildPatientsListState();
}
class _BuildPatientsListState extends State<BuildPatientsList> {
TextEditingController dateController = TextEditingController();
TextEditingController timeController = TextEditingController();
void submitApointment() {}
bool isAppointmentFieldsFilled() {
if (dateController.text.isEmpty || timeController.text.isEmpty) {
return false;
} else {
return true;
}
}
void appointmentPopUp() {
showDialog(
context: context,
barrierDismissible: false,
builder: (context) => Dialog(
child: Stack(
children: [
Container(
padding: const EdgeInsets.all(10.0),
width: 700.0,
//height: 475.0,
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Add Patient to appointment",
textAlign: TextAlign.center,
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 25.0),
SizedBox(
width: 300,
height: 100,
child: MIHButton(
buttonText: "Generate",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
onTap: () {
if (isAppointmentFieldsFilled()) {
submitApointment();
Navigator.pop(context);
} else {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(
errorType: "Input Error");
},
);
}
},
),
)
],
),
),
Positioned(
top: 5,
right: 5,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.close,
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
size: 35,
),
),
),
],
),
),
);
}
Widget isMainMember(int index) {
//var matchRE = RegExp(r'^[a-z]+$');
var firstLetterFName = widget.patients[index].first_name[0];
var firstLetterLName = widget.patients[index].last_name[0];
var fnameStar = '*' * 8;
var lnameStar = '*' * 8;
if (widget.patients[index].medical_aid_main_member == "Yes") {
return Row(
mainAxisSize: MainAxisSize.max,
children: [
Text(
"$firstLetterFName$fnameStar $firstLetterLName$lnameStar",
style: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
const SizedBox(
width: 10,
),
Icon(
Icons.star_border_rounded,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
],
);
} else {
return Text(
"$firstLetterFName$fnameStar $firstLetterLName$lnameStar",
style: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
);
}
}
Widget hasMedicalAid(int index) {
var medAidNoStar = '*' * 8;
if (widget.patients[index].medical_aid == "Yes") {
return ListTile(
title: isMainMember(index),
subtitle: Text(
"ID No.: ${widget.patients[index].id_no}\nMedical Aid No.: $medAidNoStar",
style: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
onTap: () {
setState(() {
// Add popup to add patienmt to queue
// Navigator.of(context).pushNamed('/patient-manager/patient',
// arguments: PatientViewArguments(
// widget.signedInUser, widget.patients[index], "business"));
});
},
trailing: Icon(
Icons.arrow_forward,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
);
} else {
return ListTile(
title: isMainMember(index),
subtitle: Text(
"ID No.: ${widget.patients[index].id_no}\nMedical Aid No.: $medAidNoStar",
style: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
onTap: () {
setState(() {
// Navigator.of(context).pushNamed('/patient-manager/patient',
// arguments: PatientViewArguments(
// widget.signedInUser, widget.patients[index], "business"));
});
},
trailing: Icon(
Icons.arrow_forward,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
);
}
}
@override
Widget build(BuildContext context) {
return ListView.separated(
separatorBuilder: (BuildContext context, index) {
return Divider(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
);
},
itemCount: widget.patients.length,
itemBuilder: (context, index) {
//final patient = widget.patients[index].id_no.contains(widget.searchString);
//print(index);
return hasMedicalAid(index);
},
);
}
}

View File

@@ -0,0 +1,138 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:patient_manager/components/popUpMessages/mihWarningMessage.dart';
import 'package:patient_manager/env/env.dart';
import 'package:patient_manager/main.dart';
import 'package:patient_manager/objects/appUser.dart';
import 'package:patient_manager/objects/arguments.dart';
import 'package:patient_manager/objects/patientQueue.dart';
import 'package:patient_manager/objects/patients.dart';
import 'package:supertokens_flutter/http.dart' as http;
class BuildPatientQueueList extends StatefulWidget {
final List<PatientQueue> patientQueue;
final AppUser signedInUser;
const BuildPatientQueueList({
super.key,
required this.patientQueue,
required this.signedInUser,
});
@override
State<BuildPatientQueueList> createState() => _BuildPatientsListState();
}
class _BuildPatientsListState extends State<BuildPatientQueueList> {
String baseAPI = AppEnviroment.baseApiUrl;
Future<Patient> fetchPatients(String app_id) async {
//print("pat man drawer: " + endpointUserData + widget.userEmail);
var response = await http.get(Uri.parse("$baseAPI/patients/$app_id"));
// print(response.statusCode);
// print(response.body);
if (response.statusCode == 200) {
// print("here");
String body = response.body;
var decodedData = jsonDecode(body);
Patient u = Patient.fromJson(decodedData);
// print(u.email);
//setState(() {
//_widgetOptions = setLayout(u);
//});
return u;
} else {
throw Exception("Error: GetUserData status code ${response.statusCode}");
}
}
Widget displayQueue(int index) {
String fname = widget.patientQueue[index].first_name[0] + "********";
String lname = widget.patientQueue[index].last_name[0] + "********";
String title =
widget.patientQueue[index].date_time.split('T')[1].substring(0, 5);
String subtitle = "";
if (widget.patientQueue[index].access == "pending") {
subtitle +=
"Name: $fname $lname\nID No.: ${widget.patientQueue[index].id_no}\nMedical Aid No: ";
subtitle += "********";
} else {
subtitle +=
"Name: ${widget.patientQueue[index].first_name} ${widget.patientQueue[index].last_name}\nID No.: ${widget.patientQueue[index].id_no}\nMedical Aid No: ";
if (widget.patientQueue[index].medical_aid_no == "") {
subtitle += "No Medical Aid";
} else {
subtitle +=
"Name: $fname $lname\nID No.: ${widget.patientQueue[index].id_no}\nMedical Aid No: ";
subtitle += widget.patientQueue[index].medical_aid_no;
}
}
subtitle +=
"\nAccess Request: ${widget.patientQueue[index].access.toUpperCase()}";
return ListTile(
title: Text(
"Appointment: $title",
style: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
subtitle: Text(
subtitle,
style: TextStyle(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
onTap: () {
if (widget.patientQueue[index].access != "pending") {
Patient selectedPatient;
fetchPatients(widget.patientQueue[index].app_id).then(
(result) {
setState(() {
selectedPatient = result;
Navigator.of(context).pushNamed('/patient-manager/patient',
arguments: PatientViewArguments(
widget.signedInUser, selectedPatient, "business"));
});
},
);
} else {
noAccessWarning();
}
},
trailing: Icon(
Icons.arrow_forward,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
);
}
void noAccessWarning() {
showDialog(
context: context,
builder: (context) {
return const MIHWarningMessage(warningType: "No Access");
},
);
}
@override
Widget build(BuildContext context) {
return ListView.separated(
separatorBuilder: (BuildContext context, index) {
return Divider(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
);
},
itemCount: widget.patientQueue.length,
itemBuilder: (context, index) {
//final patient = widget.patients[index].id_no.contains(widget.searchString);
//print(index);
return displayQueue(index);
},
);
}
}