Merge branch 'done_button_keyboard' into 'development'

add done button in all pages user keyboard and hide the keyboard when the user click on background

See merge request Cloud_Solution/doctor_app_flutter!306
merge-requests/307/merge
Mohammad Aljammal 5 years ago
commit fb721d534f

@ -292,4 +292,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69
COCOAPODS: 1.10.0.rc.1 COCOAPODS: 1.10.1

@ -46,6 +46,10 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
bool isFormSubmitted = false; bool isFormSubmitted = false;
FocusNode _nodeText1 = FocusNode();
FocusNode _nodeText2 = FocusNode();
FocusNode _nodeText3 = FocusNode();
var _patientSearchFormValues = PatientModel( var _patientSearchFormValues = PatientModel(
FirstName: "0", FirstName: "0",
MiddleName: "0", MiddleName: "0",
@ -110,374 +114,383 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectsProvider = Provider.of(context); projectsProvider = Provider.of(context);
return AppScaffold( return GestureDetector(
appBarTitle: TranslationBase.of(context).searchPatient, onTap: (){
body: ListView( FocusScope.of(context).requestFocus(new FocusNode());
children: <Widget>[ },
RoundedContainer( child: AppScaffold(
child: Column( appBarTitle: TranslationBase.of(context).searchPatient,
children: <Widget>[ body: ListView(
Column( children: <Widget>[
children: <Widget>[ RoundedContainer(
Container( child: Column(
child: Icon( children: <Widget>[
DoctorApp.search_patient_1, Column(
size: 100, children: <Widget>[
color: Colors.black, Container(
), child: Icon(
margin: EdgeInsets.only(top: 10), DoctorApp.search_patient_1,
), size: 100,
Padding( color: Colors.black,
padding: const EdgeInsets.only(top: 12.0), ),
child: AppText( margin: EdgeInsets.only(top: 10),
TranslationBase.of(context)
.searchPatientImageCaptionTitle
.toUpperCase(),
fontWeight: FontWeight.bold,
fontSize: SizeConfig.heightMultiplier * 2.5,
), ),
), Padding(
Padding( padding: const EdgeInsets.only(top: 12.0),
padding: const EdgeInsets.only(top: 5.0), child: AppText(
child: AppText( TranslationBase.of(context)
TranslationBase.of(context) .searchPatientImageCaptionTitle
.searchPatientImageCaptionBody, .toUpperCase(),
fontSize: SizeConfig.heightMultiplier * 2, fontWeight: FontWeight.bold,
fontSize: SizeConfig.heightMultiplier * 2.5,
),
), ),
) Padding(
], padding: const EdgeInsets.only(top: 5.0),
), child: AppText(
Container( TranslationBase.of(context)
padding: EdgeInsets.all(15), .searchPatientImageCaptionBody,
width: SizeConfig.screenWidth * 1, fontSize: SizeConfig.heightMultiplier * 2,
child: Form(
key: _formKey,
autovalidate: _autoValidate,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 5,
), ),
Container( )
height: 40.0, ],
decoration: ShapeDecoration( ),
shape: RoundedRectangleBorder( Container(
side: BorderSide( padding: EdgeInsets.all(15),
width: 1.0, width: SizeConfig.screenWidth * 1,
style: BorderStyle.solid, child: Form(
color: HexColor("#CCCCCC")), key: _formKey,
borderRadius: autovalidate: _autoValidate,
BorderRadius.all(Radius.circular(6.0)), child: Column(
), crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 5,
), ),
width: double.infinity, Container(
child: Padding( height: 40.0,
padding: EdgeInsets.only( decoration: ShapeDecoration(
top: SizeConfig.widthMultiplier * 0.9, shape: RoundedRectangleBorder(
bottom: SizeConfig.widthMultiplier * 0.9, side: BorderSide(
right: SizeConfig.widthMultiplier * 3, width: 1.0,
left: SizeConfig.widthMultiplier * 3), style: BorderStyle.solid,
child: Row( color: HexColor("#CCCCCC")),
mainAxisSize: MainAxisSize.max, borderRadius:
children: <Widget>[ BorderRadius.all(Radius.circular(6.0)),
Expanded( ),
// add Expanded to have your dropdown button fill remaining space ),
child: DropdownButtonHideUnderline( width: double.infinity,
child: DropdownButton( child: Padding(
isExpanded: true, padding: EdgeInsets.only(
value: _selectedType, top: SizeConfig.widthMultiplier * 0.9,
iconSize: 25, bottom: SizeConfig.widthMultiplier * 0.9,
elevation: 16, right: SizeConfig.widthMultiplier * 3,
selectedItemBuilder: left: SizeConfig.widthMultiplier * 3),
(BuildContext context) { child: Row(
return PATIENT_TYPE.map((item) { mainAxisSize: MainAxisSize.max,
return Row( children: <Widget>[
mainAxisSize: MainAxisSize.max, Expanded(
children: <Widget>[ // add Expanded to have your dropdown button fill remaining space
!projectsProvider.isArabic child: DropdownButtonHideUnderline(
? AppText( child: DropdownButton(
item['text'], isExpanded: true,
fontSize: SizeConfig value: _selectedType,
.textMultiplier * iconSize: 25,
2.1, elevation: 16,
) selectedItemBuilder:
: AppText( (BuildContext context) {
item['text_ar'], return PATIENT_TYPE.map((item) {
fontSize: SizeConfig return Row(
.textMultiplier * mainAxisSize: MainAxisSize.max,
2.1, children: <Widget>[
), !projectsProvider.isArabic
], ? AppText(
item['text'],
fontSize: SizeConfig
.textMultiplier *
2.1,
)
: AppText(
item['text_ar'],
fontSize: SizeConfig
.textMultiplier *
2.1,
),
],
);
}).toList();
},
onChanged: (String newValue) => {
setState(() {
_selectedType = newValue;
selectedPatientType =
int.parse(_selectedType);
})
},
items: PATIENT_TYPE.map((item) {
!projectsProvider.isArabic
? itemText = item['text']
: itemText = item['text_ar'];
return DropdownMenuItem(
child: Text(
itemText,
textAlign: TextAlign.end,
),
value: item['val'],
); );
}).toList(); }).toList(),
}, )),
onChanged: (String newValue) => { ),
setState(() { ],
_selectedType = newValue; ),
selectedPatientType =
int.parse(_selectedType);
})
},
items: PATIENT_TYPE.map((item) {
!projectsProvider.isArabic
? itemText = item['text']
: itemText = item['text_ar'];
return DropdownMenuItem(
child: Text(
itemText,
textAlign: TextAlign.end,
),
value: item['val'],
);
}).toList(),
)),
),
],
), ),
), ),
), SizedBox(
SizedBox( height: 10,
height: 10, ),
), Container(
Container( decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius:
borderRadius: BorderRadius.all(Radius.circular(6.0)),
BorderRadius.all(Radius.circular(6.0)), border: Border.all(
border: Border.all( width: 1.0, color: HexColor("#CCCCCC"))),
width: 1.0, color: HexColor("#CCCCCC"))), padding: EdgeInsets.only(top: 5),
padding: EdgeInsets.only(top: 5), child: AppTextFormField(
child: AppTextFormField( labelText:
labelText: TranslationBase.of(context).firstName,
TranslationBase.of(context).firstName, borderColor: Colors.white,
borderColor: Colors.white, onSaved: (value) {
onSaved: (value) { value == null || value == ''
value == null || value == '' ? _patientSearchFormValues.setFirstName =
? _patientSearchFormValues.setFirstName = "0"
"0" : _patientSearchFormValues.setFirstName =
: _patientSearchFormValues.setFirstName = value;
value;
if (value != null && if (value != null &&
value.toString().trim().isEmpty) { value.toString().trim().isEmpty) {
_patientSearchFormValues.setFirstName = "0"; _patientSearchFormValues.setFirstName = "0";
} }
}, },
// validator: (value) { // validator: (value) {
// return TextValidator().validateName(value); // return TextValidator().validateName(value);
// }, // },
inputFormatter: ONLY_LETTERS), inputFormatter: ONLY_LETTERS),
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(6.0)), BorderRadius.all(Radius.circular(6.0)),
border: Border.all( border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))), width: 1.0, color: HexColor("#CCCCCC"))),
padding: EdgeInsets.only(top: 5), padding: EdgeInsets.only(top: 5),
child: AppTextFormField( child: AppTextFormField(
labelText:
TranslationBase.of(context).middleName,
borderColor: Colors.white,
onSaved: (value) {
value == null || value == ''
? _patientSearchFormValues.setMiddleName =
"0"
: _patientSearchFormValues.setMiddleName =
value;
if (value != null && value
.toString()
.trim()
.isEmpty) {
_patientSearchFormValues.setMiddleName =
"0";
}
},
// validator: (value) {
// return TextValidator().validateName(value);
// },
inputFormatter: ONLY_LETTERS),
),
SizedBox(
height: 10,
),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
padding: EdgeInsets.only(top: 5),
child: AppTextFormField(
labelText: TranslationBase.of(context).lastName,
borderColor: Colors.white,
onSaved: (value) {
value == null || value == ''
? _patientSearchFormValues.setLastName =
"0"
: _patientSearchFormValues.setLastName =
value;
if (value != null && value
.toString()
.trim()
.isEmpty) {
_patientSearchFormValues.setLastName = "0";
}
},
inputFormatter: ONLY_LETTERS),
),
SizedBox(
height: 10,
),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
padding: EdgeInsets.only(top: 5),
child: AppTextFormField(
labelText: labelText:
TranslationBase.of(context).middleName, TranslationBase.of(context).phoneNumber,
borderColor: Colors.white,
onSaved: (value) {
value == null || value == ''
? _patientSearchFormValues.setMiddleName =
"0"
: _patientSearchFormValues.setMiddleName =
value;
if (value != null && value
.toString()
.trim()
.isEmpty) {
_patientSearchFormValues.setMiddleName =
"0";
}
},
// validator: (value) {
// return TextValidator().validateName(value);
// },
inputFormatter: ONLY_LETTERS),
),
SizedBox(
height: 10,
),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
padding: EdgeInsets.only(top: 5),
child: AppTextFormField(
labelText: TranslationBase.of(context).lastName,
borderColor: Colors.white, borderColor: Colors.white,
textInputType: TextInputType.number,
textInputAction: TextInputAction.done,
inputFormatter: ONLY_NUMBERS,
focusNode: _nodeText1,
onSaved: (value) { onSaved: (value) {
value == null || value == '' value == null || value == ''
? _patientSearchFormValues.setLastName = ? _patientSearchFormValues
"0" .setPatientMobileNumber = "0"
: _patientSearchFormValues.setLastName = : _patientSearchFormValues
value; .setPatientMobileNumber = value;
if (value != null && value if (value != null && value
.toString() .toString()
.trim() .trim()
.isEmpty) { .isEmpty) {
_patientSearchFormValues.setLastName = "0"; _patientSearchFormValues
.setPatientMobileNumber = "0";
} }
}, },
inputFormatter: ONLY_LETTERS), ),
),
SizedBox(
height: 10,
),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
padding: EdgeInsets.only(top: 5),
child: AppTextFormField(
labelText:
TranslationBase.of(context).phoneNumber,
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
onSaved: (value) {
value == null || value == ''
? _patientSearchFormValues
.setPatientMobileNumber = "0"
: _patientSearchFormValues
.setPatientMobileNumber = value;
if (value != null && value
.toString()
.trim()
.isEmpty) {
_patientSearchFormValues
.setPatientMobileNumber = "0";
}
},
), ),
), SizedBox(
SizedBox( height: 10,
height: 10, ),
), Container(
Container( decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius:
borderRadius: BorderRadius.all(Radius.circular(6.0)),
BorderRadius.all(Radius.circular(6.0)), border: Border.all(
border: Border.all( width: 1.0, color: HexColor("#CCCCCC"))),
width: 1.0, color: HexColor("#CCCCCC"))), padding: EdgeInsets.only(top: 5),
padding: EdgeInsets.only(top: 5), child: AppTextFormField(
child: AppTextFormField( labelText:
TranslationBase.of(context).patientID,
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
focusNode: _nodeText2,
onSaved: (value) {
value == null || value==''
? _patientSearchFormValues.setPatientID =
0
: _patientSearchFormValues.setPatientID =
int.parse(value);
if (value != null && value
.trim()
.toString()
.isEmpty) {
_patientSearchFormValues.setPatientID = 0;
}
}),
),
SizedBox(
height: 10,
),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
padding: EdgeInsets.only(top: 5),
child: AppTextFormField(
labelText: labelText:
TranslationBase.of(context).patientID, TranslationBase.of(context).patientFile,
borderColor: Colors.white, borderColor: Colors.white,
textInputType: TextInputType.number, textInputType: TextInputType.number,
focusNode: _nodeText3,
inputFormatter: ONLY_NUMBERS, inputFormatter: ONLY_NUMBERS,
onSaved: (value) { onSaved: (value) {},
value == null || value=='' ),
? _patientSearchFormValues.setPatientID =
0
: _patientSearchFormValues.setPatientID =
int.parse(value);
if (value != null && value
.trim()
.toString()
.isEmpty) {
_patientSearchFormValues.setPatientID = 0;
}
}),
),
SizedBox(
height: 10,
),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
padding: EdgeInsets.only(top: 5),
child: AppTextFormField(
labelText:
TranslationBase.of(context).patientFile,
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
onSaved: (value) {},
), ),
), (!(_selectedType == '2' || _selectedType == '4'))
(!(_selectedType == '2' || _selectedType == '4')) ? DynamicElements(_patientSearchFormValues, isFormSubmitted)
? DynamicElements(_patientSearchFormValues, isFormSubmitted) : SizedBox(
: SizedBox( height: 0,
height: 0, ),
), SizedBox(
SizedBox( height: 10,
height: 10, ),
), SizedBox(
SizedBox( height: 10,
height: 10, ),
), Container(
Container( child: Row(
child: Row( mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[
children: <Widget>[ Container(
Container( decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius: BorderRadius.all(
borderRadius: BorderRadius.all( Radius.circular(6.0)),
Radius.circular(6.0)), border: Border.all(
border: Border.all( width: 1.0,
width: 1.0, color: HexColor("#CCCCCC"))),
color: HexColor("#CCCCCC"))), height: 25,
height: 25, width: 25,
width: 25, child: Checkbox(
child: Checkbox( value: onlyArrived,
value: onlyArrived, checkColor: HexColor("#2A930A"),
checkColor: HexColor("#2A930A"), activeColor: Colors.white,
activeColor: Colors.white, onChanged: (bool newValue) {
onChanged: (bool newValue) { setState(() {
setState(() { onlyArrived = newValue;
onlyArrived = newValue; });
}); }),
}), ),
), SizedBox(
SizedBox( width: 12,
width: 12, ),
), AppText(
AppText( TranslationBase.of(context)
TranslationBase.of(context) .onlyArrivedPatient,
.onlyArrivedPatient, fontSize: SizeConfig.textMultiplier * 2),
fontSize: SizeConfig.textMultiplier * 2), ])),
])), SizedBox(
SizedBox( height: 10,
height: 10, ),
), ],
], ),
), ),
), )
) ],
], ),
), ),
), Container(
Container( margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), child: Wrap(
child: Wrap( alignment: WrapAlignment.center,
alignment: WrapAlignment.center, children: <Widget>[
children: <Widget>[ AppButton(
AppButton( title: TranslationBase.of(context).search,
title: TranslationBase.of(context).search, onPressed: () {
onPressed: () { _validateInputs();
_validateInputs(); },
}, ),
), ],
], ),
), ),
), ],
], )),
)); );
} }
} }

File diff suppressed because it is too large Load Diff

@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart';
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
@ -103,469 +104,479 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
(BuildContext context, MedicineViewModel model, Widget child) => (BuildContext context, MedicineViewModel model, Widget child) =>
NetworkBaseView( NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: DraggableScrollableSheet( child: GestureDetector(
initialChildSize: 0.95, onTap: (){
maxChildSize: 0.99, FocusScope.of(context).requestFocus(new FocusNode());
minChildSize: 0.6, },
builder: child: DraggableScrollableSheet(
(BuildContext context, ScrollController scrollController) { initialChildSize: 0.95,
return Container( maxChildSize: 0.99,
height: MediaQuery.of(context).size.height * 1.3, minChildSize: 0.6,
child: Form( builder:
child: Padding( (BuildContext context, ScrollController scrollController) {
padding: EdgeInsets.symmetric( return Container(
horizontal: 20.0, vertical: 12.0), height: MediaQuery.of(context).size.height * 1.3,
child: Column( child: Form(
crossAxisAlignment: CrossAxisAlignment.start, child: Padding(
children: [ padding: EdgeInsets.symmetric(
AppText( horizontal: 20.0, vertical: 12.0),
widget.drugName.toUpperCase(), child: Column(
fontWeight: FontWeight.w900, crossAxisAlignment: CrossAxisAlignment.start,
), children: [
SizedBox( AppText(
height: 10.0, widget.drugName.toUpperCase(),
), fontWeight: FontWeight.w900,
Column( ),
children: [ SizedBox(
// Container( height: 10.0,
// height: MediaQuery.of(context).size.height * ),
// 0.070, Column(
// child: InkWell( children: [
// onTap: model.allMedicationList != null // Container(
// ? () { // height: MediaQuery.of(context).size.height *
// setState(() { // 0.070,
// newSelectedMedication = null; // child: InkWell(
// }); // onTap: model.allMedicationList != null
// } // ? () {
// : null, // setState(() {
// child: newSelectedMedication == null // newSelectedMedication = null;
// ? AutoCompleteTextField< // });
// GetMedicationResponseModel>( // }
// decoration: // : null,
// textFieldSelectorDecoration( // child: newSelectedMedication == null
// widget.drugNameGeneric, // ? AutoCompleteTextField<
// newSelectedMedication != null // GetMedicationResponseModel>(
// ? newSelectedMedication // decoration:
// .genericName // textFieldSelectorDecoration(
// : null, // widget.drugNameGeneric,
// true, // newSelectedMedication != null
// ), // ? newSelectedMedication
// itemSubmitted: (item) => setState( // .genericName
// () => newSelectedMedication = // : null,
// item), // true,
// key: key, // ),
// suggestions: // itemSubmitted: (item) => setState(
// model.allMedicationList, // () => newSelectedMedication =
// itemBuilder: (context, // item),
// suggestion) => // key: key,
// new Padding( // suggestions:
// child: Texts(suggestion // model.allMedicationList,
// .description + // itemBuilder: (context,
// '/' + // suggestion) =>
// suggestion.genericName), // new Padding(
// padding: // child: Texts(suggestion
// EdgeInsets.all(8.0)), // .description +
// itemSorter: (a, b) => 1, // '/' +
// itemFilter: (suggestion, input) => // suggestion.genericName),
// suggestion.genericName // padding:
// .toLowerCase() // EdgeInsets.all(8.0)),
// .startsWith( // itemSorter: (a, b) => 1,
// input.toLowerCase()) || // itemFilter: (suggestion, input) =>
// suggestion.description // suggestion.genericName
// .toLowerCase() // .toLowerCase()
// .startsWith( // .startsWith(
// input.toLowerCase()) || // input.toLowerCase()) ||
// suggestion.keywords // suggestion.description
// .toLowerCase() // .toLowerCase()
// .startsWith( // .startsWith(
// input.toLowerCase()), // input.toLowerCase()) ||
// ) // suggestion.keywords
// : TextField( // .toLowerCase()
// decoration: // .startsWith(
// textFieldSelectorDecoration( // input.toLowerCase()),
// TranslationBase.of(context) // )
// .searchMedicineNameHere, // : TextField(
// newSelectedMedication != null // decoration:
// ? newSelectedMedication // textFieldSelectorDecoration(
// .description + // TranslationBase.of(context)
// ('${newSelectedMedication.genericName}') // .searchMedicineNameHere,
// : null, // newSelectedMedication != null
// true, // ? newSelectedMedication
// ), // .description +
// enabled: false, // ('${newSelectedMedication.genericName}')
// ), // : null,
// ), // true,
// ), // ),
// SizedBox( // enabled: false,
// height: 12, // ),
// ), // ),
Container( // ),
height: MediaQuery.of(context).size.height * // SizedBox(
0.060, // height: 12,
width: double.infinity, // ),
child: Row( Container(
children: [ height: MediaQuery.of(context).size.height *
Container( 0.060,
width: width: double.infinity,
MediaQuery.of(context).size.width * child: Row(
0.4900, children: [
height: Container(
MediaQuery.of(context).size.height * width:
0.55, MediaQuery.of(context).size.width *
child: TextFields( 0.4900,
inputFormatters: [ height:
LengthLimitingTextInputFormatter(4), MediaQuery.of(context).size.height *
WhitelistingTextInputFormatter 0.55,
.digitsOnly child: TextFields(
], inputFormatters: [
hintText: widget.doseStreangth, LengthLimitingTextInputFormatter(4),
fontSize: 15.0, WhitelistingTextInputFormatter
controller: strengthController, .digitsOnly
keyboardType: TextInputType.number, ],
onChanged: (String value) { hintText: widget.doseStreangth,
setState(() { fontSize: 15.0,
strengthChar = value.length; controller: strengthController,
}); keyboardType: TextInputType.number,
if (strengthChar >= 4) { onChanged: (String value) {
DrAppToastMsg.showErrorToast( setState(() {
"Only 4 Digits allowed for strength"); strengthChar = value.length;
} });
}, if (strengthChar >= 4) {
// validator: (value) { DrAppToastMsg.showErrorToast(
// if (value.isEmpty && "Only 4 Digits allowed for strength");
// strengthController.text.length > }
// 4) },
// return TranslationBase.of(context) // validator: (value) {
// .emptyMessage; // if (value.isEmpty &&
// else // strengthController.text.length >
// return null; // 4)
// }, // return TranslationBase.of(context)
// .emptyMessage;
// else
// return null;
// },
),
), ),
), SizedBox(
SizedBox( width: 10.0,
width: 10.0, ),
), Container(
Container( width:
width: MediaQuery.of(context).size.width *
MediaQuery.of(context).size.width * 0.3700,
0.3700, child: InkWell(
child: InkWell( onTap: model.medicationStrengthList !=
onTap: model.medicationStrengthList != null
null ? () {
? () { Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: model list: model
.medicationStrengthList, .medicationStrengthList,
attributeName: 'nameEn', attributeName: 'nameEn',
attributeValueId: 'id', attributeValueId: 'id',
okText: TranslationBase.of( okText: TranslationBase.of(
context) context)
.ok, .ok,
okFunction: okFunction:
(selectedValue) { (selectedValue) {
setState(() { setState(() {
units = selectedValue; units = 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(
'UNIT Type', 'UNIT Type',
units != null units != null
? units['nameEn'] ? units['nameEn']
: null, : null,
true), true),
enabled: false, enabled: false,
),
), ),
), ),
],
),
),
SizedBox(
height: 12,
),
Container(
height: MediaQuery.of(context).size.height *
0.070,
child: InkWell(
onTap: model.medicationRouteList != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model.medicationRouteList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
route = selectedValue;
});
if (route == null) {
route = route['id'];
}
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
'Route',
route != null
? route['nameEn']
: null,
true),
enabled: false,
), ),
], ),
),
SizedBox(
height: 12.0,
), ),
), Container(
SizedBox( height: MediaQuery.of(context).size.height *
height: 12, 0.070,
), child: InkWell(
Container( onTap: model.medicationDoseTimeList != null
height: MediaQuery.of(context).size.height * ? () {
0.070, Helpers.hideKeyboard(context);
child: InkWell( ListSelectDialog dialog =
onTap: model.medicationRouteList != null ListSelectDialog(
? () { list:
ListSelectDialog dialog = model.medicationDoseTimeList,
ListSelectDialog( attributeName: 'nameEn',
list: model.medicationRouteList, attributeValueId: 'id',
attributeName: 'nameEn', okText:
attributeValueId: 'id', TranslationBase.of(context)
okText: .ok,
TranslationBase.of(context) okFunction: (selectedValue) {
.ok, setState(() {
okFunction: (selectedValue) { doseTime = selectedValue;
setState(() { });
route = selectedValue; },
}); );
if (route == null) { showDialog(
route = route['id']; barrierDismissible: false,
} context: context,
}, builder: (BuildContext context) {
); return dialog;
showDialog( },
barrierDismissible: false, );
context: context, }
builder: (BuildContext context) { : null,
return dialog; child: TextField(
}, decoration: textFieldSelectorDecoration(
); TranslationBase.of(context).doseTime,
} doseTime != null
: null, ? doseTime['nameEn']
child: TextField( : null,
decoration: textFieldSelectorDecoration( true),
'Route', enabled: false,
route != null ),
? route['nameEn']
: null,
true),
enabled: false,
), ),
), ),
), SizedBox(
SizedBox( height: 12.0,
height: 12.0, ),
), Container(
Container( height: MediaQuery.of(context).size.height *
height: MediaQuery.of(context).size.height * 0.070,
0.070, child: InkWell(
child: InkWell( onTap: model.medicationFrequencyList != null
onTap: model.medicationDoseTimeList != null ? () {
? () { Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: list:
model.medicationDoseTimeList, model.medicationFrequencyList,
attributeName: 'nameEn', attributeName: 'nameEn',
attributeValueId: 'id', attributeValueId: 'id',
okText: okText:
TranslationBase.of(context) TranslationBase.of(context)
.ok, .ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
doseTime = selectedValue; frequencyUpdate =
}); selectedValue;
}, });
); },
showDialog( );
barrierDismissible: false, showDialog(
context: context, barrierDismissible: false,
builder: (BuildContext context) { context: context,
return dialog; builder: (BuildContext context) {
}, return dialog;
); },
} );
: null, }
child: TextField( : null,
decoration: textFieldSelectorDecoration( child: TextField(
TranslationBase.of(context).doseTime, decoration: textFieldSelectorDecoration(
doseTime != null TranslationBase.of(context).frequency,
? doseTime['nameEn'] frequencyUpdate != null
: null, ? frequencyUpdate['nameEn']
true), : null,
enabled: false, true),
enabled: false,
),
), ),
), ),
), SizedBox(
SizedBox( height: 12.0,
height: 12.0, ),
), Container(
Container( height: MediaQuery.of(context).size.height *
height: MediaQuery.of(context).size.height * 0.070,
0.070, child: InkWell(
child: InkWell( onTap: model.medicationDurationList != null
onTap: model.medicationFrequencyList != null ? () {
? () { Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: list:
model.medicationFrequencyList, model.medicationDurationList,
attributeName: 'nameEn', attributeName: 'nameEn',
attributeValueId: 'id', attributeValueId: 'id',
okText: okText:
TranslationBase.of(context) TranslationBase.of(context)
.ok, .ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
frequencyUpdate = updatedDuration =
selectedValue; selectedValue;
}); });
}, },
); );
showDialog( showDialog(
barrierDismissible: false, barrierDismissible: false,
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return dialog; return dialog;
}, },
); );
} }
: null, : null,
child: TextField( child: TextField(
decoration: textFieldSelectorDecoration( decoration: textFieldSelectorDecoration(
TranslationBase.of(context).frequency, TranslationBase.of(context).duration,
frequencyUpdate != null updatedDuration != null
? frequencyUpdate['nameEn'] ? updatedDuration['nameEn']
: null, .toString()
true), : null,
enabled: false, true),
enabled: false,
),
), ),
), ),
), SizedBox(
SizedBox( height: 12.0,
height: 12.0, ),
), Container(
Container( decoration: BoxDecoration(
height: MediaQuery.of(context).size.height * borderRadius: BorderRadius.all(
0.070, Radius.circular(6.0)),
child: InkWell( border: Border.all(
onTap: model.medicationDurationList != null width: 1.0,
? () { color: HexColor("#CCCCCC"))),
ListSelectDialog dialog = child: TextFields(
ListSelectDialog( hintText: widget.remarks,
list: controller: remarksController,
model.medicationDurationList, maxLines: 7,
attributeName: 'nameEn', minLines: 4,
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
updatedDuration =
selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).duration,
updatedDuration != null
? updatedDuration['nameEn']
.toString()
: null,
true),
enabled: false,
), ),
), ),
), SizedBox(
SizedBox( height: 12.0,
height: 12.0,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText: widget.remarks,
controller: remarksController,
maxLines: 7,
minLines: 4,
), ),
), SizedBox(
SizedBox( height:
height: 12.0, MediaQuery.of(context).size.height * 0.12,
), ),
SizedBox( Container(
height: margin: EdgeInsets.all(
MediaQuery.of(context).size.height * 0.12, SizeConfig.widthMultiplier * 2),
), child: Wrap(
Container( alignment: WrapAlignment.center,
margin: EdgeInsets.all( children: <Widget>[
SizeConfig.widthMultiplier * 2), AppButton(
child: Wrap( title:
alignment: WrapAlignment.center, 'update prescription'.toUpperCase(),
children: <Widget>[ onPressed: () {
AppButton( updatePrescription(
title: newDoseStreangth:
'update prescription'.toUpperCase(), strengthController
onPressed: () { .text.isNotEmpty
updatePrescription( ? strengthController.text
newDoseStreangth: : widget.doseStreangth,
strengthController newUnit: units !=
.text.isNotEmpty null
? strengthController.text ? units['id'].toString()
: widget.doseStreangth, : widget.doseUnit,
newUnit: units != doseUnit: widget.doseUnit,
null doseStreangth: widget
? units['id'].toString() .doseStreangth,
: widget.doseUnit, duration: widget.duration,
doseUnit: widget.doseUnit, startDate: widget.startDate,
doseStreangth: widget doseId: widget.dose,
.doseStreangth, frequencyId: widget.frequency,
duration: widget.duration, routeId: widget.route,
startDate: widget.startDate, patient: widget.patient,
doseId: widget.dose, model: widget.model,
frequencyId: widget.frequency, newDuration:
routeId: widget.route, updatedDuration !=
patient: widget.patient, null
model: widget.model, ? updatedDuration[
newDuration: 'id']
updatedDuration != .toString()
null : widget.duration,
? updatedDuration[ drugId: widget.drugId,
'id'] remarks: remarksController.text,
.toString() route: route !=
: widget.duration, null
drugId: widget.drugId, ? route['id'].toString()
remarks: remarksController.text, : widget.route,
route: route != frequency:
null frequencyUpdate !=
? route['id'].toString() null
: widget.route, ? frequencyUpdate['id']
frequency: .toString()
frequencyUpdate != : widget.frequency,
null dose: doseTime != null
? frequencyUpdate['id'] ? doseTime['id'].toString()
.toString() : widget.dose,
: widget.frequency, enteredRemarks:
dose: doseTime != null widget.enteredRemarks);
? doseTime['id'].toString() Navigator.pop(context);
: widget.dose, },
enteredRemarks: ),
widget.enteredRemarks); ],
Navigator.pop(context); ),
},
),
],
), ),
), ],
], ),
), ],
], ),
), ),
), ));
)); }),
}), ),
), ),
); );
}); });

File diff suppressed because it is too large Load Diff

@ -83,315 +83,320 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
builder: (_, model, w) => BaseView<SickLeaveViewModel>( builder: (_, model, w) => BaseView<SickLeaveViewModel>(
onModelReady: (model2) => model2.preSickLeaveStatistics( onModelReady: (model2) => model2.preSickLeaveStatistics(
widget.appointmentNo, widget.patientMRN), widget.appointmentNo, widget.patientMRN),
builder: (_, model2, w) => AppScaffold( builder: (_, model2, w) => GestureDetector(
baseViewModel: model2, onTap: (){
isShowAppBar: false, FocusScope.of(context).requestFocus(new FocusNode());
body: Center( },
child: Container( child: AppScaffold(
margin: EdgeInsets.only(top: 10), baseViewModel: model2,
child: FractionallySizedBox( isShowAppBar: false,
widthFactor: 0.9, body: Center(
child: ListView( child: Container(
children: [ margin: EdgeInsets.only(top: 10),
Padding( child: FractionallySizedBox(
child: AppText( widthFactor: 0.9,
widget.isExtended == true child: ListView(
? TranslationBase.of(context) children: [
.extendSickLeave Padding(
: TranslationBase.of(context) child: AppText(
.addSickLeave, widget.isExtended == true
fontWeight: FontWeight.bold, ? TranslationBase.of(context)
), .extendSickLeave
padding: EdgeInsets.all(10)), : TranslationBase.of(context)
Container( .addSickLeave,
margin: EdgeInsets.only(left: 10, right: 10), fontWeight: FontWeight.bold,
decoration: BoxDecoration( ),
borderRadius: padding: EdgeInsets.all(10)),
BorderRadius.all(Radius.circular(6.0)), Container(
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
padding: EdgeInsets.all(5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppTextFormField(
borderColor: Colors.white,
onChanged: (value) {
addSickLeave.noOfDays = value;
if (widget.extendedData != null) {
widget.extendedData.noOfDays =
int.parse(value);
}
},
hintText: widget.extendedData != null
? widget.extendedData.noOfDays
.toString()
: TranslationBase.of(context)
.sickLeaveDays,
// validator: (value) {
// return TextValidator().validateName(value);
// },
inputFormatter: ONLY_NUMBERS)
]),
),
SizedBox(
height: 10,
),
Container(
margin: EdgeInsets.only(left: 10, right: 10), margin: EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(6.0)), BorderRadius.all(Radius.circular(6.0)),
border: Border.all( border: Border.all(
width: 1.0, width: 1.0, color: HexColor("#CCCCCC"))),
color: HexColor("#CCCCCC"))),
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// AppText( AppTextFormField(
// TranslationBase.of(context).sickLeaveDate, borderColor: Colors.white,
// fontSize: 10, onChanged: (value) {
// ), addSickLeave.noOfDays = value;
AppTextFormField( if (widget.extendedData != null) {
hintText: widget.extendedData != null widget.extendedData.noOfDays =
? widget.extendedData.startDate int.parse(value);
: TranslationBase.of(context) }
.sickLeaveDate, },
borderColor: Colors.white, hintText: widget.extendedData != null
prefix: IconButton( ? widget.extendedData.noOfDays
icon: Icon(Icons.calendar_today)), .toString()
textInputType: TextInputType.number, : TranslationBase.of(context)
controller: _toDateController, .sickLeaveDays,
onTap: () { // validator: (value) {
_presentDatePicker('_selectedToDate'); // return TextValidator().validateName(value);
}, // },
inputFormatter: ONLY_DATE, inputFormatter: ONLY_NUMBERS)
onChanged: (value) { ]),
addSickLeave.startDate = value; ),
if (widget.extendedData != null) { SizedBox(
widget.extendedData.startDate = height: 10,
value; ),
} Container(
}), margin: EdgeInsets.only(left: 10, right: 10),
], decoration: BoxDecoration(
)), borderRadius:
Container( BorderRadius.all(Radius.circular(6.0)),
margin: EdgeInsets.only( border: Border.all(
top: 10, left: 10, right: 10), width: 1.0,
decoration: BoxDecoration( color: HexColor("#CCCCCC"))),
borderRadius: padding: EdgeInsets.all(5),
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
width: double.infinity,
child: Padding(
padding: EdgeInsets.only(
top: SizeConfig.widthMultiplier * 0.9,
bottom: SizeConfig.widthMultiplier * 0.9,
right: SizeConfig.widthMultiplier * 3,
left: SizeConfig.widthMultiplier * 3),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
// AppText( // AppText(
// TranslationBase.of(context).clinicName, // TranslationBase.of(context).sickLeaveDate,
// fontSize: 10, // fontSize: 10,
// ), // ),
Row( AppTextFormField(
mainAxisSize: MainAxisSize.max, hintText: widget.extendedData != null
children: <Widget>[ ? widget.extendedData.startDate
Expanded( : TranslationBase.of(context)
// add Expanded to have your dropdown button fill remaining space .sickLeaveDate,
child: DropdownButtonHideUnderline( borderColor: Colors.white,
child: new IgnorePointer( prefix: IconButton(
ignoring: true, icon: Icon(Icons.calendar_today)),
child: DropdownButton( textInputType: TextInputType.number,
isExpanded: true, controller: _toDateController,
value: getClinicName( onTap: () {
model) ?? _presentDatePicker('_selectedToDate');
"", },
iconSize: 0, inputFormatter: ONLY_DATE,
elevation: 16, onChanged: (value) {
selectedItemBuilder: addSickLeave.startDate = value;
(BuildContext if (widget.extendedData != null) {
context) { widget.extendedData.startDate =
return model value;
}
}),
],
)),
Container(
margin: EdgeInsets.only(
top: 10, left: 10, right: 10),
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
width: double.infinity,
child: Padding(
padding: EdgeInsets.only(
top: SizeConfig.widthMultiplier * 0.9,
bottom: SizeConfig.widthMultiplier * 0.9,
right: SizeConfig.widthMultiplier * 3,
left: SizeConfig.widthMultiplier * 3),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
// AppText(
// TranslationBase.of(context).clinicName,
// fontSize: 10,
// ),
Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
// add Expanded to have your dropdown button fill remaining space
child: DropdownButtonHideUnderline(
child: new IgnorePointer(
ignoring: true,
child: DropdownButton(
isExpanded: true,
value: getClinicName(
model) ??
"",
iconSize: 0,
elevation: 16,
selectedItemBuilder:
(BuildContext
context) {
return model
.getClinicNameList()
.map((item) {
return Row(
mainAxisSize:
MainAxisSize
.max,
children: <Widget>[
AppText(
item,
fontSize: SizeConfig
.textMultiplier *
2.1,
color:
Colors.grey,
),
],
);
}).toList();
},
onChanged: (newValue) =>
{},
items: model
.getClinicNameList() .getClinicNameList()
.map((item) { .map((item) {
return Row( return DropdownMenuItem(
mainAxisSize: value:
MainAxisSize item.toString(),
.max, child: Text(
children: <Widget>[ item,
AppText( textAlign:
item, TextAlign.end,
fontSize: SizeConfig ),
.textMultiplier *
2.1,
color:
Colors.grey,
),
],
); );
}).toList(); }).toList(),
}, ))),
onChanged: (newValue) => ),
{}, ],
items: model )
.getClinicNameList() ],
.map((item) {
return DropdownMenuItem(
value:
item.toString(),
child: Text(
item,
textAlign:
TextAlign.end,
),
);
}).toList(),
))),
),
],
)
],
),
)),
model2.sickLeaveStatistics[
'recommendedSickLeaveDays'] !=
null
? Padding(
child: AppText(
model2.sickLeaveStatistics[
'recommendedSickLeaveDays'],
fontWeight: FontWeight.bold,
textAlign: TextAlign.start,
), ),
padding: EdgeInsets.all(10), )),
) model2.sickLeaveStatistics[
: SizedBox( 'recommendedSickLeaveDays'] !=
height: 10, null
), ? Padding(
Container( child: AppText(
margin: EdgeInsets.only(left: 10, right: 10), model2.sickLeaveStatistics[
decoration: BoxDecoration( 'recommendedSickLeaveDays'],
borderRadius: fontWeight: FontWeight.bold,
BorderRadius.all(Radius.circular(6.0)), textAlign: TextAlign.start,
border: Border.all( ),
width: 1.0, color: HexColor("#CCCCCC"))), padding: EdgeInsets.all(10),
padding: EdgeInsets.all(5), )
child: Column( : SizedBox(
crossAxisAlignment: CrossAxisAlignment.start, height: 10,
children: [ ),
// AppText( Container(
// TranslationBase.of(context).doctorName, margin: EdgeInsets.only(left: 10, right: 10),
// fontSize: 10, decoration: BoxDecoration(
// ), borderRadius:
new IgnorePointer( BorderRadius.all(Radius.circular(6.0)),
ignoring: true, border: Border.all(
child: AppTextFormField( width: 1.0, color: HexColor("#CCCCCC"))),
readOnly: true, padding: EdgeInsets.all(5),
hintText: profile['DoctorName'], child: Column(
borderColor: Colors.white, crossAxisAlignment: CrossAxisAlignment.start,
onSaved: (value) {}, children: [
// validator: (value) { // AppText(
// return TextValidator().validateName(value); // TranslationBase.of(context).doctorName,
// }, // fontSize: 10,
inputFormatter: ONLY_NUMBERS)) // ),
], new IgnorePointer(
ignoring: true,
child: AppTextFormField(
readOnly: true,
hintText: profile['DoctorName'],
borderColor: Colors.white,
onSaved: (value) {},
// validator: (value) {
// return TextValidator().validateName(value);
// },
inputFormatter: ONLY_NUMBERS))
],
),
),
SizedBox(
height: 10,
), ),
), Container(
SizedBox( margin: EdgeInsets.only(left: 10, right: 10),
height: 10, decoration: BoxDecoration(
), borderRadius:
Container( BorderRadius.all(Radius.circular(6.0)),
margin: EdgeInsets.only(left: 10, right: 10), border: Border.all(
decoration: BoxDecoration( width: 1.0, color: HexColor("#CCCCCC"))),
borderRadius: padding: EdgeInsets.all(5),
BorderRadius.all(Radius.circular(6.0)), child: Column(
border: Border.all( crossAxisAlignment: CrossAxisAlignment.start,
width: 1.0, color: HexColor("#CCCCCC"))), children: [
padding: EdgeInsets.all(5), // AppText(
child: Column( // TranslationBase.of(context).remarks,
crossAxisAlignment: CrossAxisAlignment.start, // fontSize: 10,
children: [ // ),
// AppText( TextField(
// TranslationBase.of(context).remarks, maxLines: 3,
// fontSize: 10, decoration: InputDecoration(
// ), contentPadding: EdgeInsets.all(20.0),
TextField( border: InputBorder.none,
maxLines: 3, hintText: widget.extendedData != null
decoration: InputDecoration( ? widget.extendedData.remarks
contentPadding: EdgeInsets.all(20.0), : TranslationBase.of(context)
border: InputBorder.none, .remarks),
hintText: widget.extendedData != null onChanged: (value) {
? widget.extendedData.remarks addSickLeave.remarks = value;
: TranslationBase.of(context) if (widget.extendedData != null) {
.remarks), widget.extendedData.remarks = value;
onChanged: (value) { }
addSickLeave.remarks = value; },
if (widget.extendedData != null) { )
widget.extendedData.remarks = value; ],
} ),
},
)
],
), ),
), Container(
Container( margin: EdgeInsets.all(
margin: EdgeInsets.all( SizeConfig.widthMultiplier * 5),
SizeConfig.widthMultiplier * 5), child: Wrap(
child: Wrap( alignment: WrapAlignment.center,
alignment: WrapAlignment.center, children: <Widget>[
children: <Widget>[ AppButton(
AppButton( title: widget.isExtended == true
title: widget.isExtended == true ? TranslationBase.of(context).extend
? TranslationBase.of(context).extend : TranslationBase.of(context).add,
: TranslationBase.of(context).add, onPressed: () async {
onPressed: () async { if (widget.isExtended) {
if (widget.isExtended) { await model2.extendSickLeave(
await model2.extendSickLeave( widget.extendedData);
widget.extendedData);
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(
model2.sickleaveResponse[ model2.sickleaveResponse[
'ListSickLeavesToExtent'] 'ListSickLeavesToExtent']
['success']); ['success']);
Navigator.of(context).popUntil((route) { Navigator.of(context).popUntil((route) {
return route.settings.name == return route.settings.name ==
PATIENTS_PROFILE; PATIENTS_PROFILE;
}); });
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
ADD_SICKLEAVE, ADD_SICKLEAVE,
arguments: { arguments: {
'patient': widget.patient 'patient': widget.patient
}); });
//print(value); //print(value);
//}); //});
} else { } else {
_validateInputs(model2); _validateInputs(model2);
} }
}, },
), ),
], ],
),
), ),
), // Column(
// Column( // children: [
// children: [ // Texts(TranslationBase.of(context)
// Texts(TranslationBase.of(context) // .previousSickLeaveIssue +
// .previousSickLeaveIssue + // ' ')
// ' ') // ],
// ], // )
// ) ],
], ),
), ),
), ),
), ),
), ),
))); )));
} }
void _validateInputs(model2) async { void _validateInputs(model2) async {

@ -408,4 +408,9 @@ class Helpers {
)), )),
); );
} }
/// hides the keyboard if its already open
static hideKeyboard(BuildContext context) {
FocusScope.of(context).unfocus();
}
} }

