Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/reactive_flutter_typeahead/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@

## [2.1.2]

* FIX: Suggestion box was not closed on selection

## [2.1.1]

* Support `reactive_forms: 17.x`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ class ReactiveTypeAhead<T, V> extends ReactiveFormField<T, V> {

state._setFocusNode(focusNode);
final controller = textEditingController ?? state._textController;
final fieldSuggestionsController =
suggestionsController ?? state._suggestionsController;
if (field.value != null) {
controller.text = stringify(field.value as V);
}
Expand All @@ -147,6 +149,7 @@ class ReactiveTypeAhead<T, V> extends ReactiveFormField<T, V> {
controller.text = stringify(value);
field.didChange(value);
onSuggestionSelected?.call(value);
fieldSuggestionsController.close(); // close the suggestions box
},
builder: (context, controller, focusNode) {
// Keep the selected value in the text field
Expand Down Expand Up @@ -186,7 +189,7 @@ class ReactiveTypeAhead<T, V> extends ReactiveFormField<T, V> {
},
decorationBuilder: decorationBuilder,
debounceDuration: debounceDuration,
suggestionsController: suggestionsController,
suggestionsController: fieldSuggestionsController,
loadingBuilder: loadingBuilder,
emptyBuilder: emptyBuilder,
errorBuilder: errorBuilder,
Expand Down Expand Up @@ -217,6 +220,8 @@ class ReactiveTypeAhead<T, V> extends ReactiveFormField<T, V> {

class _ReactiveTypeaheadState<T, V> extends ReactiveFormFieldState<T, V> {
late TextEditingController _textController;
late SuggestionsController<V> _suggestionsController;

FocusNode? _focusNode;
late FocusController _focusController;

Expand All @@ -226,6 +231,7 @@ class _ReactiveTypeaheadState<T, V> extends ReactiveFormFieldState<T, V> {
@override
void initState() {
super.initState();
_suggestionsController = SuggestionsController<V>();

final initialValue = value;
_textController = TextEditingController(
Expand Down
2 changes: 1 addition & 1 deletion packages/reactive_flutter_typeahead/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: reactive_flutter_typeahead
description: Wrapper around flutter_typeahead to use with reactive_forms.
version: 2.1.1
version: 2.1.2
repository: https://github.com/artflutter/reactive_forms_widgets/tree/master/packages/reactive_flutter_typeahead
issue_tracker: https://github.com/artflutter/reactive_forms_widgets/issues

Expand Down
Loading