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:flutter/material.dart';
import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_text_input.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_delete_message.dart';
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_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'; import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_multiline_text_input.dart';
@@ -129,78 +130,51 @@ class _BuildNotesListState extends State<BuildNotesList> {
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) => Dialog( builder: (context) => MIHWindow(
child: Stack( fullscreen: true,
children: [ windowTitle: selectednote.note_name,
Container( windowTools: [
padding: const EdgeInsets.all(15.0), IconButton(
width: 700.0, onPressed: () {
//height: 475.0, deletePatientPopUp(selectednote.idpatient_notes);
decoration: BoxDecoration( },
color: MzanziInnovationHub.of(context)!.theme.primaryColor(), icon: Icon(
borderRadius: BorderRadius.circular(25.0), Icons.delete,
border: Border.all( color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
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( onWindowTapClose: () {
width: 700, Navigator.pop(context);
child: MIHTextField( },
windowBody: [
MIHTextField(
controller: businessNameController, controller: businessNameController,
hintText: "Office", hintText: "Office",
editable: false, editable: false,
required: false, required: false,
), ),
),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
SizedBox( MIHTextField(
width: 700,
child: MIHTextField(
controller: userNameController, controller: userNameController,
hintText: "Created By", hintText: "Created By",
editable: false, editable: false,
required: false, required: false,
), ),
),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
SizedBox( MIHTextField(
width: 700,
child: MIHTextField(
controller: dateController, controller: dateController,
hintText: "Created Date", hintText: "Created Date",
editable: false, editable: false,
required: false, required: false,
), ),
),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
SizedBox( MIHTextField(
width: 700,
child: MIHTextField(
controller: noteTitleController, controller: noteTitleController,
hintText: "Note Title", hintText: "Note Title",
editable: false, editable: false,
required: false, required: false,
), ),
),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
Expanded( Expanded(
child: MIHMLTextField( child: MIHMLTextField(
@@ -210,58 +184,145 @@ class _BuildNotesListState extends State<BuildNotesList> {
required: 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(),
),
),
),
],
),
),
); );
// 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 @override

View File

@@ -1,6 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/material.dart'; 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_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_loading_circle.dart';
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart';
@@ -143,80 +144,46 @@ class _PatientNotesState extends State<PatientNotes> {
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (context) => Dialog( builder: (context) => MIHWindow(
child: Stack( fullscreen: false,
children: [ windowTitle: "Add Note",
Container( windowTools: const [],
padding: const EdgeInsets.all(10.0), onWindowTapClose: () {
width: 700.0, Navigator.pop(context);
//height: 500.0, titleController.clear();
decoration: BoxDecoration( noteTextController.clear();
color: MzanziInnovationHub.of(context)!.theme.primaryColor(), },
borderRadius: BorderRadius.circular(25.0), windowBody: [
border: Border.all( MIHTextField(
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, controller: officeController,
hintText: "Office", hintText: "Office",
editable: false, editable: false,
required: true, required: true,
), ),
),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
SizedBox( MIHTextField(
width: 700,
child: MIHTextField(
controller: doctorController, controller: doctorController,
hintText: "Created By", hintText: "Created By",
editable: false, editable: false,
required: true, required: true,
), ),
),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
SizedBox( MIHTextField(
width: 700,
child: MIHTextField(
controller: dateController, controller: dateController,
hintText: "Created Date", hintText: "Created Date",
editable: false, editable: false,
required: true, required: true,
), ),
),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
SizedBox( MIHTextField(
width: 700,
child: MIHTextField(
controller: titleController, controller: titleController,
hintText: "Note Title", hintText: "Note Title",
editable: true, editable: true,
required: true, required: true,
), ),
),
const SizedBox(height: 10.0), const SizedBox(height: 10.0),
SizedBox( SizedBox(
width: 700, //width: 700,
height: 250, height: 250,
child: MIHMLTextField( child: MIHMLTextField(
controller: noteTextController, controller: noteTextController,
@@ -225,7 +192,7 @@ class _PatientNotesState extends State<PatientNotes> {
required: true, required: true,
), ),
), ),
const SizedBox(height: 30.0), const SizedBox(height: 15.0),
SizedBox( SizedBox(
width: 300, width: 300,
height: 50, height: 50,
@@ -238,47 +205,160 @@ class _PatientNotesState extends State<PatientNotes> {
showDialog( showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
return const MIHErrorMessage( return const MIHErrorMessage(errorType: "Input Error");
errorType: "Input Error");
}, },
); );
} }
}, },
buttonText: "Add Note", buttonText: "Add Note",
buttonColor: MzanziInnovationHub.of(context)! buttonColor:
.theme MzanziInnovationHub.of(context)!.theme.secondaryColor(),
.secondaryColor(), textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
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,
),
),
),
],
),
),
); );
// 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() { bool isFieldsFilled() {