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 firstLetterFName = widget.patientAccesses[index].fname;
var firstLetterLName = widget.patientAccesses[index].lname; var firstLetterLName = widget.patientAccesses[index].lname;
setState(() { setState(() {
idController.text = widget.patientAccesses[index].id_no; idController.text = widget.patientAccesses[index].id_no;
fnameController.text = firstLetterFName; fnameController.text = firstLetterFName;
@@ -97,104 +96,111 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
onWindowTapClose: () { onWindowTapClose: () {
Navigator.pop(context); Navigator.pop(context);
}, },
windowBody: Column( windowBody: Padding(
children: [ padding:
MihForm( MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
formKey: _formKey, ? EdgeInsets.symmetric(horizontal: width * 0.056)
formFields: [ : const EdgeInsets.symmetric(horizontal: 0),
MihTextFormField( child: Column(
fillColor: children: [
MzanziInnovationHub.of(context)!.theme.secondaryColor(), MihForm(
inputColor: formKey: _formKey,
MzanziInnovationHub.of(context)!.theme.primaryColor(), formFields: [
controller: idController, MihTextFormField(
multiLineInput: false, fillColor:
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(), MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300, inputColor:
child: Text( MzanziInnovationHub.of(context)!.theme.primaryColor(),
"Book Appointment", controller: idController,
style: TextStyle( multiLineInput: false,
color: MzanziInnovationHub.of(context)! requiredText: true,
.theme readOnly: true,
.primaryColor(), hintText: "ID No.",
fontSize: 20, validator: (value) {
fontWeight: FontWeight.bold, 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; 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 firstLetterFName = widget.patientAccesses[index].fname;
var firstLetterLName = widget.patientAccesses[index].lname; var firstLetterLName = widget.patientAccesses[index].lname;
setState(() { setState(() {
idController.text = widget.patientAccesses[index].id_no; idController.text = widget.patientAccesses[index].id_no;
fnameController.text = firstLetterFName; fnameController.text = firstLetterFName;
@@ -247,109 +253,119 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
onWindowTapClose: () { onWindowTapClose: () {
Navigator.pop(context); Navigator.pop(context);
}, },
windowBody: Column( windowBody: Padding(
children: [ padding:
MihTextFormField( MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
fillColor: ? EdgeInsets.symmetric(horizontal: width * 0.05)
MzanziInnovationHub.of(context)!.theme.secondaryColor(), : const EdgeInsets.symmetric(horizontal: 0),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), child: Column(
controller: idController, children: [
multiLineInput: false, MihTextFormField(
requiredText: true, fillColor:
readOnly: true, MzanziInnovationHub.of(context)!.theme.secondaryColor(),
hintText: "ID No.", inputColor:
validator: (value) { MzanziInnovationHub.of(context)!.theme.primaryColor(),
return MihValidationServices().isEmpty(value); controller: idController,
}, multiLineInput: false,
), requiredText: true,
const SizedBox(height: 10.0), readOnly: true,
MihTextFormField( hintText: "ID No.",
fillColor: validator: (value) {
MzanziInnovationHub.of(context)!.theme.secondaryColor(), return MihValidationServices().isEmpty(value);
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,
),
),
),
],
), ),
) 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 firstName = "";
var lastName = ""; var lastName = "";
String access = widget.patientAccesses[index].status.toUpperCase(); String access = widget.patientAccesses[index].status.toUpperCase();
@@ -407,7 +423,7 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
p = result; p = result;
}); });
}); });
patientProfileChoicePopUp(index, p); patientProfileChoicePopUp(index, p, width);
} else { } else {
noAccessWarning(index); noAccessWarning(index);
} }
@@ -431,6 +447,7 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return ListView.separated( return ListView.separated(
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
@@ -441,7 +458,7 @@ class _BuildPatientsListState extends State<BuildMyPatientListList> {
}, },
itemCount: widget.patientAccesses.length, itemCount: widget.patientAccesses.length,
itemBuilder: (context, index) { 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>(); final _formKey = GlobalKey<FormState>();
// Business Appointment Tool // Business Appointment Tool
Widget getBusinessAppointmentsTool() { Widget getBusinessAppointmentsTool(double width) {
return Stack( return Stack(
children: [ children: [
MihSingleChildScroll( MihSingleChildScroll(
@@ -139,7 +139,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
MzanziInnovationHub.of(context)!.theme.successColor(), MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () { onTap: () {
// addAppointmentWindow(); // 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?"; String question = "What type of appointment would you like to add?";
question += question +=
"\n\nExisting Patient: Add an appointment for an patient your practice has access to."; "\n\nExisting Patient: Add an appointment for an patient your practice has access to.";
@@ -276,7 +276,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
MihButton( MihButton(
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
addAppointmentWindow(); addAppointmentWindow(width);
}, },
buttonColor: buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(), MzanziInnovationHub.of(context)!.theme.secondaryColor(),
@@ -298,7 +298,7 @@ class _WaitingRoomState extends State<WaitingRoom> {
); );
} }
void addAppointmentWindow() { void addAppointmentWindow(double width) {
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
@@ -314,83 +314,92 @@ class _WaitingRoomState extends State<WaitingRoom> {
_appointmentDescriptionIDController.clear(); _appointmentDescriptionIDController.clear();
_patientController.clear(); _patientController.clear();
}, },
windowBody: Column( windowBody: Padding(
children: [ padding:
MihForm( MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
formKey: _formKey, ? EdgeInsets.symmetric(horizontal: width * 0.05)
formFields: [ : const EdgeInsets.symmetric(horizontal: 0),
MihTextFormField( child: Column(
fillColor: children: [
MzanziInnovationHub.of(context)!.theme.secondaryColor(), MihForm(
inputColor: formKey: _formKey,
MzanziInnovationHub.of(context)!.theme.primaryColor(), formFields: [
controller: _appointmentTitleController, MihTextFormField(
multiLineInput: false, fillColor: MzanziInnovationHub.of(context)!
requiredText: true, .theme
hintText: "Appointment Title", .secondaryColor(),
validator: (value) { inputColor:
return MihValidationServices().isEmpty(value); MzanziInnovationHub.of(context)!.theme.primaryColor(),
}, controller: _appointmentTitleController,
), multiLineInput: false,
const SizedBox(height: 10), requiredText: true,
SizedBox( hintText: "Appointment Title",
// width: 500, validator: (value) {
child: MIHDateField( return MihValidationServices().isEmpty(value);
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(), const SizedBox(height: 10),
width: 300, SizedBox(
child: Text( // width: 500,
"Add", child: MIHDateField(
style: TextStyle( controller: _appointmentDateController,
color: MzanziInnovationHub.of(context)! lableText: "Date",
.theme required: true,
.primaryColor(), ),
fontSize: 20, ),
fontWeight: FontWeight.bold, 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MihPackageToolBody( return MihPackageToolBody(
borderOn: false, borderOn: false,
bodyItem: getBusinessAppointmentsTool(), bodyItem: getBusinessAppointmentsTool(screenWidth),
); );
} }
} }