DropdownTextField<T> class
A widget that displays a searchfield and a list of suggestions
when the searchfield is brought into focus
see example/lib/country_search.dart
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- DropdownTextField
Constructors
-
DropdownTextField({Key? key, required List<
DropdownItem> list, bool autoCorrect = false, TextEditingController? controller, Widget emptyWidget = const SizedBox.shrink(), FocusNode? focusNode, bool hasOverlay = true, String labelText = "", String hintText = "", InputBorder border = const OutlineInputBorder(), InputDecoration? decoration, List<TextInputFormatter> ? inputFormatters, TextInputType? inputType, double itemHeight = 35.0, Color? marginColor, int maxSuggestionsInViewPort = 5, dynamic onSubmit(String)?, Offset? offset, dynamic onSuggestionTap(String)?, InputDecoration? searchInputDecoration, TextStyle? searchStyle, TextStyle? suggestionStyle, BoxDecoration? suggestionsDecoration, SuggestionDirection suggestionDirection = SuggestionDirection.down, Suggestion suggestionState = Suggestion.expand, BoxDecoration? suggestionItemDecoration, SuggestionAction? suggestionAction, TextInputAction? textInputAction, String? validator(String?)?})
Properties
- autoCorrect → bool
-
Defines whether to enable autoCorrect defaults to
true
final - border → InputBorder
-
final
- controller → TextEditingController?
-
Specifies the
TextEditingController
for DropdownTextField.final - decoration → InputDecoration?
-
final
- emptyWidget → Widget
-
Widget to show when the search returns
empty results.
defaults to SizedBox.shrink
final
- focusNode → FocusNode?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasOverlay → bool
-
if false the suggestions will be shown below
the searchfield along the Y-axis.
if true the suggestions will be shown floating like the
along the Z-axis
defaults to
true
final - hintText → String
-
final
-
initialValue
→ SearchFieldListItem<
T> ? -
The initial value to be selected for DropdownTextField. The value
must be present in suggestions.
final
-
inputFormatters
→ List<
TextInputFormatter> ? -
input formatter for the searchfield
final
- inputType → TextInputType?
-
Keyboard Type for SearchField
final
- itemHeight → double
-
Specifies height for each suggestion item in the list.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- labelText → String
-
final
-
list
→ List<
DropdownItem> -
List of suggestions for the searchfield.
each suggestion should have a unique searchKey
final
- marginColor → Color?
-
Specifies the color of margin between items in suggestions list.
final
- maxSuggestionsInViewPort → int
-
Specifies the number of suggestions that can be shown in viewport.
final
- offset → Offset?
-
suggestion List offset from the searchfield
The top left corner of the searchfield is the origin (0,0)
final
- onSubmit → dynamic Function(String)?
-
Callback when the Searchfield is submitted
it returns the text from the searchfield
final
- onSuggestionTap → dynamic Function(String)?
-
Callback when the suggestion is selected.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- searchInputDecoration → InputDecoration?
-
Specifies InputDecoration for search input TextField.
final
- searchStyle → TextStyle?
-
Specifies TextStyle for search input.
final
- suggestionAction → SuggestionAction?
-
Specifies the SuggestionAction called on suggestion tap.
final
- suggestionDirection → SuggestionDirection
-
suggestion direction defaults to SuggestionDirection.up
if hasOverlay is
false
then the direction is ignored and the suggestions are shown below the searchfield when suggestionDirection and offset is specified then suggestionDirection is ignored.final - suggestionItemDecoration → BoxDecoration?
-
Specifies BoxDecoration for items in suggestion list. The property can be used to add BoxShadow,
and much more. For more information, checkout BoxDecoration.
final
-
suggestions
→ List<
SearchFieldListItem< T> > -
final
- suggestionsDecoration → BoxDecoration?
-
Specifies BoxDecoration for suggestion list. The property can be used to add BoxShadow, BoxBorder
and much more. For more information, checkout BoxDecoration.
final
- suggestionState → Suggestion
-
defaults to SuggestionState.expand
final
- suggestionStyle → TextStyle?
-
Specifies TextStyle for suggestions when no child is provided.
final
- textInputAction → TextInputAction?
-
Define a TextInputAction that is called when the field is submitted
final
- validator → String? Function(String?)?
-
validator
for the DropdownTextField to make use of this validator, The SearchField widget needs to be wrapped in a Form and pass it a Global key and write your validation logic in the validator you can define a global keyfinal
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → DropdownTextFieldState< 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, int wrapWidth = 65}) → 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