fix appointment padding and install button

This commit is contained in:
2025-06-06 12:09:26 +02:00
parent 704b50b528
commit efce3ded64
2 changed files with 346 additions and 320 deletions

View File

@@ -71,7 +71,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
} }
} }
Widget displayAppointment(int index) { Widget displayAppointment(int index, double bodyWidth) {
String heading = String heading =
"${widget.appointmentList[index].date_time.split('T')[1].substring(0, 5)} - ${widget.appointmentList[index].title.toUpperCase()}"; "${widget.appointmentList[index].date_time.split('T')[1].substring(0, 5)} - ${widget.appointmentList[index].title.toUpperCase()}";
String description = widget.appointmentList[index].description; String description = widget.appointmentList[index].description;
@@ -102,54 +102,50 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
MzanziInnovationHub.of(context)!.theme.messageTextColor(); MzanziInnovationHub.of(context)!.theme.messageTextColor();
} }
return Padding( return Container(
padding: const EdgeInsets.all(5.0), decoration: BoxDecoration(
child: Container( border: Border.all(
decoration: BoxDecoration( width: 3.0,
border: Border.all( color: appointmentColor,
width: 3.0,
color: appointmentColor,
),
borderRadius: BorderRadius.circular(20)),
child: ListTile(
title: Text(
heading,
style: TextStyle(
color: appointmentColor,
fontWeight: FontWeight.bold,
),
), ),
subtitle: Text( borderRadius: BorderRadius.circular(20)),
description, child: ListTile(
style: TextStyle( title: Text(
color: appointmentColor, heading,
overflow: TextOverflow.ellipsis, style: TextStyle(
), color: appointmentColor,
fontWeight: FontWeight.bold,
), ),
onTap: () {
setState(() {
widget.titleController.text = widget.appointmentList[index].title;
widget.descriptionIDController.text =
widget.appointmentList[index].description;
widget.dateController.text =
widget.appointmentList[index].date_time.split('T')[0];
widget.timeController.text = widget
.appointmentList[index].date_time
.split('T')[1]
.substring(0, 5);
});
if (widget.inWaitingRoom == false) {
appointmentDetailsWindow(index);
} else {
waitingRiinAppointmentDetailsWindow(index);
}
},
), ),
subtitle: Text(
description,
style: TextStyle(
color: appointmentColor,
overflow: TextOverflow.ellipsis,
),
),
onTap: () {
setState(() {
widget.titleController.text = widget.appointmentList[index].title;
widget.descriptionIDController.text =
widget.appointmentList[index].description;
widget.dateController.text =
widget.appointmentList[index].date_time.split('T')[0];
widget.timeController.text = widget.appointmentList[index].date_time
.split('T')[1]
.substring(0, 5);
});
if (widget.inWaitingRoom == false) {
appointmentDetailsWindow(index, bodyWidth);
} else {
waitingRiinAppointmentDetailsWindow(index, bodyWidth);
}
},
), ),
); );
} }
void appointmentDetailsWindow(int index) { void appointmentDetailsWindow(int index, double bodyWidth) {
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
@@ -173,7 +169,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
backgroundColor: backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(), MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () { onTap: () {
appointmentUpdateWindow(index); appointmentUpdateWindow(index, bodyWidth);
}, },
), ),
SpeedDialChild( SpeedDialChild(
@@ -202,66 +198,72 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
widget.titleController.clear(); widget.titleController.clear();
widget.descriptionIDController.clear(); widget.descriptionIDController.clear();
}, },
windowBody: Column( windowBody: Padding(
children: [ padding:
const SizedBox(height: 10), MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
MihTextFormField( ? EdgeInsets.symmetric(horizontal: width * 0.05)
fillColor: : const EdgeInsets.symmetric(horizontal: 0),
MzanziInnovationHub.of(context)!.theme.secondaryColor(), child: Column(
inputColor: children: [
MzanziInnovationHub.of(context)!.theme.primaryColor(), const SizedBox(height: 10),
controller: widget.titleController, MihTextFormField(
multiLineInput: false, fillColor:
requiredText: true, MzanziInnovationHub.of(context)!.theme.secondaryColor(),
readOnly: true, inputColor:
hintText: "Appointment Title", MzanziInnovationHub.of(context)!.theme.primaryColor(),
), controller: widget.titleController,
const SizedBox(height: 10), multiLineInput: false,
MihTextFormField( requiredText: true,
fillColor: readOnly: true,
MzanziInnovationHub.of(context)!.theme.secondaryColor(), hintText: "Appointment Title",
inputColor: ),
MzanziInnovationHub.of(context)!.theme.primaryColor(), const SizedBox(height: 10),
controller: widget.dateController, MihTextFormField(
multiLineInput: false, fillColor:
requiredText: true, MzanziInnovationHub.of(context)!.theme.secondaryColor(),
readOnly: true, inputColor:
hintText: "Date", MzanziInnovationHub.of(context)!.theme.primaryColor(),
), controller: widget.dateController,
const SizedBox(height: 10), multiLineInput: false,
MihTextFormField( requiredText: true,
fillColor: readOnly: true,
MzanziInnovationHub.of(context)!.theme.secondaryColor(), hintText: "Date",
inputColor: ),
MzanziInnovationHub.of(context)!.theme.primaryColor(), const SizedBox(height: 10),
controller: widget.timeController, MihTextFormField(
multiLineInput: false, fillColor:
requiredText: true, MzanziInnovationHub.of(context)!.theme.secondaryColor(),
readOnly: true, inputColor:
hintText: "Time", MzanziInnovationHub.of(context)!.theme.primaryColor(),
), controller: widget.timeController,
const SizedBox(height: 10), multiLineInput: false,
MihTextFormField( requiredText: true,
fillColor: readOnly: true,
MzanziInnovationHub.of(context)!.theme.secondaryColor(), hintText: "Time",
inputColor: ),
MzanziInnovationHub.of(context)!.theme.primaryColor(), const SizedBox(height: 10),
controller: widget.descriptionIDController, MihTextFormField(
multiLineInput: true, fillColor:
height: 250, MzanziInnovationHub.of(context)!.theme.secondaryColor(),
requiredText: true, inputColor:
readOnly: true, MzanziInnovationHub.of(context)!.theme.primaryColor(),
hintText: "Appointment Description", controller: widget.descriptionIDController,
), multiLineInput: true,
const SizedBox(height: 10), height: 250,
], requiredText: true,
readOnly: true,
hintText: "Appointment Description",
),
const SizedBox(height: 10),
],
),
), ),
); );
}, },
); );
} }
void waitingRiinAppointmentDetailsWindow(int index) { void waitingRiinAppointmentDetailsWindow(int index, double bodyWidth) {
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
@@ -285,7 +287,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
backgroundColor: backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(), MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () { onTap: () {
appointmentUpdateWindow(index); appointmentUpdateWindow(index, bodyWidth);
}, },
), ),
SpeedDialChild( SpeedDialChild(
@@ -314,76 +316,82 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
widget.titleController.clear(); widget.titleController.clear();
widget.descriptionIDController.clear(); widget.descriptionIDController.clear();
}, },
windowBody: Column( windowBody: Padding(
children: [ padding:
const SizedBox(height: 10), MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
MihTextFormField( ? EdgeInsets.symmetric(horizontal: width * 0.05)
fillColor: : const EdgeInsets.symmetric(horizontal: 0),
MzanziInnovationHub.of(context)!.theme.secondaryColor(), child: Column(
inputColor: children: [
MzanziInnovationHub.of(context)!.theme.primaryColor(), const SizedBox(height: 10),
controller: widget.titleController, MihTextFormField(
multiLineInput: false, fillColor:
requiredText: true, MzanziInnovationHub.of(context)!.theme.secondaryColor(),
readOnly: true, inputColor:
hintText: "Appointment Title", MzanziInnovationHub.of(context)!.theme.primaryColor(),
), controller: widget.titleController,
const SizedBox(height: 10), multiLineInput: false,
MihTextFormField( requiredText: true,
fillColor: readOnly: true,
MzanziInnovationHub.of(context)!.theme.secondaryColor(), hintText: "Appointment Title",
inputColor: ),
MzanziInnovationHub.of(context)!.theme.primaryColor(), const SizedBox(height: 10),
controller: widget.dateController, MihTextFormField(
multiLineInput: false, fillColor:
requiredText: true, MzanziInnovationHub.of(context)!.theme.secondaryColor(),
readOnly: true, inputColor:
hintText: "Date", MzanziInnovationHub.of(context)!.theme.primaryColor(),
), controller: widget.dateController,
const SizedBox(height: 10), multiLineInput: false,
MihTextFormField( requiredText: true,
fillColor: readOnly: true,
MzanziInnovationHub.of(context)!.theme.secondaryColor(), hintText: "Date",
inputColor: ),
MzanziInnovationHub.of(context)!.theme.primaryColor(), const SizedBox(height: 10),
controller: widget.timeController, MihTextFormField(
multiLineInput: false, fillColor:
requiredText: true, MzanziInnovationHub.of(context)!.theme.secondaryColor(),
readOnly: true, inputColor:
hintText: "Time", MzanziInnovationHub.of(context)!.theme.primaryColor(),
), controller: widget.timeController,
const SizedBox(height: 10), multiLineInput: false,
MihTextFormField( requiredText: true,
fillColor: readOnly: true,
MzanziInnovationHub.of(context)!.theme.secondaryColor(), hintText: "Time",
inputColor: ),
MzanziInnovationHub.of(context)!.theme.primaryColor(), const SizedBox(height: 10),
controller: widget.descriptionIDController, MihTextFormField(
multiLineInput: true, fillColor:
height: 250, MzanziInnovationHub.of(context)!.theme.secondaryColor(),
requiredText: true, inputColor:
readOnly: true, MzanziInnovationHub.of(context)!.theme.primaryColor(),
hintText: "Appointment Description", controller: widget.descriptionIDController,
), multiLineInput: true,
const SizedBox(height: 10), height: 250,
// SizedBox( requiredText: true,
// // width: 500, readOnly: true,
// child: MIHTextField( hintText: "Appointment Description",
// controller: widget.titleController, ),
// hintText: "Patient ID Number", const SizedBox(height: 10),
// editable: false, // SizedBox(
// required: false, // // width: 500,
// ), // child: MIHTextField(
// ), // controller: widget.titleController,
// const SizedBox(height: 10), // hintText: "Patient ID Number",
], // editable: false,
// required: false,
// ),
// ),
// const SizedBox(height: 10),
],
),
), ),
); );
}, },
); );
} }
void appointmentUpdateWindow(int index) { void appointmentUpdateWindow(int index, double bodyWidth) {
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
@@ -405,91 +413,99 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
}); });
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
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: widget.titleController, 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: widget.titleController,
), multiLineInput: false,
const SizedBox(height: 10), requiredText: true,
SizedBox( hintText: "Appointment Title",
// width: 500, validator: (value) {
child: MIHDateField( return MihValidationServices().isEmpty(value);
controller: widget.dateController, },
lableText: "Date",
required: true,
), ),
), const SizedBox(height: 10),
const SizedBox(height: 10), SizedBox(
SizedBox( // width: 500,
// width: 500, child: MIHDateField(
child: MIHTimeField( controller: widget.dateController,
controller: widget.timeController, lableText: "Date",
lableText: "Time", required: true,
required: true, ),
), ),
), const SizedBox(height: 10),
const SizedBox(height: 10), SizedBox(
MihTextFormField( // width: 500,
fillColor: child: MIHTimeField(
MzanziInnovationHub.of(context)!.theme.secondaryColor(), controller: widget.timeController,
inputColor: lableText: "Time",
MzanziInnovationHub.of(context)!.theme.primaryColor(), required: true,
controller: widget.descriptionIDController, ),
multiLineInput: true, ),
height: 250, const SizedBox(height: 10),
requiredText: true, MihTextFormField(
hintText: "Appointment Description", fillColor: MzanziInnovationHub.of(context)!
validator: (value) { .theme
return MihValidationServices().isEmpty(value); .secondaryColor(),
}, inputColor:
), MzanziInnovationHub.of(context)!.theme.primaryColor(),
const SizedBox(height: 20), controller: widget.descriptionIDController,
Center( multiLineInput: true,
child: Wrap( height: 250,
alignment: WrapAlignment.center, requiredText: true,
runSpacing: 10, hintText: "Appointment Description",
spacing: 10, validator: (value) {
children: [ return MihValidationServices().isEmpty(value);
MihButton( },
onPressed: () { ),
if (_formKey.currentState!.validate()) { const SizedBox(height: 20),
updateAppointmentCall(index); Center(
} child: Wrap(
}, alignment: WrapAlignment.center,
buttonColor: MzanziInnovationHub.of(context)! runSpacing: 10,
.theme spacing: 10,
.successColor(), children: [
width: 300, MihButton(
child: Text( onPressed: () {
"Update", if (_formKey.currentState!.validate()) {
style: TextStyle( updateAppointmentCall(index);
color: MzanziInnovationHub.of(context)! }
.theme },
.primaryColor(), buttonColor: MzanziInnovationHub.of(context)!
fontSize: 20, .theme
fontWeight: FontWeight.bold, .successColor(),
width: 300,
child: Text(
"Update",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
), ),
), ),
), ],
], ),
), ),
), ],
], ),
), ],
], ),
), ),
); );
}, },
@@ -624,7 +640,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
shrinkWrap: true, shrinkWrap: true,
itemCount: widget.appointmentList.length, itemCount: widget.appointmentList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return displayAppointment(index); return displayAppointment(index, width);
}, },
), ),
); );

