AutoCompleteTextField<T> constructor

AutoCompleteTextField<T>({
  1. required InputEventCallback<T>? itemSubmitted,
  2. required GlobalKey<AutoCompleteTextFieldState<T>> key,
  3. required List<T> suggestions,
  4. required AutoCompleteOverlayItemBuilder<T>? itemBuilder,
  5. required Comparator<T>? itemSorter,
  6. required Filter<T>? itemFilter,
  7. List<TextInputFormatter>? inputFormatters,
  8. TextStyle? style,
  9. InputDecoration decoration = const InputDecoration(),
  10. StringCallback? textChanged,
  11. StringCallback? textSubmitted,
  12. ValueSetter<bool>? onFocusChanged,
  13. TextInputType keyboardType = TextInputType.text,
  14. int suggestionsAmount = 5,
  15. bool submitOnSuggestionTap = true,
  16. bool clearOnSubmit = true,
  17. TextInputAction textInputAction = TextInputAction.done,
  18. TextCapitalization textCapitalization = TextCapitalization.sentences,
  19. int minLength = 1,
  20. TextEditingController? controller,
  21. 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);