AutoComplete constructor
const
AutoComplete({
- Key? key,
- required List<
String> suggestions, - required Widget child,
- BoxConstraints? popoverConstraints,
- PopoverConstraint? popoverWidthConstraint,
- AlignmentDirectional? popoverAnchorAlignment,
- AlignmentDirectional? popoverAlignment,
- AutoCompleteMode? mode,
- AutoCompleteCompleter completer = _defaultCompleter,
Creates an AutoComplete widget.
Wraps the provided child
with autocomplete functionality using the
given suggestions
list. The popover appearance and behavior can be
customized through the optional positioning and constraint parameters.
Parameters:
suggestions
(Listchild
(Widget, required): widget to receive autocomplete functionalitypopoverConstraints
(BoxConstraints?, optional): popover size limitspopoverWidthConstraint
(PopoverConstraint?, optional): width strategypopoverAnchorAlignment
(AlignmentDirectional?, optional): anchor pointpopoverAlignment
(AlignmentDirectional?, optional): popover align pointmode
(AutoCompleteMode?, optional): text replacement strategycompleter
(AutoCompleteCompleter, default: identity): suggestion processor
Example:
AutoComplete(
suggestions: suggestions,
mode: AutoCompleteMode.append,
completer: (text) => '$text ',
child: TextField(),
)
Implementation
const AutoComplete({
super.key,
required this.suggestions,
required this.child,
this.popoverConstraints,
this.popoverWidthConstraint,
this.popoverAnchorAlignment,
this.popoverAlignment,
this.mode,
this.completer = _defaultCompleter,
});