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, //height: 325,
child: Column( child: Column(
children: [ children: [
const SizedBox(height: 50.0), //const SizedBox(height: 50.0),
SizedBox( SizedBox(
width: 700, width: 700,
child: MIHDateField( child: MIHDateField(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -263,54 +263,58 @@ class _PatientFilesState extends State<PatientFiles> {
MzanziInnovationHub.of(context)!.theme.secondaryColor(), MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0), width: 5.0),
), ),
child: Column( child: SingleChildScrollView(
mainAxisSize: MainAxisSize.min, padding: const EdgeInsets.symmetric(horizontal: 10),
children: [ child: Column(
Text( mainAxisSize: MainAxisSize.min,
"Create Medical Certificate", children: [
textAlign: TextAlign.center, Text(
style: TextStyle( "Create Medical Certificate",
color: MzanziInnovationHub.of(context)! textAlign: TextAlign.center,
.theme style: TextStyle(
.secondaryColor(), color: MzanziInnovationHub.of(context)!
fontSize: 35.0, .theme
fontWeight: FontWeight.bold, .secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
),
), ),
), const SizedBox(height: 25.0),
const SizedBox(height: 25.0), Medcertinput(
Medcertinput( startDateController: startDateController,
startDateController: startDateController, endDateTextController: endDateTextController,
endDateTextController: endDateTextController, retDateTextController: retDateTextController,
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: 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( Positioned(
@@ -354,37 +358,40 @@ class _PatientFilesState extends State<PatientFiles> {
MzanziInnovationHub.of(context)!.theme.secondaryColor(), MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0), width: 5.0),
), ),
child: Column( child: SingleChildScrollView(
crossAxisAlignment: CrossAxisAlignment.center, padding: const EdgeInsets.symmetric(horizontal: 10),
mainAxisAlignment: MainAxisAlignment.center, child: Column(
mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center,
children: [ mainAxisAlignment: MainAxisAlignment.center,
Text( mainAxisSize: MainAxisSize.min,
"Create Perscription", children: [
textAlign: TextAlign.center, Text(
style: TextStyle( "Create Perscription",
color: MzanziInnovationHub.of(context)! textAlign: TextAlign.center,
.theme style: TextStyle(
.secondaryColor(), color: MzanziInnovationHub.of(context)!
fontSize: 35.0, .theme
fontWeight: FontWeight.bold, .secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
),
), ),
), //const SizedBox(height: 25.0),
const SizedBox(height: 25.0), PrescripInput(
PrescripInput( medicineController: medicineController,
medicineController: medicineController, quantityController: quantityController,
quantityController: quantityController, dosageController: dosageController,
dosageController: dosageController, timesDailyController: timesDailyController,
timesDailyController: timesDailyController, noDaysController: noDaysController,
noDaysController: noDaysController, noRepeatsController: noRepeatsController,
noRepeatsController: noRepeatsController, outputController: outputController,
outputController: outputController, selectedPatient: widget.selectedPatient,
selectedPatient: widget.selectedPatient, signedInUser: widget.signedInUser,
signedInUser: widget.signedInUser, business: widget.business,
business: widget.business, businessUser: widget.businessUser,
businessUser: widget.businessUser, ),
), ],
], ),
), ),
), ),
Positioned( Positioned(

View File

@@ -158,97 +158,103 @@ class _PatientNotesState extends State<PatientNotes> {
MzanziInnovationHub.of(context)!.theme.secondaryColor(), MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0), width: 5.0),
), ),
child: Column( child: SingleChildScrollView(
//mainAxisSize: MainAxisSize.max, padding: const EdgeInsets.symmetric(horizontal: 10),
children: [ child: Column(
Text( mainAxisSize: MainAxisSize.min,
"Add Note", children: [
textAlign: TextAlign.center, Text(
style: TextStyle( "Add Note",
color: MzanziInnovationHub.of(context)! textAlign: TextAlign.center,
.theme style: TextStyle(
.secondaryColor(), color: MzanziInnovationHub.of(context)!
fontSize: 35.0, .theme
fontWeight: FontWeight.bold, .secondaryColor(),
fontSize: 35.0,
fontWeight: FontWeight.bold,
),
), ),
), const SizedBox(height: 25.0),
const SizedBox(height: 25.0), SizedBox(
SizedBox( width: 700,
width: 700, child: MIHTextField(
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(
SizedBox( width: 700,
width: 700, child: MIHTextField(
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(
SizedBox( width: 700,
width: 700, child: MIHTextField(
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(
SizedBox( width: 700,
width: 700, child: MIHTextField(
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(
Expanded( width: 700,
child: MIHMLTextField( height: 250,
controller: noteTextController, child: MIHMLTextField(
hintText: "Note Details", controller: noteTextController,
editable: true, hintText: "Note Details",
required: true, editable: true,
required: true,
),
), ),
), const SizedBox(height: 30.0),
const SizedBox(height: 30.0), SizedBox(
SizedBox( width: 300,
width: 300, height: 50,
height: 50, child: MIHButton(
child: MIHButton( onTap: () {
onTap: () { if (isFieldsFilled()) {
if (isFieldsFilled()) { addPatientNoteAPICall();
addPatientNoteAPICall(); Navigator.pop(context);
Navigator.pop(context); } else {
} else { 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: MzanziInnovationHub.of(context)! .theme
.theme .secondaryColor(),
.secondaryColor(), textColor: MzanziInnovationHub.of(context)!
textColor: .theme
MzanziInnovationHub.of(context)!.theme.primaryColor(), .primaryColor(),
), ),
) )
], ],
),
), ),
), ),
Positioned( Positioned(

View File

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