Skip to content

Commit

Permalink
attach FocusNodes to context, use widget.name as debugLabel for nodes…
Browse files Browse the repository at this point in the history
… for better debugging flutter-form-builder-ecosystem#253
  • Loading branch information
grundid committed Nov 12, 2021
1 parent 65c0b1b commit 65abeaf
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class FormBuilderFieldState<F extends FormBuilderField<T>, T>

FocusNode? _focusNode;
FocusNode get effectiveFocusNode =>
widget.focusNode ?? (_focusNode ??= FocusNode());
widget.focusNode ?? (_focusNode ??= FocusNode(debugLabel: widget.name));

@override
void initState() {
Expand All @@ -127,6 +127,7 @@ class FormBuilderFieldState<F extends FormBuilderField<T>, T>
_formBuilderState?.registerField(widget.name, this);
// Register a touch handler
effectiveFocusNode.addListener(_touchedHandler);
effectiveFocusNode.attach(context);
// Set the initial value
setValue(initialValue);
}
Expand Down

0 comments on commit 65abeaf

Please sign in to comment.