View File

@@ -99,7 +99,7 @@ class _PatientAccessRequestState extends State<Appointments> {
); );
} }
void addAppointmentWindow() { void addAppointmentWindow(double width) {
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
@@ -114,83 +114,92 @@ class _PatientAccessRequestState extends State<Appointments> {
_appointmentTitleController.clear(); _appointmentTitleController.clear();
_appointmentDescriptionIDController.clear(); _appointmentDescriptionIDController.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(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: _appointmentDescriptionIDController,
multiLineInput: true,
height: 250,
requiredText: true,
hintText: "Appointment 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(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: _appointmentDescriptionIDController,
multiLineInput: true,
height: 250,
requiredText: true,
hintText: "Appointment 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,
),
), ),
), ),
), ),
), ],
], ),
), ],
], ),
), ),
); );
}, },
@@ -268,7 +277,7 @@ class _PatientAccessRequestState extends State<Appointments> {
}); });
} }
Widget getBody() { Widget getBody(double width) {
return Stack( return Stack(
children: [ children: [
MihSingleChildScroll( MihSingleChildScroll(
@@ -341,7 +350,7 @@ class _PatientAccessRequestState extends State<Appointments> {
backgroundColor: backgroundColor:
MzanziInnovationHub.of(context)!.theme.successColor(), MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () { onTap: () {
addAppointmentWindow(); addAppointmentWindow(width);
}, },
) )
], ],
@@ -383,9 +392,10 @@ class _PatientAccessRequestState extends State<Appointments> {
@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: getBody(), bodyItem: getBody(screenWidth),
); );
} }
} }