CupertinoTypeAheadField<T> class
A CupertinoTextField 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
- CupertinoTypeAheadField
Constructors
-
CupertinoTypeAheadField({Key? key, required SuggestionsCallback<
T> suggestionsCallback, required ItemBuilder<T> itemBuilder, IndexedWidgetBuilder? itemSeparatorBuilder, required SuggestionSelectionCallback<T> onSuggestionSelected, CupertinoTextFieldConfiguration textFieldConfiguration = const CupertinoTextFieldConfiguration(), CupertinoSuggestionsBoxDecoration suggestionsBoxDecoration = const CupertinoSuggestionsBoxDecoration(), Duration debounceDuration = const Duration(milliseconds: 300), CupertinoSuggestionsBoxController? suggestionsBoxController, 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 autoFlipListDirection = true, double autoFlipMinHeight = 64.0, int minCharsForSuggestions = 0, bool hideKeyboardOnDrag = true}) -
Creates a CupertinoTypeAheadField
const
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
- autoFlipListDirection → bool
-
If set to false, suggestion list will not be reversed according to the
autoFlipDirection property.
final
- autoFlipMinHeight → double
-
Minimum height below autoFlipDirection is triggered
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
- hideKeyboardOnDrag → bool
-
If set to true and if the user scrolls through the suggestion list, hide the keyboard automatically.
If set to false, the keyboard remains visible.
Throws an exception, if hideKeyboardOnDrag and hideSuggestionsOnKeyboardHide are both set to true as
they are mutual exclusive.
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
- itemSeparatorBuilder → IndexedWidgetBuilder?
-
Item separator builder
same as ListView.separated.separatorBuilder
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
- suggestionsBoxController → CupertinoSuggestionsBoxController?
-
Used to control the
_SuggestionsBox
. Allows manual control to open, close, toggle, or resize the_SuggestionsBox
.final - suggestionsBoxDecoration → CupertinoSuggestionsBoxDecoration
-
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 → CupertinoTextFieldConfiguration
-
The configuration of the CupertinoTextField
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(
) → State< CupertinoTypeAheadField< 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