Skip to content

Commit 7bc2751

Browse files
authored
Merge pull request #557 from awhitford/field_tweaks-1107
Minor adjustments to Dropdown and Signature fields.
2 parents 1cb24e5 + 2794276 commit 7bc2751

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/src/fields/form_builder_dropdown.dart

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ class FormBuilderDropdown<T> extends FormBuilderField<T> {
229229
// DropdownButtonFormField
230230
// TextFormField
231231

232+
void changeValue(T value) {
233+
state.requestFocus();
234+
state.didChange(value);
235+
}
236+
232237
return InputDecorator(
233238
decoration: state.decoration().copyWith(
234239
floatingLabelBehavior: hint == null
@@ -260,9 +265,8 @@ class FormBuilderDropdown<T> extends FormBuilderField<T> {
260265
icon: icon,
261266
iconDisabledColor: iconDisabledColor,
262267
iconEnabledColor: iconEnabledColor,
263-
onChanged: enabled
264-
? (value) => _changeValue<T>(state, value)
265-
: null,
268+
onChanged:
269+
enabled ? (value) => changeValue(value) : null,
266270
onTap: onTap,
267271
focusNode: state.effectiveFocusNode,
268272
autofocus: autofocus,
@@ -277,7 +281,7 @@ class FormBuilderDropdown<T> extends FormBuilderField<T> {
277281
const VerticalDivider(),
278282
InkWell(
279283
child: clearIcon,
280-
onTap: () => _changeValue<T>(state, null),
284+
onTap: () => changeValue(null),
281285
),
282286
]
283287
],
@@ -286,11 +290,6 @@ class FormBuilderDropdown<T> extends FormBuilderField<T> {
286290
},
287291
);
288292

289-
static void _changeValue<T>(_FormBuilderDropdownState<T> state, T value) {
290-
state.requestFocus();
291-
state.didChange(value);
292-
}
293-
294293
@override
295294
_FormBuilderDropdownState<T> createState() => _FormBuilderDropdownState<T>();
296295
}

lib/src/fields/form_builder_signature_pad.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class FormBuilderSignaturePad extends FormBuilderField<Uint8List> {
7070
Container(
7171
decoration: BoxDecoration(border: border),
7272
child: GestureDetector(
73+
onHorizontalDragUpdate: (_) {},
7374
onVerticalDragUpdate: (_) {},
7475
child: Signature(
7576
controller: state._controller,

0 commit comments

Comments
 (0)