fix pat man padding

This commit is contained in:
2025-06-06 13:15:47 +02:00
parent 2db045cc2e
commit 52bf4ed1b6
2 changed files with 303 additions and 276 deletions

View File

@@ -79,10 +79,9 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
}
}
void appointmentPopUp(int index) {
void appointmentPopUp(int index, double width) {
var firstLetterFName = widget.patientAccesses[index].fname;
var firstLetterLName = widget.patientAccesses[index].lname;
setState(() {
idController.text = widget.patientAccesses[index].id_no;
fnameController.text = firstLetterFName;
@@ -97,104 +96,111 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
onWindowTapClose: () {
Navigator.pop(context);
},
windowBody: Column(
children: [
MihForm(
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: idController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "ID No.",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: fnameController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "First Name",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: lnameController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Surname",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MIHDateField(
controller: dateController,
lableText: "Date",
required: true,
),
const SizedBox(height: 10.0),
MIHTimeField(
controller: timeController,
lableText: "Time",
required: true,
),
const SizedBox(height: 30.0),
Center(
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
bool filled = isAppointmentFieldsFilled();
if (filled) {
submitApointment(index);
} else {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(
errorType: "Input Error");
},
);
}
}
},
buttonColor:
windowBody: Padding(
padding:
MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.056)
: const EdgeInsets.symmetric(horizontal: 0),
child: Column(
children: [
MihForm(
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Book Appointment",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: idController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "ID No.",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: fnameController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "First Name",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: lnameController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Surname",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MIHDateField(
controller: dateController,
lableText: "Date",
required: true,
),
const SizedBox(height: 10.0),
MIHTimeField(
controller: timeController,
lableText: "Time",
required: true,
),
const SizedBox(height: 30.0),
Center(
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
bool filled = isAppointmentFieldsFilled();
if (filled) {
submitApointment(index);
} else {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(
errorType: "Input Error");
},
);
}
}
},
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
width: 300,
child: Text(
"Book Appointment",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
),
),
],
),
],
],
),
],
),
),
),
);
@@ -229,10 +235,10 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
return hasAccess;
}
void patientProfileChoicePopUp(int index, Patient? patientProfile) async {
void patientProfileChoicePopUp(
int index, Patient? patientProfile, double width) async {
var firstLetterFName = widget.patientAccesses[index].fname;
var firstLetterLName = widget.patientAccesses[index].lname;
setState(() {
idController.text = widget.patientAccesses[index].id_no;
fnameController.text = firstLetterFName;
@@ -247,109 +253,119 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
onWindowTapClose: () {
Navigator.pop(context);
},
windowBody: Column(
children: [
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: idController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "ID No.",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: fnameController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "First Name",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: lnameController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Surname",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 30.0),
Center(
child: Wrap(
runSpacing: 10,
spacing: 10,
children: [
MihButton(
onPressed: () {
appointmentPopUp(index);
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Book Appointment",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
MihButton(
onPressed: () {
Navigator.of(context)
.pushNamed('/patient-manager/patient',
arguments: PatientViewArguments(
widget.signedInUser,
patientProfile,
widget.businessUser,
widget.business,
"business",
));
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
width: 300,
child: Text(
"View Medical Records",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
windowBody: Padding(
padding:
MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.05)
: const EdgeInsets.symmetric(horizontal: 0),
child: Column(
children: [
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: idController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "ID No.",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
)
],
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: fnameController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "First Name",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: lnameController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Surname",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 30.0),
Center(
child: Wrap(
runSpacing: 10,
spacing: 10,
children: [
MihButton(
onPressed: () {
appointmentPopUp(index, width);
},
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
width: 300,
child: Text(
"Book Appointment",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
MihButton(
onPressed: () {
Navigator.of(context)
.pushNamed('/patient-manager/patient',
arguments: PatientViewArguments(
widget.signedInUser,
patientProfile,
widget.businessUser,
widget.business,
"business",
));
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
width: 300,
child: Text(
"View Medical Records",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
),
)
],
),
),
),
);
}
Widget displayMyPatientTile(int index) {
Widget displayMyPatientTile(int index, double width) {
var firstName = "";
var lastName = "";
String access = widget.patientAccesses[index].status.toUpperCase();
@@ -407,7 +423,7 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
p = result;
});
});
patientProfileChoicePopUp(index, p);
patientProfileChoicePopUp(index, p, width);
} else {
noAccessWarning(index);
}
@@ -431,6 +447,7 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
@override
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
@@ -441,7 +458,7 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
},
itemCount: widget.patientAccesses.length,
itemBuilder: (context, index) {
return displayMyPatientTile(index);
return displayMyPatientTile(index, screenWidth);
},
);
}

View File

@@ -63,7 +63,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
final _formKey = GlobalKey<FormState>();
// Business Appointment Tool
Widget getBusinessAppointmentsTool() {
Widget getBusinessAppointmentsTool(double width) {
return Stack(
children: [
MihSingleChildScroll(
@@ -139,7 +139,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
// addAppointmentWindow();
appointmentTypeSelection();
appointmentTypeSelection(width);
},
)
],
@@ -205,7 +205,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
);
}
void appointmentTypeSelection() {
void appointmentTypeSelection(double width) {
String question = "What type of appointment would you like to add?";
question +=
"\n\nExisting Patient: Add an appointment for an patient your practice has access to.";
@@ -276,7 +276,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
MihButton(
onPressed: () {
Navigator.pop(context);
addAppointmentWindow();
addAppointmentWindow(width);
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
@@ -298,7 +298,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
);
}
void addAppointmentWindow() {
void addAppointmentWindow(double width) {
showDialog(
context: context,
barrierDismissible: false,
@@ -314,83 +314,92 @@ class _WaitingRoomState extends State<WaitingRoom> {
_appointmentDescriptionIDController.clear();
_patientController.clear();
},
windowBody: Column(
children: [
MihForm(
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: _appointmentTitleController,
multiLineInput: false,
requiredText: true,
hintText: "Appointment Title",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10),
SizedBox(
// width: 500,
child: MIHDateField(
controller: _appointmentDateController,
lableText: "Date",
required: true,
),
),
const SizedBox(height: 10),
SizedBox(
// width: 500,
child: MIHTimeField(
controller: _appointmentTimeController,
lableText: "Time",
required: true,
),
),
const SizedBox(height: 10),
MihTextFormField(
height: 250,
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: _appointmentDescriptionIDController,
multiLineInput: true,
requiredText: true,
hintText: "Description",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 20),
Center(
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
addAppointmentCall();
}
windowBody: Padding(
padding:
MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.05)
: const EdgeInsets.symmetric(horizontal: 0),
child: Column(
children: [
MihForm(
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: _appointmentTitleController,
multiLineInput: false,
requiredText: true,
hintText: "Appointment Title",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.successColor(),
width: 300,
child: Text(
"Add",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
const SizedBox(height: 10),
SizedBox(
// width: 500,
child: MIHDateField(
controller: _appointmentDateController,
lableText: "Date",
required: true,
),
),
const SizedBox(height: 10),
SizedBox(
// width: 500,
child: MIHTimeField(
controller: _appointmentTimeController,
lableText: "Time",
required: true,
),
),
const SizedBox(height: 10),
MihTextFormField(
height: 250,
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: _appointmentDescriptionIDController,
multiLineInput: true,
requiredText: true,
hintText: "Description",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 20),
Center(
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
addAppointmentCall();
}
},
buttonColor: MzanziInnovationHub.of(context)!
.theme
.successColor(),
width: 300,
child: Text(
"Add",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
),
),
],
),
],
],
),
],
),
),
);
},
@@ -477,9 +486,10 @@ class _WaitingRoomState extends State<WaitingRoom> {
@override
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MihPackageToolBody(
borderOn: false,
bodyItem: getBusinessAppointmentsTool(),
bodyItem: getBusinessAppointmentsTool(screenWidth),
);
}
}