AutoCompleteTextField<T> constructor
const
AutoCompleteTextField<T> ({
- required dynamic itemSubmitted(
- T
- @required GlobalKey<
AutoCompleteTextFieldState< ? key,T> > - @required StreamController<
List< ? placeSuggestionController,T> > - @required AutoCompleteOverlayItemBuilder<
T> ? itemBuilder, - @required Comparator<
T> ? itemSorter, - @required Filter<
T> ? itemFilter, - List<
TextInputFormatter> ? inputFormatters, - TextStyle? style,
- InputDecoration? decoration = const InputDecoration(),
- StringCallback? textChanged,
- StringCallback? textSubmitted,
- ValueSetter<
bool> ? onFocusChanged, - TextInputType? keyboardType = TextInputType.text,
- int? suggestionsAmount = 5,
- bool? submitOnSuggestionTap = true,
- bool? clearOnSubmit = true,
- TextInputAction? textInputAction = TextInputAction.done,
- TextCapitalization? textCapitalization = TextCapitalization.sentences,
- int? minLength = 1,
- TextEditingController? controller,
- FocusNode? focusNode,
- required Color suggestionBackgroundColor,
- required Color suggestionDividerColor,
Implementation
const AutoCompleteTextField(
{required this.itemSubmitted, //Callback on item selected, this is the item selected of type <T>
@required
this.key, //GlobalKeylobalKey used to enable addSuggestion etc
@required
this.placeSuggestionController, //Suggestions that will be displayed
@required
this.itemBuilder, //Callback to build each item, return a Widget
@required
this.itemSorter, //Callback to sort items in the form (a of type <T>, b of type <T>)
@required
this.itemFilter, //Callback to filter item: return true or false depending on input text
this.inputFormatters,
this.style,
this.decoration = const InputDecoration(),
this.textChanged, //Callback on input text changed, this is a string
this.textSubmitted, //Callback on input text submitted, this is also a string
this.onFocusChanged,
this.keyboardType = TextInputType.text,
this.suggestionsAmount =
5, //The amount of suggestions to show, larger values may result in them going off screen
this.submitOnSuggestionTap =
true, //Call textSubmitted on suggestion tap, itemSubmitted will be called no matter what
this.clearOnSubmit = true, //Clear autoCompleteTextfield on submit
this.textInputAction = TextInputAction.done,
this.textCapitalization = TextCapitalization.sentences,
this.minLength = 1,
this.controller,
this.focusNode, required this.suggestionBackgroundColor, required this.suggestionDividerColor})
: super(key: key);