Skip to content

Commit

Permalink
Merge pull request #1212 from ProgrammerXDesigner/master
Browse files Browse the repository at this point in the history
Made FormBuilderTextField support context menu by default.
  • Loading branch information
deandreamatias authored Apr 6, 2023
2 parents d8fb588 + 4f08cb2 commit 71cf8db
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/src/fields/form_builder_text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ class FormBuilderTextField extends FormBuilderField<String> {
this.autofillHints,
this.obscuringCharacter = '•',
this.mouseCursor,
this.contextMenuBuilder,
this.contextMenuBuilder = _defaultContextMenuBuilder,
this.magnifierConfiguration,
}) : assert(initialValue == null || controller == null),
assert(minLines == null || minLines > 0),
Expand Down Expand Up @@ -424,6 +424,15 @@ class FormBuilderTextField extends FormBuilderField<String> {
},
);

static Widget _defaultContextMenuBuilder(
BuildContext context,
EditableTextState editableTextState,
) {
return AdaptiveTextSelectionToolbar.editableText(
editableTextState: editableTextState,
);
}

@override
FormBuilderFieldState<FormBuilderTextField, String> createState() =>
_FormBuilderTextFieldState();
Expand Down

0 comments on commit 71cf8db

Please sign in to comment.