Add and view note window enhancement

This commit is contained in:
2024-09-27 13:08:48 +02:00
parent fb615d9c3f
commit c3298877e1
2 changed files with 401 additions and 260 deletions

View File

@@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_text_input.dart';
import 'package:patient_manager/mih_components/mih_layout/mih_window.dart';
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_delete_message.dart';
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart';
import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_multiline_text_input.dart';
@@ -129,139 +130,199 @@ class _BuildNotesListState extends State<BuildNotesList> {
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(
selectednote.note_name,
textAlign: TextAlign.center,
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 25.0),
SizedBox(
width: 700,
child: MIHTextField(
controller: businessNameController,
hintText: "Office",
editable: false,
required: false,
),
),
const SizedBox(height: 10.0),
SizedBox(
width: 700,
child: MIHTextField(
controller: userNameController,
hintText: "Created By",
editable: false,
required: false,
),
),
const SizedBox(height: 10.0),
SizedBox(
width: 700,
child: MIHTextField(
controller: dateController,
hintText: "Created Date",
editable: false,
required: false,
),
),
const SizedBox(height: 10.0),
SizedBox(
width: 700,
child: MIHTextField(
controller: noteTitleController,
hintText: "Note Title",
editable: false,
required: false,
),
),
const SizedBox(height: 10.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,
// ),
// )
],
),
builder: (context) => MIHWindow(
fullscreen: true,
windowTitle: selectednote.note_name,
windowTools: [
IconButton(
onPressed: () {
deletePatientPopUp(selectednote.idpatient_notes);
},
icon: Icon(
Icons.delete,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
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,
),
),
),
],
onWindowTapClose: () {
Navigator.pop(context);
},
windowBody: [
MIHTextField(
controller: businessNameController,
hintText: "Office",
editable: false,
required: false,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: userNameController,
hintText: "Created By",
editable: false,
required: false,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: dateController,
hintText: "Created Date",
editable: false,
required: false,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: noteTitleController,
hintText: "Note Title",
editable: false,
required: false,
),
const SizedBox(height: 10.0),
Expanded(
child: MIHMLTextField(
controller: noteTextController,
hintText: "Note Details",
editable: false,
required: false,
),
Positioned(
top: 5,
left: 5,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
deletePatientPopUp(selectednote.idpatient_notes);
},
icon: Icon(
Icons.delete,
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
),
],
),
),
],
),
);
// 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(
// selectednote.note_name,
// textAlign: TextAlign.center,
// style: TextStyle(
// color: MzanziInnovationHub.of(context)!
// .theme
// .secondaryColor(),
// fontSize: 35.0,
// fontWeight: FontWeight.bold,
// ),
// ),
// const SizedBox(height: 25.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: businessNameController,
// hintText: "Office",
// editable: false,
// required: false,
// ),
// ),
// const SizedBox(height: 10.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: userNameController,
// hintText: "Created By",
// editable: false,
// required: false,
// ),
// ),
// const SizedBox(height: 10.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: dateController,
// hintText: "Created Date",
// editable: false,
// required: false,
// ),
// ),
// const SizedBox(height: 10.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: noteTitleController,
// hintText: "Note Title",
// editable: false,
// required: false,
// ),
// ),
// const SizedBox(height: 10.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(selectednote.idpatient_notes);
// },
// icon: Icon(
// Icons.delete,
// color:
// MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// ),
// ),
// ),
// ],
// ),
// ),
// );
}
@override

View File

