Fix pop up windows with input. make more dynamic

This commit is contained in:
2024-09-19 10:56:57 +02:00
parent 7f2367a9ce
commit 7111ad3600
10 changed files with 271 additions and 230 deletions

View File

@@ -28,7 +28,7 @@ class _MedcertinputState extends State<Medcertinput> {
//height: 325,
child: Column(
children: [
const SizedBox(height: 50.0),
//const SizedBox(height: 50.0),
SizedBox(
width: 700,
child: MIHDateField(

View File

@@ -80,55 +80,61 @@ class _MedicineSearchState extends State<MedicineSearch> {
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Select Medicine",
textAlign: TextAlign.center,
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Select Medicine",
textAlign: TextAlign.center,
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 25.0),
FutureBuilder(
future: futueMeds,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const SizedBox(
height: 400,
child: Mihloadingcircle(),
);
} else if (snapshot.hasData && snapshot.data!.isNotEmpty) {
final medsList = snapshot.data!;
return SizedBox(
height: 400,
child: BuildMedicinesList(
contoller: widget.searchVlaue,
medicines: medsList,
//searchString: searchString,
),
);
} else {
return const SizedBox(
height: 400,
child: Center(
child: Text(
"No Match Found\nPlease close and manually capture medicine",
style: TextStyle(fontSize: 25, color: Colors.grey),
textAlign: TextAlign.center,
const SizedBox(height: 25.0),
FutureBuilder(
future: futueMeds,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const SizedBox(
height: 400,
child: Mihloadingcircle(),
);
} else if (snapshot.hasData &&
snapshot.data!.isNotEmpty) {
final medsList = snapshot.data!;
return SizedBox(
height: 400,
child: BuildMedicinesList(
contoller: widget.searchVlaue,
medicines: medsList,
//searchString: searchString,
),
),
);
}
},
),
],
);
} else {
return const SizedBox(
height: 400,
child: Center(
child: Text(
"No Match Found\nPlease close and manually capture medicine",
style:
TextStyle(fontSize: 25, color: Colors.grey),
textAlign: TextAlign.center,
),
),
);
}
},
),
],
),
),
),
Positioned(

View File

@@ -17,7 +17,25 @@ class MIHBody extends StatefulWidget {
class _MIHBodyState extends State<MIHBody> {
//double paddingSize = 10;
double getPaddingSize() {
double getHorizontalPaddingSize(Size screenSize) {
if (MzanziInnovationHub.of(context)!.theme.screenType == "desktop") {
if (widget.borderOn) {
return 10;
} else {
return 0;
}
} else {
// mobile
if (widget.borderOn) {
return 10;
} else {
return 0;
}
}
}
double getVerticalPaddingSize(Size screenSize) {
// mobile
if (widget.borderOn) {
return 10;
} else {
@@ -54,9 +72,9 @@ class _MIHBodyState extends State<MIHBody> {
Size screenSize = MediaQuery.sizeOf(context);
return Padding(
padding: EdgeInsets.only(
left: getPaddingSize(),
right: getPaddingSize(),
bottom: getPaddingSize(),
left: getHorizontalPaddingSize(screenSize),
right: getHorizontalPaddingSize(screenSize),
bottom: getVerticalPaddingSize(screenSize),
top: 0,
),
child: Container(
@@ -64,7 +82,7 @@ class _MIHBodyState extends State<MIHBody> {
left: 10,
right: 10,
bottom: 10,
top: getPaddingSize(),
top: getVerticalPaddingSize(screenSize),
),
width: screenSize.width,
height: screenSize.height,

View File

@@ -40,19 +40,21 @@ class _MIHLayoutBuilderState extends State<MIHLayoutBuilder> {
Widget build(BuildContext context) {
Size screenSize = MediaQuery.sizeOf(context);
return Scaffold(
body: SizedBox(
width: screenSize.width,
height: screenSize.height,
child: Stack(
children: [
widget.actionButton,
Column(
children: [
widget.header,
Expanded(child: widget.body),
],
),
],
body: SafeArea(
child: SizedBox(
width: screenSize.width,
height: screenSize.height,
child: Stack(
children: [
widget.actionButton,
Column(
children: [
widget.header,
Expanded(child: widget.body),
],
),
],
),
),
),
);

View File

@@ -155,7 +155,7 @@ class _BuildEmployeeListState extends State<BuildEmployeeList> {
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0),
),
child: Padding(
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
mainAxisSize: MainAxisSize.min,

View File

@@ -130,7 +130,7 @@ class _BuildUserListState extends State<BuildUserList> {
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0),
),
child: Padding(
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
mainAxisSize: MainAxisSize.min,

View File

@@ -144,7 +144,7 @@ class _BuildPatientsListState extends State<BuildPatientsList> {
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0),
),
child: Padding(
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
mainAxisSize: MainAxisSize.min,

View File

@@ -263,54 +263,58 @@ class _PatientFilesState extends State<PatientFiles> {
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Create Medical Certificate",
textAlign: TextAlign.center,
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Create Medical Certificate",
textAlign: TextAlign.center,
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 25.0),
Medcertinput(
startDateController: startDateController,
endDateTextController: endDateTextController,
retDateTextController: retDateTextController,
),
const SizedBox(height: 30.0),
SizedBox(
width: 300,
height: 50,
child: MIHButton(
buttonText: "Generate",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
onTap: () async {
if (isMedCertFieldsFilled()) {
await generateMedCert();
//Navigator.pop(context);
} else {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(
errorType: "Input Error");
},
);
}
},
const SizedBox(height: 25.0),
Medcertinput(
startDateController: startDateController,
endDateTextController: endDateTextController,
retDateTextController: retDateTextController,
),
)
],
const SizedBox(height: 30.0),
SizedBox(
width: 300,
height: 50,
child: MIHButton(
buttonText: "Generate",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
onTap: () async {
if (isMedCertFieldsFilled()) {
await generateMedCert();
//Navigator.pop(context);
} else {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(
errorType: "Input Error");
},
);
}
},
),
)
],
),
),
),
Positioned(
@@ -354,37 +358,40 @@ class _PatientFilesState extends State<PatientFiles> {
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Create Perscription",
textAlign: TextAlign.center,
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Create Perscription",
textAlign: TextAlign.center,
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 25.0),
PrescripInput(
medicineController: medicineController,
quantityController: quantityController,
dosageController: dosageController,
timesDailyController: timesDailyController,
noDaysController: noDaysController,
noRepeatsController: noRepeatsController,
outputController: outputController,
selectedPatient: widget.selectedPatient,
signedInUser: widget.signedInUser,
business: widget.business,
businessUser: widget.businessUser,
),
],
//const SizedBox(height: 25.0),
PrescripInput(
medicineController: medicineController,
quantityController: quantityController,
dosageController: dosageController,
timesDailyController: timesDailyController,
noDaysController: noDaysController,
noRepeatsController: noRepeatsController,
outputController: outputController,
selectedPatient: widget.selectedPatient,
signedInUser: widget.signedInUser,
business: widget.business,
businessUser: widget.businessUser,
),
],
),
),
),
Positioned(

View File

@@ -158,97 +158,103 @@ class _PatientNotesState extends State<PatientNotes> {
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0),
),
child: Column(
//mainAxisSize: MainAxisSize.max,
children: [
Text(
"Add Note",
textAlign: TextAlign.center,
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
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: 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: 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: 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,
child: MIHTextField(
controller: titleController,
hintText: "Note Title",
editable: true,
required: true,
),
),
),
const SizedBox(height: 10.0),
Expanded(
child: MIHMLTextField(
controller: noteTextController,
hintText: "Note Details",
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(),
),
)
],
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(

View File

@@ -344,6 +344,8 @@ class _PrescripInputState extends State<PrescripInput> {
Widget displayMedInput() {
return Column(
children: [
const SizedBox(height: 25.0),
KeyboardListener(
focusNode: _focusNode,
autofocus: true,