InputAutoCompleteFeature class

Adds autocomplete functionality to the input field.

Displays a popover with suggestions as the user types. Suggestions are provided by the querySuggestions callback and can be selected to fill the input.

Example:

TextField(
  features: [
    InputAutoCompleteFeature(
      querySuggestions: (query) async {
        return ['apple', 'apricot', 'avocado']
            .where((s) => s.startsWith(query));
      },
      child: const Text('Fruits'),
    ),
  ],
)
Inheritance

Constructors

InputAutoCompleteFeature({InputFeatureVisibility visibility = InputFeatureVisibility.always, bool skipFocusTraversal = true, required SuggestionBuilder querySuggestions, required Widget child, BoxConstraints? popoverConstraints, PopoverConstraint? popoverWidthConstraint, AlignmentDirectional? popoverAnchorAlignment, AlignmentDirectional? popoverAlignment, AutoCompleteMode mode = AutoCompleteMode.replaceWord})
Creates an InputAutoCompleteFeature.
const

Properties

child Widget
Child widget displayed in the suggestion list.
final
hashCode int
The hash code for this object.
no setterinherited
mode AutoCompleteMode
Autocomplete mode (e.g., popover or inline).
final
popoverAlignment AlignmentDirectional?
Popover alignment relative to the anchor.
final
popoverAnchorAlignment AlignmentDirectional?
Anchor alignment for the popover.
final
popoverConstraints BoxConstraints?
Constraints for the popover size.
final
popoverWidthConstraint PopoverConstraint?
Width constraint for the popover.
final
querySuggestions SuggestionBuilder
Callback to provide suggestions for a given query.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
skipFocusTraversal bool
Whether to skip this feature in focus traversal.
finalinherited
visibility InputFeatureVisibility
Visibility mode for this input feature.
finalinherited

Methods

createState() InputFeatureState<InputFeature>
Creates the state for this input feature.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited