Skip to content

Commit

Permalink
Made onSuggestionSelected available to outside widget
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpanic authored Jun 5, 2019
1 parent 4635846 commit fbb2cad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/src/fields/form_builder_typeahead.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FormBuilderTypeAhead<T> extends StatefulWidget {
final Duration debounceDuration;
final SuggestionsBoxDecoration suggestionsBoxDecoration;

// final SuggestionSelectionCallback<T> onSuggestionSelected;
final SuggestionSelectionCallback<T> onSuggestionSelected;
final ItemBuilder<T> itemBuilder;
final SuggestionsCallback<T> suggestionsCallback;
final double suggestionsBoxVerticalOffset;
Expand All @@ -39,7 +39,7 @@ class FormBuilderTypeAhead<T> extends StatefulWidget {

FormBuilderTypeAhead({
@required this.attribute,
// @required this.onSuggestionSelected,
this.onSuggestionSelected,
@required this.itemBuilder,
@required this.suggestionsCallback,
this.initialValue,
Expand Down Expand Up @@ -132,6 +132,7 @@ class _FormBuilderTypeAheadState extends State<FormBuilderTypeAhead> {
transitionBuilder: (context, suggestionsBox, controller) =>
suggestionsBox,
onSuggestionSelected: (suggestion) {
if (widget.onSuggestionSelected != null) widget.onSuggestionSelected(suggestion);
_typeAheadController.text = suggestion;
},
getImmediateSuggestions: widget.getImmediateSuggestions,
Expand Down

0 comments on commit fbb2cad

Please sign in to comment.