@@ -1,6 +1,7 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:patient_manager/mih_components/mih_layout/mih_window.dart';
import 'package:patient_manager/mih_packages/patient_profile/builder/build_notes_list.dart';
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart';
@@ -143,142 +144,221 @@ class _PatientNotesState extends State<PatientNotes> {
showDialog(
context: context,
barrierDismissible: false,
builder: (context) => Dialog(
child: Stack(
children: [
Container(
padding: const EdgeInsets.all(10.0),
width: 700.0,
//height: 500.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: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Add Note",
textAlign: TextAlign.center,
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 25.0),
SizedBox(
width: 700,
child: MIHTextField(
controller: officeController,
hintText: "Office",
editable: false,
required: true,
),
),
const SizedBox(height: 10.0),
SizedBox(
width: 700,
child: MIHTextField(
controller: doctorController,
hintText: "Created By",
editable: false,
required: true,
),
),
const SizedBox(height: 10.0),
SizedBox(
width: 700,
child: MIHTextField(
controller: dateController,
hintText: "Created Date",
editable: false,
required: true,
),
),
const SizedBox(height: 10.0),
SizedBox(
width: 700,
child: MIHTextField(
controller: titleController,
hintText: "Note Title",
editable: true,
required: true,
),
),
const SizedBox(height: 10.0),
SizedBox(
width: 700,
height: 250,
child: MIHMLTextField(
controller: noteTextController,
hintText: "Note Details",
editable: true,
required: true,
),
),
const SizedBox(height: 30.0),
SizedBox(
width: 300,
height: 50,
child: MIHButton(
onTap: () {
if (isFieldsFilled()) {
addPatientNoteAPICall();
Navigator.pop(context);
} else {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(
errorType: "Input Error");
},
);
}
},
buttonText: "Add Note",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
),
)
],
),
),
builder: (context) => MIHWindow(
fullscreen: false,
windowTitle: "Add Note",
windowTools: const [],
onWindowTapClose: () {
Navigator.pop(context);
titleController.clear();
noteTextController.clear();
},
windowBody: [
MIHTextField(
controller: officeController,
hintText: "Office",
editable: false,
required: true,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: doctorController,
hintText: "Created By",
editable: false,
required: true,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: dateController,
hintText: "Created Date",
editable: false,
required: true,
),
const SizedBox(height: 10.0),
MIHTextField(
controller: titleController,
hintText: "Note Title",
editable: true,
required: true,
),
const SizedBox(height: 10.0),
SizedBox(
//width: 700,
height: 250,
child: MIHMLTextField(
controller: noteTextController,
hintText: "Note Details",
editable: true,
required: true,
),
Positioned(
top: 5,
right: 5,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
),
const SizedBox(height: 15.0),
SizedBox(
width: 300,
height: 50,
child: MIHButton(
onTap: () {
if (isFieldsFilled()) {
addPatientNoteAPICall();
Navigator.pop(context);
titleController.clear();
noteTextController.clear();
},
icon: Icon(
Icons.close,
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
size: 35,
),
),
} else {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(errorType: "Input Error");
},
);
}
},
buttonText: "Add Note",
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
],
),
)
],
),
);
// showDialog(
// context: context,
// barrierDismissible: false,
// builder: (context) => Dialog(
// child: Stack(
// children: [
// Container(
// padding: const EdgeInsets.all(10.0),
// width: 700.0,
// //height: 500.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: SingleChildScrollView(
// padding: const EdgeInsets.symmetric(horizontal: 10),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Text(
// "Add Note",
// textAlign: TextAlign.center,
// style: TextStyle(
// color: MzanziInnovationHub.of(context)!
// .theme
// .secondaryColor(),
// fontSize: 35.0,
// fontWeight: FontWeight.bold,
// ),
// ),
// const SizedBox(height: 25.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: officeController,
// hintText: "Office",
// editable: false,
// required: true,
// ),
// ),
// const SizedBox(height: 10.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: doctorController,
// hintText: "Created By",
// editable: false,
// required: true,
// ),
// ),
// const SizedBox(height: 10.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: dateController,
// hintText: "Created Date",
// editable: false,
// required: true,
// ),
// ),
// const SizedBox(height: 10.0),
// SizedBox(
// width: 700,
// child: MIHTextField(
// controller: titleController,
// hintText: "Note Title",
// editable: true,
// required: true,
// ),
// ),
// const SizedBox(height: 10.0),
// SizedBox(
// width: 700,
// height: 250,
// child: MIHMLTextField(
// controller: noteTextController,
// hintText: "Note Details",
// editable: true,
// required: true,
// ),
// ),
// const SizedBox(height: 30.0),
// SizedBox(
// width: 300,
// height: 50,
// child: MIHButton(
// onTap: () {
// if (isFieldsFilled()) {
// addPatientNoteAPICall();
// Navigator.pop(context);
// } else {
// showDialog(
// context: context,
// builder: (context) {
// return const MIHErrorMessage(
// errorType: "Input Error");
// },
// );
// }
// },
// buttonText: "Add Note",
// 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);
// titleController.clear();
// noteTextController.clear();
// },
// icon: Icon(
// Icons.close,
// color: MzanziInnovationHub.of(context)!.theme.errorColor(),
// size: 35,
// ),
// ),
// ),
// ],
// ),
// ),
// );
}
bool isFieldsFilled() {