TypeAheadField<T> class
A TextField that displays a list of suggestions as the user types
See also:
- TypeAheadFormField, a FormField implementation of TypeAheadField that allows the value to be saved, validated, etc.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- TypeAheadField
Constructors
-
TypeAheadField({Key? key, required SuggestionsCallback<
T> suggestionsCallback, required ItemBuilder<T> itemBuilder, required SuggestionSelectionCallback<T> onSuggestionSelected, TextFieldConfiguration textFieldConfiguration = const TextFieldConfiguration(), SuggestionsBoxDecoration suggestionsBoxDecoration = const SuggestionsBoxDecoration(), Duration debounceDuration = const Duration(milliseconds: 300), SuggestionsBoxController? suggestionsBoxController, ScrollController? scrollController, WidgetBuilder? loadingBuilder, WidgetBuilder? noItemsFoundBuilder, ErrorBuilder? errorBuilder, AnimationTransitionBuilder? transitionBuilder, double animationStart = 0.25, Duration animationDuration = const Duration(milliseconds: 500), bool getImmediateSuggestions = false, double suggestionsBoxVerticalOffset = 5.0, AxisDirection direction = AxisDirection.down, bool hideOnLoading = false, bool hideOnEmpty = false, bool hideOnError = false, bool hideSuggestionsOnKeyboardHide = true, bool keepSuggestionsOnLoading = true, bool keepSuggestionsOnSuggestionSelected = false, bool autoFlipDirection = false, bool hideKeyboard = false, int minCharsForSuggestions = 0}) - Creates a TypeAheadField
Properties
- animationDuration → Duration
-
The duration that transitionBuilder animation takes.
final
- animationStart → double
-
The value at which the transitionBuilder animation starts.
final
- autoFlipDirection → bool
-
If set to true, in the case where the suggestions box has less than
_SuggestionsBoxController.minOverlaySpace to grow in the desired direction, the direction axis
will be temporarily flipped if there's more room available in the opposite
direction.
final
- debounceDuration → Duration
-
The duration to wait after the user stops typing before calling
suggestionsCallback
final
- direction → AxisDirection
-
Determine the
SuggestionBox
's direction.final - errorBuilder → ErrorBuilder?
-
Called when suggestionsCallback throws an exception.
final
- getImmediateSuggestions → bool
-
If set to true, suggestions will be fetched immediately when the field is
added to the view.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hideKeyboard → bool
-
final
- hideOnEmpty → bool
-
If set to true, nothing will be shown if there are no results.
noItemsFoundBuilder will also be ignored.
final
- hideOnError → bool
-
If set to true, nothing will be shown if there is an error.
errorBuilder will also be ignored.
final
- hideOnLoading → bool
-
If set to true, no loading box will be shown while suggestions are
being fetched. loadingBuilder will also be ignored.
final
- hideSuggestionsOnKeyboardHide → bool
-
If set to false, the suggestions box will stay opened after
the keyboard is closed.
final
-
itemBuilder
→ ItemBuilder<
T> -
Called for each suggestion returned by suggestionsCallback to build the
corresponding widget.
final
- keepSuggestionsOnLoading → bool
-
If set to false, the suggestions box will show a circular
progress indicator when retrieving suggestions.
final
- keepSuggestionsOnSuggestionSelected → bool
-
If set to true, the suggestions box will remain opened even after
selecting a suggestion.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadingBuilder → WidgetBuilder?
-
Called when waiting for suggestionsCallback to return.
final
- minCharsForSuggestions → int
-
The minimum number of characters which must be entered before
suggestionsCallback is triggered.
final
- noItemsFoundBuilder → WidgetBuilder?
-
Called when suggestionsCallback returns an empty array.
final
-
onSuggestionSelected
→ SuggestionSelectionCallback<
T> -
Called when a suggestion is tapped.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController?
-
used to control the scroll behavior of item-builder list
final
- suggestionsBoxController → SuggestionsBoxController?
-
Used to control the
_SuggestionsBox
. Allows manual control to open, close, toggle, or resize the_SuggestionsBox
.final - suggestionsBoxDecoration → SuggestionsBoxDecoration
-
The decoration of the material sheet that contains the suggestions.
final
- suggestionsBoxVerticalOffset → double
-
How far below the text field should the suggestions box be
final
-
suggestionsCallback
→ SuggestionsCallback<
T> -
Called with the search pattern to get the search suggestions.
final
- textFieldConfiguration → TextFieldConfiguration
-
The configuration of the TextField
that the TypeAhead widget displays
final
- transitionBuilder → AnimationTransitionBuilder?
-
Called to display animations when suggestionsCallback returns suggestions
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _TypeAheadFieldState< T> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of
DiagnosticsNode
objects describing this node's children.inherited -
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited