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,7 +114,11 @@ 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(
onTap: (){
FocusScope.of(context).requestFocus(new FocusNode());
},
child: AppScaffold(
appBarTitle: TranslationBase.of(context).searchPatient, appBarTitle: TranslationBase.of(context).searchPatient,
body: ListView( body: ListView(
children: <Widget>[ children: <Widget>[
@ -344,7 +352,9 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
TranslationBase.of(context).phoneNumber, TranslationBase.of(context).phoneNumber,
borderColor: Colors.white, borderColor: Colors.white,
textInputType: TextInputType.number, textInputType: TextInputType.number,
textInputAction: TextInputAction.done,
inputFormatter: ONLY_NUMBERS, inputFormatter: ONLY_NUMBERS,
focusNode: _nodeText1,
onSaved: (value) { onSaved: (value) {
value == null || value == '' value == null || value == ''
? _patientSearchFormValues ? _patientSearchFormValues
@ -378,6 +388,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
borderColor: Colors.white, borderColor: Colors.white,
textInputType: TextInputType.number, textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS, inputFormatter: ONLY_NUMBERS,
focusNode: _nodeText2,
onSaved: (value) { onSaved: (value) {
value == null || value=='' value == null || value==''
? _patientSearchFormValues.setPatientID = ? _patientSearchFormValues.setPatientID =
@ -407,6 +418,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
TranslationBase.of(context).patientFile, 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) {},
), ),
@ -478,6 +490,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
), ),
), ),
], ],
)); )),
);
} }
} }

@ -209,6 +209,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
) => ) =>
NetworkBaseView( NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: GestureDetector(
onTap: (){
FocusScope.of(context).requestFocus(new FocusNode());
},
child: DraggableScrollableSheet( child: DraggableScrollableSheet(
initialChildSize: 0.90, initialChildSize: 0.90,
maxChildSize: 0.90, maxChildSize: 0.90,
@ -243,6 +247,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: InkWell( child: InkWell(
onTap: model.allMedicationList != null onTap: model.allMedicationList != null
? () { ? () {
Helpers.hideKeyboard(context);
setState(() { setState(() {
_selectedMedication = null; _selectedMedication = null;
}); });
@ -377,6 +382,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
onTap: model.medicationStrengthList != onTap: model.medicationStrengthList !=
null null
? () { ? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: model list: model
@ -424,6 +430,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: InkWell( child: InkWell(
onTap: model.medicationRouteList != null onTap: model.medicationRouteList != null
? () { ? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: model.medicationRouteList, list: model.medicationRouteList,
@ -468,6 +475,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: InkWell( child: InkWell(
onTap: model.medicationFrequencyList != null onTap: model.medicationFrequencyList != null
? () { ? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: list:
@ -509,6 +517,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: InkWell( child: InkWell(
onTap: model.medicationDoseTimeList != null onTap: model.medicationDoseTimeList != null
? () { ? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: list:
@ -552,6 +561,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: InkWell( child: InkWell(
onTap: indicationList != null onTap: indicationList != null
? () { ? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: indicationList, list: indicationList,
@ -669,6 +679,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: InkWell( child: InkWell(
onTap: model.medicationDurationList != null onTap: model.medicationDurationList != null
? () { ? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: list:
@ -830,10 +841,12 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
); );
}), }),
), ),
),
); );
} }
selectDate(BuildContext context, PrescriptionViewModel model) async { selectDate(BuildContext context, PrescriptionViewModel model) async {
Helpers.hideKeyboard(context);
DateTime selectedDate; DateTime selectedDate;
selectedDate = DateTime.now(); selectedDate = DateTime.now();
final DateTime picked = await showDatePicker( final DateTime picked = await showDatePicker(

@ -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,6 +104,10 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
(BuildContext context, MedicineViewModel model, Widget child) => (BuildContext context, MedicineViewModel model, Widget child) =>
NetworkBaseView( NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: GestureDetector(
onTap: (){
FocusScope.of(context).requestFocus(new FocusNode());
},
child: DraggableScrollableSheet( child: DraggableScrollableSheet(
initialChildSize: 0.95, initialChildSize: 0.95,
maxChildSize: 0.99, maxChildSize: 0.99,
@ -253,6 +258,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
onTap: model.medicationStrengthList != onTap: model.medicationStrengthList !=
null null
? () { ? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: model list: model
@ -303,6 +309,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
child: InkWell( child: InkWell(
onTap: model.medicationRouteList != null onTap: model.medicationRouteList != null
? () { ? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: model.medicationRouteList, list: model.medicationRouteList,
@ -349,6 +356,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
child: InkWell( child: InkWell(
onTap: model.medicationDoseTimeList != null onTap: model.medicationDoseTimeList != null
? () { ? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: list:
@ -393,6 +401,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
child: InkWell( child: InkWell(
onTap: model.medicationFrequencyList != null onTap: model.medicationFrequencyList != null
? () { ? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: list:
@ -438,6 +447,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
child: InkWell( child: InkWell(
onTap: model.medicationDurationList != null onTap: model.medicationDurationList != null
? () { ? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog = ListSelectDialog dialog =
ListSelectDialog( ListSelectDialog(
list: list:
@ -567,6 +577,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
)); ));
}), }),
), ),
),
); );
}); });
} }

@ -113,7 +113,11 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
model2.getReasons(18), model2.getReasons(18),
model2.getCoveringDoctors() model2.getCoveringDoctors()
}, },
builder: (_, model2, w) => AppScaffold( builder: (_, model2, w) => GestureDetector(
onTap: (){
FocusScope.of(context).requestFocus(new FocusNode());
},
child: AppScaffold(
baseViewModel: model2, baseViewModel: model2,
isShowAppBar: false, isShowAppBar: false,
body: Center( body: Center(
@ -832,6 +836,7 @@ class _RescheduleLeaveScreen extends State<RescheduleLeaveScreen> {
), ),
), ),
), ),
),
))); )));
} }

@ -83,7 +83,11 @@ 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(
onTap: (){
FocusScope.of(context).requestFocus(new FocusNode());
},
child: AppScaffold(
baseViewModel: model2, baseViewModel: model2,
isShowAppBar: false, isShowAppBar: false,
body: Center( body: Center(
@ -391,6 +395,7 @@ class _SickLeaveScreenState extends State<SickLeaveScreen> {
), ),
), ),
), ),
),
))); )));
} }

@ -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