AutoCompleteTextFieldState<T> constructor
AutoCompleteTextFieldState<T> (
- List<
T> suggestions, - StringCallback? textChanged,
- StringCallback? textSubmitted,
- ValueSetter<
bool> ? onFocusChanged, - InputEventCallback<
T> ? itemSubmitted, - AutoCompleteOverlayItemBuilder<
T> ? itemBuilder, - Comparator<
T> ? itemSorter, - Filter<
T> ? itemFilter, - int suggestionsAmount,
- bool submitOnSuggestionTap,
- bool clearOnSubmit,
- int minLength,
- List<
TextInputFormatter> ? inputFormatters, - TextCapitalization textCapitalization,
- InputDecoration decoration,
- TextStyle? style,
- TextInputType keyboardType,
- TextInputAction textInputAction,
- TextEditingController? controller,
- Color? cursorColor,
- Radius? cursorRadius,
- double? cursorWidth,
- bool? showCursor,
- FocusNode? focusNode,
- bool autofocus,
- bool unFocusOnItemSubmitted,
- bool autocorrect,
Implementation
AutoCompleteTextFieldState(
this.suggestions,
this.textChanged,
this.textSubmitted,
this.onFocusChanged,
this.itemSubmitted,
this.itemBuilder,
this.itemSorter,
this.itemFilter,
this.suggestionsAmount,
this.submitOnSuggestionTap,
this.clearOnSubmit,
this.minLength,
this.inputFormatters,
this.textCapitalization,
this.decoration,
this.style,
this.keyboardType,
this.textInputAction,
this.controller,
this.cursorColor,
this.cursorRadius,
this.cursorWidth,
this.showCursor,
this.focusNode,
this.autofocus,
this.unFocusOnItemSubmitted,
this.autocorrect) {
textField = new TextField(
inputFormatters: inputFormatters,
textCapitalization: textCapitalization,
decoration: decoration,
style: style,
cursorColor: cursorColor ?? Colors.black,
showCursor: showCursor ?? true,
cursorWidth: cursorWidth ?? 1,
cursorRadius: cursorRadius ?? const Radius.circular(2.0),
keyboardType: keyboardType,
focusNode: focusNode ?? new FocusNode(),
autofocus: autofocus,
controller: controller ?? new TextEditingController(),
textInputAction: textInputAction,
autocorrect: autocorrect,
onChanged: (newText) {
currentText = newText;
updateOverlay(newText);
if (textChanged != null) {
textChanged!(newText);
}
},
onTap: () {
updateOverlay(currentText);
},
onSubmitted: (submittedText) =>
triggerSubmitted(submittedText: submittedText),
);
if (this.controller != null) {
currentText = this.controller!.text;
}
textField!.focusNode!.addListener(() {
if (onFocusChanged != null) {
onFocusChanged!(textField!.focusNode!.hasFocus);
}
if (!textField!.focusNode!.hasFocus) {
filteredSuggestions = [];
updateOverlay();
} else if (currentText != "") {
updateOverlay(currentText);
}
});
}