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,9 +102,7 @@ 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),
child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
width: 3.0, width: 3.0,
@@ -133,23 +131,21 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
widget.appointmentList[index].description; widget.appointmentList[index].description;
widget.dateController.text = widget.dateController.text =
widget.appointmentList[index].date_time.split('T')[0]; widget.appointmentList[index].date_time.split('T')[0];
widget.timeController.text = widget widget.timeController.text = widget.appointmentList[index].date_time
.appointmentList[index].date_time
.split('T')[1] .split('T')[1]
.substring(0, 5); .substring(0, 5);
}); });
if (widget.inWaitingRoom == false) { if (widget.inWaitingRoom == false) {
appointmentDetailsWindow(index); appointmentDetailsWindow(index, bodyWidth);
} else { } else {
waitingRiinAppointmentDetailsWindow(index); 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,7 +198,12 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
widget.titleController.clear(); widget.titleController.clear();
widget.descriptionIDController.clear(); widget.descriptionIDController.clear();
}, },
windowBody: Column( windowBody: Padding(
padding:
MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.05)
: const EdgeInsets.symmetric(horizontal: 0),
child: Column(
children: [ children: [
const SizedBox(height: 10), const SizedBox(height: 10),
MihTextFormField( MihTextFormField(
@@ -256,12 +257,13 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
const SizedBox(height: 10), 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,7 +316,12 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
widget.titleController.clear(); widget.titleController.clear();
widget.descriptionIDController.clear(); widget.descriptionIDController.clear();
}, },
windowBody: Column( windowBody: Padding(
padding:
MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.05)
: const EdgeInsets.symmetric(horizontal: 0),
child: Column(
children: [ children: [
const SizedBox(height: 10), const SizedBox(height: 10),
MihTextFormField( MihTextFormField(
@@ -378,12 +385,13 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
// const SizedBox(height: 10), // 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,14 +413,20 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
}); });
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
windowBody: Column( windowBody: Padding(
padding:
MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.05)
: const EdgeInsets.symmetric(horizontal: 0),
child: Column(
children: [ children: [
MihForm( MihForm(
formKey: _formKey, formKey: _formKey,
formFields: [ formFields: [
MihTextFormField( MihTextFormField(
fillColor: fillColor: MzanziInnovationHub.of(context)!
MzanziInnovationHub.of(context)!.theme.secondaryColor(), .theme
.secondaryColor(),
inputColor: inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(), MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: widget.titleController, controller: widget.titleController,
@@ -443,8 +457,9 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
MihTextFormField( MihTextFormField(
fillColor: fillColor: MzanziInnovationHub.of(context)!
MzanziInnovationHub.of(context)!.theme.secondaryColor(), .theme
.secondaryColor(),
inputColor: inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(), MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: widget.descriptionIDController, controller: widget.descriptionIDController,
@@ -491,6 +506,7 @@ class _BuildAppointmentListState extends State<BuildAppointmentList> {
), ),
], ],
), ),
),
); );
}, },
); );
@@ -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,14 +114,20 @@ class _PatientAccessRequestState extends State<Appointments> {
_appointmentTitleController.clear(); _appointmentTitleController.clear();
_appointmentDescriptionIDController.clear(); _appointmentDescriptionIDController.clear();
}, },
windowBody: Column( windowBody: Padding(
padding:
MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.05)
: const EdgeInsets.symmetric(horizontal: 0),
child: Column(
children: [ children: [
MihForm( MihForm(
formKey: _formKey, formKey: _formKey,
formFields: [ formFields: [
MihTextFormField( MihTextFormField(
fillColor: fillColor: MzanziInnovationHub.of(context)!
MzanziInnovationHub.of(context)!.theme.secondaryColor(), .theme
.secondaryColor(),
inputColor: inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(), MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: _appointmentTitleController, controller: _appointmentTitleController,
@@ -152,8 +158,9 @@ class _PatientAccessRequestState extends State<Appointments> {
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
MihTextFormField( MihTextFormField(
fillColor: fillColor: MzanziInnovationHub.of(context)!
MzanziInnovationHub.of(context)!.theme.secondaryColor(), .theme
.secondaryColor(),
inputColor: inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(), MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: _appointmentDescriptionIDController, controller: _appointmentDescriptionIDController,
@@ -173,8 +180,9 @@ class _PatientAccessRequestState extends State<Appointments> {
addAppointmentCall(); addAppointmentCall();
} }
}, },
buttonColor: buttonColor: MzanziInnovationHub.of(context)!
MzanziInnovationHub.of(context)!.theme.successColor(), .theme
.successColor(),
width: 300, width: 300,
child: Text( child: Text(
"Add", "Add",
@@ -192,6 +200,7 @@ class _PatientAccessRequestState extends State<Appointments> {
), ),
], ],
), ),
),
); );
}, },
); );
@@ -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),
); );
} }
} }