@ -54,7 +54,7 @@ class TextFields extends StatefulWidget {
this.focus = false, this.focus = false,
this.maxLengthEnforced = true, this.maxLengthEnforced = true,
this.suffixIconColor, this.suffixIconColor,
this.inputAction, this.inputAction = TextInputAction.done,
this.onSubmit, this.onSubmit,
this.keepPadding = true, this.keepPadding = true,
this.textCapitalization = TextCapitalization.none, this.textCapitalization = TextCapitalization.none,

@ -17,7 +17,7 @@ class AppTextFormField extends FormField<String> {
TextInputType textInputType, TextInputType textInputType,
String hintText, String hintText,
FocusNode focusNode, FocusNode focusNode,
TextInputAction textInputAction, TextInputAction textInputAction=TextInputAction.done,
ValueChanged<String> onFieldSubmitted, ValueChanged<String> onFieldSubmitted,
IconButton prefix, IconButton prefix,
String labelText, String labelText,
@ -38,10 +38,10 @@ class AppTextFormField extends FormField<String> {
focusNode: focusNode, focusNode: focusNode,
keyboardType: textInputType, keyboardType: textInputType,
readOnly: readOnly, readOnly: readOnly,
inputFormatters: [ // inputFormatters: [
FilteringTextInputFormatter.allow( // FilteringTextInputFormatter.allow(
RegExp(inputFormatter)), // RegExp(inputFormatter)),
], // ],
onChanged: onChanged ?? onChanged: onChanged ??
(value) { (value) {
state.didChange(value); state.didChange(value);

@ -559,7 +559,7 @@ packages:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.4" version: "1.3.0-nullsafety.3"
mime: mime:
dependency: transitive dependency: transitive
description: description:
@ -830,7 +830,7 @@ packages:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0-nullsafety.2" version: "1.10.0-nullsafety.1"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
@ -965,5 +965,5 @@ packages:
source: hosted source: hosted
version: "2.2.1" version: "2.2.1"
sdks: sdks:
dart: ">=2.10.0 <=2.11.0-213.1.beta" dart: ">=2.10.0 <2.11.0"
flutter: ">=1.22.0 <2.0.0" flutter: ">=1.22.0 <2.0.0"

Loading…
Cancel
Save