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;
const AddVerifyMedicalReport(
{Key key,
{Key? key,
this.patient,
this.patientType,
this.arrivalType,

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

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

@ -22,7 +22,7 @@ class RadiologyDetailsPage extends StatelessWidget {
final bool isInpatient;
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
Widget build(BuildContext context) {

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

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

@ -7,7 +7,7 @@ class SOAPOpenItems extends StatelessWidget {
final Function onTap;
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
Widget build(BuildContext context) {
return InkWell(

@ -9,7 +9,7 @@ class BottomSheetDialogButton extends StatelessWidget {
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
Widget build(BuildContext context) {

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

@ -14,7 +14,7 @@ class ExpandableSOAPWidget extends StatelessWidget {
final bool isRequired;
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);
@override

@ -10,7 +10,7 @@ class RemoveButton extends StatelessWidget {
final VoidCallback? onTap;
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
Widget build(BuildContext context) {

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

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

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

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

Loading…
Cancel
Save