File tree Expand file tree Collapse file tree 2 files changed +4
-11
lines changed Expand file tree Collapse file tree 2 files changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -211,8 +211,7 @@ class _FormBuilderColorPickerFieldState
211
211
212
212
Future <void > _handleFocus () async {
213
213
if (effectiveFocusNode.hasFocus && enabled) {
214
- await Future .microtask (
215
- () => FocusScope .of (context).requestFocus (FocusNode ()));
214
+ effectiveFocusNode? .unfocus ();
216
215
final selected = await showDialog <bool >(
217
216
context: context,
218
217
builder: (BuildContext context) {
Original file line number Diff line number Diff line change @@ -133,9 +133,7 @@ class FormBuilderDateRangePicker extends FormBuilderField<List<DateTime>> {
133
133
return TextField (
134
134
enabled: state.enabled,
135
135
style: style,
136
- focusNode: state.enabled
137
- ? state.effectiveFocusNode
138
- : AlwaysDisabledFocusNode (),
136
+ focusNode: state.effectiveFocusNode,
139
137
decoration: state.decoration (),
140
138
// initialValue: "${_initialValue ?? ''}",
141
139
maxLines: maxLines,
@@ -207,8 +205,8 @@ class FormBuilderDateRangePickerState
207
205
}
208
206
209
207
Future <void > _handleFocus () async {
210
- if ( effectiveFocusNode.hasFocus) {
211
- _hideKeyboard ();
208
+ effectiveFocusNode? . unfocus ();
209
+ if (effectiveFocusNode.hasFocus && enabled) {
212
210
final initialFirstDate = value? .isEmpty ?? true
213
211
? (widget.initialFirstDate ?? DateTime .now ())
214
212
: value[0 ];
@@ -245,10 +243,6 @@ class FormBuilderDateRangePickerState
245
243
return '${format (value [0 ])} - ${format (value [1 ])}' ;
246
244
}
247
245
248
- void _hideKeyboard () {
249
- Future .microtask (() => FocusScope .of (context).requestFocus (FocusNode ()));
250
- }
251
-
252
246
String format (DateTime date) => FormBuilderDateRangePicker .tryFormat (
253
247
date, widget.format ?? intl.DateFormat .yMd ());
254
248
You can’t perform that action at this time.
0 commit comments