screen fixes 2

dev_v2.8_reverting
Elham Rababh 4 years ago
parent fbb029e320
commit 8eaf834734

@ -23,7 +23,7 @@ class AddVerifyMedicalReport extends StatefulWidget {
final String medicalNote; final String medicalNote;
const AddVerifyMedicalReport( const AddVerifyMedicalReport(
{Key key, {Key? key,
this.patient, this.patient,
this.patientType, this.patientType,
this.arrivalType, this.arrivalType,

@ -36,7 +36,7 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class OperationReportScreen extends StatefulWidget { class OperationReportScreen extends StatefulWidget {
final int visitType; final int visitType;
const OperationReportScreen({Key key, this.visitType}) : super(key: key); const OperationReportScreen({Key? key, this.visitType}) : super(key: key);
@override @override
_ProgressNoteState createState() => _ProgressNoteState(); _ProgressNoteState createState() => _ProgressNoteState();

@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
class OutPatientPrescriptionDetailsItem extends StatefulWidget { class OutPatientPrescriptionDetailsItem extends StatefulWidget {
final PrescriptionReport prescriptionReport; final PrescriptionReport prescriptionReport;
OutPatientPrescriptionDetailsItem({Key key, this.prescriptionReport}); OutPatientPrescriptionDetailsItem({Key? key, this.prescriptionReport});
@override @override
_OutPatientPrescriptionDetailsItemState createState() => _OutPatientPrescriptionDetailsItemState createState() =>

@ -22,7 +22,7 @@ class RadiologyDetailsPage extends StatelessWidget {
final bool isInpatient; final bool isInpatient;
RadiologyDetailsPage( RadiologyDetailsPage(
{Key key, this.finalRadiology, this.patient, this.patientType, this.arrivalType, this.isInpatient = false}); {Key? key, this.finalRadiology, this.patient, this.patientType, this.arrivalType, this.isInpatient = false});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

@ -30,7 +30,7 @@ class AddReplayOnReferralPatient extends StatefulWidget {
final bool isEdited; final bool isEdited;
const AddReplayOnReferralPatient( const AddReplayOnReferralPatient(
{Key key, {Key? key,
this.patientReferralViewModel, this.patientReferralViewModel,
this.myReferralInPatientModel, this.myReferralInPatientModel,
this.isEdited, this.isEdited,

@ -19,7 +19,7 @@ import 'package:flutter/material.dart';
class MyReferralDetailScreen extends StatelessWidget { class MyReferralDetailScreen extends StatelessWidget {
final MyReferralPatientModel? referralPatient; final MyReferralPatientModel? referralPatient;
const MyReferralDetailScreen({Key key, this.referralPatient}) const MyReferralDetailScreen({Key? key, this.referralPatient})
: super(key: key); : super(key: key);
@override @override

@ -7,7 +7,7 @@ class SOAPOpenItems extends StatelessWidget {
final Function onTap; final Function onTap;
final String label; final String label;
const SOAPOpenItems({Key key, this.onTap, this.label}) : super(key: key); const SOAPOpenItems({Key? key, this.onTap, this.label}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return InkWell(

@ -9,7 +9,7 @@ class BottomSheetDialogButton extends StatelessWidget {
double headerHeight = SizeConfig.heightMultiplier * 12; double headerHeight = SizeConfig.heightMultiplier * 12;
BottomSheetDialogButton({Key key, this.onTap, this.label}) : super(key: key); BottomSheetDialogButton({Key? key, this.onTap, this.label}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
class BottomSheetTitle extends StatelessWidget with PreferredSizeWidget { class BottomSheetTitle extends StatelessWidget with PreferredSizeWidget {
BottomSheetTitle({ BottomSheetTitle({
Key key, Key? key,
this.title, this.title,
}) : super(key: key); }) : super(key: key);

@ -14,7 +14,7 @@ class ExpandableSOAPWidget extends StatelessWidget {
final bool isRequired; final bool isRequired;
const ExpandableSOAPWidget( const ExpandableSOAPWidget(
{Key key, this.isExpanded, this.child, this.onTap, this.headerTitle, this.isRequired= true}) {Key? key, this.isExpanded, this.child, this.onTap, this.headerTitle, this.isRequired= true})
: super(key: key); : super(key: key);
@override @override

@ -10,7 +10,7 @@ class RemoveButton extends StatelessWidget {
final VoidCallback? onTap; final VoidCallback? onTap;
final String? label; final String? label;
const RemoveButton({Key key, this.onTap, this.label}) : super(key: key); const RemoveButton({Key? key, this.onTap, this.label}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

@ -17,7 +17,7 @@ import 'add_allergies.dart';
class UpdateAllergiesWidget extends StatefulWidget { class UpdateAllergiesWidget extends StatefulWidget {
List<MySelectedAllergy> myAllergiesList; List<MySelectedAllergy> myAllergiesList;
UpdateAllergiesWidget({Key key, this.myAllergiesList}); UpdateAllergiesWidget({Key? key, this.myAllergiesList});
@override @override
_UpdateAllergiesWidgetState createState() => _UpdateAllergiesWidgetState(); _UpdateAllergiesWidgetState createState() => _UpdateAllergiesWidgetState();

@ -7,7 +7,7 @@ import '../medication/update_medication_widget.dart';
class UpdateChiefComplaints extends StatelessWidget { class UpdateChiefComplaints extends StatelessWidget {
const UpdateChiefComplaints({ const UpdateChiefComplaints({
Key key, Key? key,
@required this.formKey, @required this.formKey,
@required this.complaintsController, @required this.complaintsController,
@required this.illnessController, @required this.illnessController,

@ -9,7 +9,7 @@ class UpdateMedicationWidget extends StatefulWidget {
final TextEditingController medicationController; final TextEditingController medicationController;
UpdateMedicationWidget({ UpdateMedicationWidget({
Key key, Key? key,
this.medicationController, this.medicationController,
}); });

@ -42,22 +42,22 @@ class UpdatePrescriptionForm extends StatefulWidget {
final PrescriptionViewModel model; final PrescriptionViewModel model;
UpdatePrescriptionForm( UpdatePrescriptionForm(
{this.drugName, {required this.drugName,
this.doseStreangth, required this.doseStreangth,
this.drugId, required this.drugId,
this.remarks, required this.remarks,
this.patient, required this.patient,
this.duration, required this.duration,
this.route, required this.route,
this.dose, required this.dose,
this.startDate, required this.startDate,
this.doseUnit, required this.doseUnit,
this.enteredRemarks, required this.enteredRemarks,
this.frequency, required this.frequency,
this.model, required this.model,
this.drugNameGeneric, required this.drugNameGeneric,
this.uom, required this.uom,
this.box}); required this.box});
@override @override
_UpdatePrescriptionFormState createState() => _UpdatePrescriptionFormState(); _UpdatePrescriptionFormState createState() => _UpdatePrescriptionFormState();
} }
@ -66,19 +66,18 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
TextEditingController strengthController = TextEditingController(); TextEditingController strengthController = TextEditingController();
TextEditingController remarksController = TextEditingController(); TextEditingController remarksController = TextEditingController();
int testNum = 0; int testNum = 0;
int strengthChar; late int strengthChar;
PatiantInformtion patient; late PatiantInformtion patient;
dynamic route; dynamic route;
dynamic doseTime; dynamic doseTime;
dynamic frequencyUpdate; dynamic frequencyUpdate;
dynamic updatedDuration; dynamic updatedDuration;
dynamic units; dynamic units;
GetMedicationResponseModel newSelectedMedication; late GetMedicationResponseModel newSelectedMedication;
GlobalKey key = GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>(); late List<dynamic> indicationList;
List<dynamic> indicationList;
dynamic indication; dynamic indication;
DateTime selectedDate; late DateTime selectedDate;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -91,10 +90,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
dynamic indication3 = {"id": 547, "name": "Hypertrichosis"}; dynamic indication3 = {"id": 547, "name": "Hypertrichosis"};
dynamic indication4 = {"id": 548, "name": "Mild Dizziness"}; dynamic indication4 = {"id": 548, "name": "Mild Dizziness"};
dynamic indication5 = {"id": 549, "name": "Enlargement of Facial Features"}; dynamic indication5 = {"id": 549, "name": "Enlargement of Facial Features"};
dynamic indication6 = { dynamic indication6 = {"id": 550, "name": "Phenytoin Hypersensitivity Syndrome"};
"id": 550,
"name": "Phenytoin Hypersensitivity Syndrome"
};
dynamic indication7 = {"id": 551, "name": "Asterixis"}; dynamic indication7 = {"id": 551, "name": "Asterixis"};
dynamic indication8 = {"id": 552, "name": "Bullous Dermatitis"}; dynamic indication8 = {"id": 552, "name": "Bullous Dermatitis"};
dynamic indication9 = {"id": 554, "name": "Purpuric Dermatitis"}; dynamic indication9 = {"id": 554, "name": "Purpuric Dermatitis"};
@ -115,8 +111,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
return StatefulBuilder(builder: return StatefulBuilder(builder: (BuildContext context, StateSetter setState /*You can rename this!*/) {
(BuildContext context, StateSetter setState /*You can rename this!*/) {
return BaseView<MedicineViewModel>( return BaseView<MedicineViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
await model.getMedicationList(); await model.getMedicationList();
@ -127,20 +122,13 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
await model.getMedicationDoseTime(); await model.getMedicationDoseTime();
await model.getItem(itemID: widget.drugId); await model.getItem(itemID: widget.drugId);
//await model.getMedicationIndications(); //await model.getMedicationIndications();
route = model.getLookupByIdFilter( route = model.getLookupByIdFilter(model.itemMedicineListRoute, widget.route);
model.itemMedicineListRoute, widget.route); doseTime = model.getLookupById(model.medicationDoseTimeList, widget.dose);
doseTime = updatedDuration = model.getLookupById(model.medicationDurationList, widget.duration);
model.getLookupById(model.medicationDoseTimeList, widget.dose); units = model.getLookupByIdFilter(model.itemMedicineListUnit, widget.doseUnit);
updatedDuration = model.getLookupById( frequencyUpdate = model.getLookupById(model.medicationFrequencyList, widget.frequency);
model.medicationDurationList, widget.duration);
units = model.getLookupByIdFilter(
model.itemMedicineListUnit, widget.doseUnit);
frequencyUpdate = model.getLookupById(
model.medicationFrequencyList, widget.frequency);
}, },
builder: builder: (BuildContext context, MedicineViewModel model, Widget? child) => NetworkBaseView(
(BuildContext context, MedicineViewModel model, Widget child) =>
NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
@ -150,15 +138,13 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
initialChildSize: 0.98, initialChildSize: 0.98,
maxChildSize: 0.99, maxChildSize: 0.99,
minChildSize: 0.6, minChildSize: 0.6,
builder: builder: (BuildContext context, ScrollController scrollController) {
(BuildContext context, ScrollController scrollController) {
return SingleChildScrollView( return SingleChildScrollView(
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 1.5, height: MediaQuery.of(context).size.height * 1.5,
child: Form( child: Form(
child: Padding( child: Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 12.0),
horizontal: 20.0, vertical: 12.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -244,25 +230,16 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
// height: 12, // height: 12,
// ), // ),
Container( Container(
height: height: MediaQuery.of(context).size.height * 0.060,
MediaQuery.of(context).size.height *
0.060,
width: double.infinity, width: double.infinity,
child: Row( child: Row(
children: [ children: [
Container( Container(
width: MediaQuery.of(context) width: MediaQuery.of(context).size.width * 0.4900,
.size height: MediaQuery.of(context).size.height * 0.55,
.width *
0.4900,
height: MediaQuery.of(context)
.size
.height *
0.55,
child: TextFields( child: TextFields(
inputFormatters: [ inputFormatters: [
LengthLimitingTextInputFormatter( LengthLimitingTextInputFormatter(5),
5),
// WhitelistingTextInputFormatter // WhitelistingTextInputFormatter
// .digitsOnly // .digitsOnly
], ],
@ -270,8 +247,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
hintText: widget.doseStreangth, hintText: widget.doseStreangth,
fontSize: 15.0, fontSize: 15.0,
controller: strengthController, controller: strengthController,
keyboardType: TextInputType keyboardType: TextInputType.numberWithOptions(
.numberWithOptions(
decimal: true, decimal: true,
), ),
onChanged: (String value) { onChanged: (String value) {
@ -279,8 +255,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
strengthChar = value.length; strengthChar = value.length;
}); });
if (strengthChar >= 5) { if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("Only 5 Digits allowed for strength");
"Only 5 Digits allowed for strength");
} }
}, },
// validator: (value) { // validator: (value) {
@ -298,59 +273,34 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
width: 10.0, width: 10.0,
), ),
Container( Container(
width: MediaQuery.of(context) width: MediaQuery.of(context).size.width * 0.3700,
.size
.width *
0.3700,
child: InkWell( child: InkWell(
onTap: onTap: model.itemMedicineListUnit != null
model.itemMedicineListUnit !=
null
? () { ? () {
Helpers.hideKeyboard( Helpers.hideKeyboard(context);
context); ListSelectDialog dialog = ListSelectDialog(
ListSelectDialog list: model.itemMedicineListUnit,
dialog = attributeName: 'description',
ListSelectDialog( attributeValueId: 'parameterCode',
list: model okText: TranslationBase.of(context).ok,
.itemMedicineListUnit, okFunction: (selectedValue) {
attributeName:
'description',
attributeValueId:
'parameterCode',
okText:
TranslationBase.of(
context)
.ok,
okFunction:
(selectedValue) {
setState(() { setState(() {
units = units = selectedValue;
selectedValue;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: barrierDismissible: false,
false,
context: context, context: context,
builder: builder: (BuildContext context) {
(BuildContext
context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
child: TextField( child: TextField(
decoration: decoration: textFieldSelectorDecoration(
textFieldSelectorDecoration( 'UNIT Type', units != null ? units['description'] : null, true),
'UNIT Type',
units != null
? units[
'description']
: null,
true),
enabled: false, enabled: false,
), ),
), ),
@ -362,24 +312,16 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
height: 12, height: 12,
), ),
Container( Container(
height: height: MediaQuery.of(context).size.height * 0.070,
MediaQuery.of(context).size.height *
0.070,
child: InkWell( child: InkWell(
onTap: model.itemMedicineListRoute != onTap: model.itemMedicineListRoute != null
null
? () { ? () {
Helpers.hideKeyboard(context); Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog = ListSelectDialog(
ListSelectDialog( list: model.itemMedicineListRoute,
list: model
.itemMedicineListRoute,
attributeName: 'description', attributeName: 'description',
attributeValueId: attributeValueId: 'parameterCode',
'parameterCode', okText: TranslationBase.of(context).ok,
okText: TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
route = selectedValue; route = selectedValue;
@ -392,21 +334,15 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: builder: (BuildContext context) {
(BuildContext context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
child: TextField( child: TextField(
decoration: decoration: textFieldSelectorDecoration(
textFieldSelectorDecoration( 'Route', route != null ? route['description'] : null, true),
'Route',
route != null
? route['description']
: null,
true),
enabled: false, enabled: false,
), ),
), ),
@ -415,23 +351,16 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
height: 12.0, height: 12.0,
), ),
Container( Container(
height: height: MediaQuery.of(context).size.height * 0.070,
MediaQuery.of(context).size.height *
0.070,
child: InkWell( child: InkWell(
onTap: model.medicationDoseTimeList != onTap: model.medicationDoseTimeList != null
null
? () { ? () {
Helpers.hideKeyboard(context); Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog = ListSelectDialog(
ListSelectDialog( list: model.medicationDoseTimeList,
list: model
.medicationDoseTimeList,
attributeName: 'nameEn', attributeName: 'nameEn',
attributeValueId: 'id', attributeValueId: 'id',
okText: TranslationBase.of( okText: TranslationBase.of(context).ok,
context)
.ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
doseTime = selectedValue; doseTime = selectedValue;
@ -441,22 +370,15 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: builder: (BuildContext context) {
(BuildContext context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
child: TextField( child: TextField(
decoration: decoration: textFieldSelectorDecoration(TranslationBase.of(context).doseTime!,
textFieldSelectorDecoration( doseTime != null ? doseTime['nameEn'] : null, true),
TranslationBase.of(context)
.doseTime,
doseTime != null
? doseTime['nameEn']
: null,
true),
enabled: false, enabled: false,
), ),
), ),
@ -465,49 +387,35 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
height: 12.0, height: 12.0,
), ),
Container( Container(
height: height: MediaQuery.of(context).size.height * 0.070,
MediaQuery.of(context).size.height *
0.070,
child: InkWell( child: InkWell(
onTap: model.medicationFrequencyList != onTap: model.medicationFrequencyList != null
null
? () { ? () {
Helpers.hideKeyboard(context); Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog = ListSelectDialog(
ListSelectDialog( list: model.medicationFrequencyList,
list: model
.medicationFrequencyList,
attributeName: 'nameEn', attributeName: 'nameEn',
attributeValueId: 'id', attributeValueId: 'id',
okText: TranslationBase.of( okText: TranslationBase.of(context).ok,
context)
.ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
frequencyUpdate = frequencyUpdate = selectedValue;
selectedValue;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: builder: (BuildContext context) {
(BuildContext context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
child: TextField( child: TextField(
decoration: decoration: textFieldSelectorDecoration(
textFieldSelectorDecoration( TranslationBase.of(context).frequency!,
TranslationBase.of(context) frequencyUpdate != null ? frequencyUpdate['nameEn'] : null,
.frequency,
frequencyUpdate != null
? frequencyUpdate[
'nameEn']
: null,
true), true),
enabled: false, enabled: false,
), ),
@ -517,50 +425,35 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
height: 12.0, height: 12.0,
), ),
Container( Container(
height: height: MediaQuery.of(context).size.height * 0.070,
MediaQuery.of(context).size.height *
0.070,
child: InkWell( child: InkWell(
onTap: model.medicationDurationList != onTap: model.medicationDurationList != null
null
? () { ? () {
Helpers.hideKeyboard(context); Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog = ListSelectDialog(
ListSelectDialog( list: model.medicationDurationList,
list: model
.medicationDurationList,
attributeName: 'nameEn', attributeName: 'nameEn',
attributeValueId: 'id', attributeValueId: 'id',
okText: TranslationBase.of( okText: TranslationBase.of(context).ok,
context)
.ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
updatedDuration = updatedDuration = selectedValue;
selectedValue;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: builder: (BuildContext context) {
(BuildContext context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
child: TextField( child: TextField(
decoration: decoration: textFieldSelectorDecoration(
textFieldSelectorDecoration( TranslationBase.of(context).duration!,
TranslationBase.of(context) updatedDuration != null ? updatedDuration['nameEn'].toString() : null,
.duration,
updatedDuration != null
? updatedDuration[
'nameEn']
.toString()
: null,
true), true),
enabled: false, enabled: false,
), ),
@ -570,46 +463,26 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
height: 12.0, height: 12.0,
), ),
Container( Container(
height: model.patientAssessmentList height:
.isNotEmpty model.patientAssessmentList.isNotEmpty ? screenSize.height * 0.070 : 0.0,
? screenSize.height * 0.070 width: model.patientAssessmentList.isNotEmpty ? double.infinity : 0.0,
: 0.0, child: model.patientAssessmentList.isNotEmpty
width: model.patientAssessmentList
.isNotEmpty
? double.infinity
: 0.0,
child: model.patientAssessmentList
.isNotEmpty
? Row( ? Row(
children: [ children: [
Container( Container(
width: width: MediaQuery.of(context).size.width * 0.29,
MediaQuery.of(context)
.size
.width *
0.29,
child: InkWell( child: InkWell(
onTap: onTap: indicationList != null
indicationList != null
? () { ? () {
Helpers.hideKeyboard( Helpers.hideKeyboard(context);
context);
} }
: null, : null,
child: TextField( child: TextField(
decoration: textFieldSelectorDecoration( decoration: textFieldSelectorDecoration(
model.patientAssessmentList model.patientAssessmentList.isNotEmpty
.isNotEmpty ? model.patientAssessmentList[0].icdCode10ID.toString()
? model
.patientAssessmentList[
0]
.icdCode10ID
.toString()
: '', : '',
indication != null indication != null ? indication['name'] : null,
? indication[
'name']
: null,
true), true),
enabled: true, enabled: true,
readOnly: true, readOnly: true,
@ -617,34 +490,20 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
), ),
), ),
Container( Container(
width: width: MediaQuery.of(context).size.width * 0.61,
MediaQuery.of(context)
.size
.width *
0.61,
child: InkWell( child: InkWell(
onTap: onTap: indicationList != null
indicationList != null
? () { ? () {
Helpers.hideKeyboard( Helpers.hideKeyboard(context);
context);
} }
: null, : null,
child: TextField( child: TextField(
maxLines: 3, maxLines: 3,
decoration: textFieldSelectorDecoration( decoration: textFieldSelectorDecoration(
model.patientAssessmentList model.patientAssessmentList.isNotEmpty
.isNotEmpty ? model.patientAssessmentList[0].asciiDesc.toString()
? model
.patientAssessmentList[
0]
.asciiDesc
.toString()
: '', : '',
indication != null indication != null ? indication['name'] : null,
? indication[
'name']
: null,
true), true),
enabled: true, enabled: true,
readOnly: true, readOnly: true,
@ -660,14 +519,10 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
Container( Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
child: InkWell( child: InkWell(
onTap: () => onTap: () => selectDate(context, widget.model),
selectDate(context, widget.model),
child: TextField( child: TextField(
decoration: Helpers decoration: Helpers.textFieldSelectorDecoration(
.textFieldSelectorDecoration( AppDateUtils.getDateFormatted(DateTime.parse(widget.startDate)),
AppDateUtils.getDateFormatted(
DateTime.parse(
widget.startDate)),
selectedDate != null selectedDate != null
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null, : null,
@ -689,14 +544,11 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
onTap: model.allMedicationList != null onTap: model.allMedicationList != null
? () { ? () {
Helpers.hideKeyboard(context); Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog = ListSelectDialog(
ListSelectDialog(
list: model.allMedicationList, list: model.allMedicationList,
attributeName: 'nameEn', attributeName: 'nameEn',
attributeValueId: 'id', attributeValueId: 'id',
okText: TranslationBase.of( okText: TranslationBase.of(context).ok,
context)
.ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
// duration = selectedValue; // duration = selectedValue;
@ -706,21 +558,15 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: builder: (BuildContext context) {
(BuildContext context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
child: TextField( child: TextField(
decoration: decoration: textFieldSelectorDecoration(
textFieldSelectorDecoration( "UOM", widget.uom != null ? widget.uom : null, true),
"UOM",
widget.uom != null
? widget.uom
: null,
true),
// enabled: false, // enabled: false,
readOnly: true, readOnly: true,
), ),
@ -732,14 +578,11 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
onTap: model.allMedicationList != null onTap: model.allMedicationList != null
? () { ? () {
Helpers.hideKeyboard(context); Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog = ListSelectDialog(
ListSelectDialog(
list: model.allMedicationList, list: model.allMedicationList,
attributeName: 'nameEn', attributeName: 'nameEn',
attributeValueId: 'id', attributeValueId: 'id',
okText: TranslationBase.of( okText: TranslationBase.of(context).ok,
context)
.ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
// duration = selectedValue; // duration = selectedValue;
@ -749,21 +592,16 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: builder: (BuildContext context) {
(BuildContext context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
child: TextField( child: TextField(
decoration: decoration: textFieldSelectorDecoration(
textFieldSelectorDecoration(
'Box Quantity', 'Box Quantity',
widget.box != null widget.box != null ? "Box Quantity: " + widget.box.toString() : null,
? "Box Quantity: " +
widget.box.toString()
: null,
true), true),
// enabled: false, // enabled: false,
readOnly: true, readOnly: true,
@ -775,11 +613,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
), ),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(Radius.circular(6.0)),
Radius.circular(6.0)), border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields( child: TextFields(
controller: remarksController, controller: remarksController,
maxLines: 7, maxLines: 7,
@ -790,59 +625,39 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
height: 10.0, height: 10.0,
), ),
SizedBox( SizedBox(
height: height: MediaQuery.of(context).size.height * 0.08,
MediaQuery.of(context).size.height *
0.08,
), ),
Container( Container(
margin: EdgeInsets.all( margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2),
SizeConfig.widthMultiplier * 2),
child: Wrap( child: Wrap(
alignment: WrapAlignment.center, alignment: WrapAlignment.center,
children: <Widget>[ children: <Widget>[
AppButton( AppButton(
title: 'update prescription' title: 'update prescription'.toUpperCase(),
.toUpperCase(),
onPressed: () { onPressed: () {
if (double.parse( if (double.parse(strengthController.text) > 1000.0) {
strengthController.text) > DrAppToastMsg.showErrorToast("1000 is the MAX for the strength");
1000.0) {
DrAppToastMsg.showErrorToast(
"1000 is the MAX for the strength");
return; return;
} }
if (double.parse( if (double.parse(strengthController.text) == 0.0) {
strengthController DrAppToastMsg.showErrorToast("strength can't be zero");
.text) ==
0.0) {
DrAppToastMsg.showErrorToast(
"strength can't be zero");
return; return;
} }
if (strengthController if (strengthController.text.length > 4) {
.text.length > DrAppToastMsg.showErrorToast("strength can't be more then 4 digits ");
4) {
DrAppToastMsg.showErrorToast(
"strength can't be more then 4 digits ");
return; return;
} }
// if(units==null&& updatedDuration==null&&frequencyUpdate==null&&) // if(units==null&& updatedDuration==null&&frequencyUpdate==null&&)
updatePrescription( updatePrescription(
newStartDate: selectedDate, newStartDate: selectedDate,
newDoseStreangth: newDoseStreangth: strengthController.text.isNotEmpty
strengthController ? strengthController.text
.text.isNotEmpty : widget.doseStreangth,
? strengthController
.text
: widget
.doseStreangth,
newUnit: units != null newUnit: units != null
? units['parameterCode'] ? units['parameterCode'].toString()
.toString()
: widget.doseUnit, : widget.doseUnit,
doseUnit: widget.doseUnit, doseUnit: widget.doseUnit,
doseStreangth: doseStreangth: widget.doseStreangth,
widget.doseStreangth,
duration: widget.duration, duration: widget.duration,
startDate: widget.startDate, startDate: widget.startDate,
doseId: widget.dose, doseId: widget.dose,
@ -850,30 +665,18 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
routeId: widget.route, routeId: widget.route,
patient: widget.patient, patient: widget.patient,
model: widget.model, model: widget.model,
newDuration: newDuration: updatedDuration != null
updatedDuration != null ? updatedDuration['id'].toString()
? updatedDuration['id']
.toString()
: widget.duration, : widget.duration,
drugId: widget.drugId, drugId: widget.drugId,
remarks: remarksController remarks: remarksController.text,
.text, route:
route: route != null route != null ? route['parameterCode'].toString() : widget.route,
? route['parameterCode'] frequency: frequencyUpdate != null
.toString() ? frequencyUpdate['id'].toString()
: widget.route,
frequency:
frequencyUpdate != null
? frequencyUpdate[
'id']
.toString()
: widget.frequency, : widget.frequency,
dose: doseTime != null dose: doseTime != null ? doseTime['id'].toString() : widget.dose,
? doseTime['id'] enteredRemarks: widget.enteredRemarks);
.toString()
: widget.dose,
enteredRemarks:
widget.enteredRemarks);
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
@ -898,7 +701,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
Helpers.hideKeyboard(context); Helpers.hideKeyboard(context);
DateTime selectedDate; DateTime selectedDate;
selectedDate = DateTime.now(); selectedDate = DateTime.now();
final DateTime picked = await showDatePicker( final DateTime? picked = await showDatePicker(
context: context, context: context,
initialDate: selectedDate, initialDate: selectedDate,
firstDate: DateTime.now(), firstDate: DateTime.now(),
@ -912,9 +715,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
} }
} }
InputDecoration textFieldSelectorDecoration( InputDecoration textFieldSelectorDecoration(String hintText, String? selectedText, bool isDropDown,
String hintText, String selectedText, bool isDropDown, {Icon? suffixIcon}) {
{Icon suffixIcon}) {
return InputDecoration( return InputDecoration(
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
@ -945,29 +747,28 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
} }
updatePrescription( updatePrescription(
{PrescriptionViewModel model, {required PrescriptionViewModel model,
int drugId, required int drugId,
String newDrugId, String? newDrugId,
String frequencyId, required String frequencyId,
String remarks, required String remarks,
String dose, required String dose,
String doseId, required String doseId,
String frequency, required String frequency,
String route, required String route,
String routeId, required String routeId,
String startDate, required String startDate,
DateTime newStartDate, required DateTime newStartDate,
String doseUnit, required String doseUnit,
String doseStreangth, required String doseStreangth,
String newDoseStreangth, required String newDoseStreangth,
String duration, required String duration,
String newDuration, required String newDuration,
String newUnit, required String newUnit,
String enteredRemarks, required String enteredRemarks,
PatiantInformtion patient}) async { required PatiantInformtion patient}) async {
//PrescriptionViewModel model = PrescriptionViewModel(); //PrescriptionViewModel model = PrescriptionViewModel();
PostPrescriptionReqModel updatePrescriptionReqModel = PostPrescriptionReqModel updatePrescriptionReqModel = new PostPrescriptionReqModel();
new PostPrescriptionReqModel();
List<PrescriptionRequestModel> sss = []; List<PrescriptionRequestModel> sss = [];
updatePrescriptionReqModel.appointmentNo = patient.appointmentNo; updatePrescriptionReqModel.appointmentNo = patient.appointmentNo;
@ -977,31 +778,22 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
sss.add(PrescriptionRequestModel( sss.add(PrescriptionRequestModel(
covered: true, covered: true,
dose: newDoseStreangth.isNotEmpty dose: newDoseStreangth.isNotEmpty ? double.parse(newDoseStreangth) : double.parse(doseStreangth),
? double.parse(newDoseStreangth)
: double.parse(doseStreangth),
//frequency.isNotEmpty ? int.parse(dose) : 1, //frequency.isNotEmpty ? int.parse(dose) : 1,
itemId: drugId, itemId: drugId,
doseUnitId: doseUnitId: newUnit.isNotEmpty ? int.parse(newUnit) : int.parse(doseUnit),
newUnit.isNotEmpty ? int.parse(newUnit) : int.parse(doseUnit),
route: route.isNotEmpty ? int.parse(route) : int.parse(routeId), route: route.isNotEmpty ? int.parse(route) : int.parse(routeId),
frequency: frequency.isNotEmpty frequency: frequency.isNotEmpty ? int.parse(frequency) : int.parse(frequencyId),
? int.parse(frequency)
: int.parse(frequencyId),
remarks: remarks.isEmpty ? enteredRemarks : remarks, remarks: remarks.isEmpty ? enteredRemarks : remarks,
approvalRequired: true, approvalRequired: true,
icdcode10Id: "test2", icdcode10Id: "test2",
doseTime: dose.isNotEmpty ? int.parse(dose) : int.parse(doseId), doseTime: dose.isNotEmpty ? int.parse(dose) : int.parse(doseId),
duration: newDuration.isNotEmpty duration: newDuration.isNotEmpty ? int.parse(newDuration) : int.parse(duration),
? int.parse(newDuration) doseStartDate: newStartDate != null ? newStartDate.toIso8601String() : startDate));
: int.parse(duration),
doseStartDate:
newStartDate != null ? newStartDate.toIso8601String() : startDate));
updatePrescriptionReqModel.prescriptionRequestModel = sss; updatePrescriptionReqModel.prescriptionRequestModel = sss;
//postProcedureReqModel.procedures = controlsProcedure; //postProcedureReqModel.procedures = controlsProcedure;
await model.updatePrescription( await model.updatePrescription(updatePrescriptionReqModel, patient.patientMRN!);
updatePrescriptionReqModel, patient.patientMRN);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
@ -1013,22 +805,22 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
void updatePrescriptionForm( void updatePrescriptionForm(
{context, {context,
String drugName, required String drugName,
String drugNameGeneric, required String drugNameGeneric,
int drugId, required int drugId,
String remarks, required String remarks,
PrescriptionViewModel model, required PrescriptionViewModel model,
PatiantInformtion patient, required PatiantInformtion patient,
String rouat, required String rouat,
String frequency, required String frequency,
String dose, required String dose,
String duration, required String duration,
String doseStreangth, required String doseStreangth,
String doseUnit, required String doseUnit,
String enteredRemarks, required String enteredRemarks,
String uom, required String uom,
int box, required int box,
String startDate}) { required String startDate}) {
TextEditingController remarksController = TextEditingController(); TextEditingController remarksController = TextEditingController();
TextEditingController doseController = TextEditingController(); TextEditingController doseController = TextEditingController();
TextEditingController frequencyController = TextEditingController(); TextEditingController frequencyController = TextEditingController();

Loading…
Cancel
Save