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. Radius? cursorRadius,
  14. double? cursorWidth,
  15. Color? cursorColor,
  16. bool? showCursor,
  17. TextInputType keyboardType = TextInputType.text,
  18. int suggestionsAmount = 5,
  19. bool submitOnSuggestionTap = true,
  20. bool clearOnSubmit = true,
  21. TextInputAction textInputAction = TextInputAction.done,
  22. TextCapitalization textCapitalization = TextCapitalization.sentences,
  23. bool autocorrect = false,
  24. int minLength = 1,
  25. TextEditingController? controller,
  26. FocusNode? focusNode,
  27. bool autofocus = false,
  28. bool unFocusOnItemSubmitted = true,
})

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.cursorRadius,
    this.cursorWidth,
    this.cursorColor,
    this.showCursor,
    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.autocorrect:
        false, //set the autoroccection on the internal text input field
    this.minLength = 1,
    this.controller,
    this.focusNode,
    this.autofocus = false,
    this.unFocusOnItemSubmitted = true})
    : super(key: key);