AutoCompleteTextField<T> constructor
AutoCompleteTextField<T> ({
- required InputEventCallback<
T> ? itemSubmitted, - required GlobalKey<
AutoCompleteTextFieldState< key,T> > - required List<
T> suggestions, - 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,
Implementation
AutoCompleteTextField(
{required this.itemSubmitted, //Callback on item selected, this is the item selected of type <T>
required this.key, //GlobalKey used to enable addSuggestion etc
required this.suggestions, //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})
: super(key: key);