Skip to content

Commit

Permalink
feat: Able to change dynamically field name
Browse files Browse the repository at this point in the history
  • Loading branch information
deandreamatias committed Jan 22, 2023
1 parent 4a3db67 commit 2468d2b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/src/form_builder_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ class FormBuilderFieldState<F extends FormBuilderField<T>, T>
@override
void didUpdateWidget(covariant FormBuilderField<T> oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.name != oldWidget.name) {
_formBuilderState?.unregisterField(oldWidget.name, this);
_formBuilderState?.registerField(widget.name, this);
}
if (widget.focusNode != oldWidget.focusNode) {
focusAttachment?.detach();
effectiveFocusNode.removeListener(_touchedHandler);
Expand Down

0 comments on commit 2468d2b

Please sign in to comment.