SelectField<T> class
Input field for creating a dropdown list of options
that users can select from.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SelectField
Constructors
-
SelectField({Key? key, required List<
Option< options, Option<T> >T> ? initialOption, void onTextChanged(String value)?, void onOptionSelected(Option<T> option)?, TextEditingController? textController, FocusNode? focusNode, void onTap()?, void onTapOutside()?, String? hint, InputDecoration? inputDecoration, TextStyle? inputStyle, TextAlign textAlign = TextAlign.start, IconBuilder? prefixIconBuilder, IconBuilder? suffixIconBuilder, Widget optionBuilder(BuildContext context, Option<T> option, bool isSelected, void onOptionSelected(Option<T> option))?, SearchOptions<T> ? searchOptions, String? restorationId, StrutStyle? strutStyle, TextDirection? textDirection, TextAlignVertical? textAlignVertical, int maxLines = 1, bool? enabled, void onSaved(String? value)?, String? validator(String? value)?}) -
const
Properties
- enabled → bool?
-
Whether the input field is able to receive user input. Defaults to
true.final - focusNode → FocusNode?
-
See FocusNode
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hint → String?
-
Textthat suggests what sort of input the field accepts.final -
initialOption
→ Option<
T> ? -
Initial option to display in input field
final
- inputDecoration → InputDecoration?
-
The
border,labels,icons, andstylesused to decorateinput field.final - inputStyle → TextStyle?
-
Style describing how to format and paint
textofinput field.final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxLines → int
-
Maximum lines of text in input field. Defaults to
1.final -
Allows you to control menu's behavior or add a custom control.
final
-
Allows
customizationofdropdown menu.final -
Positions menu
beloworaboveinput field.final -
onOptionSelected
→ void Function(Option<
T> option)? -
Callback when user
selectstheoptionfinal - onSaved → void Function(String? value)?
-
Method to call with the final value when the form is saved via FormState.save.
final
- onTap → void Function()?
-
Callback when input field is tapped.
final
- onTapOutside → void Function()?
-
Callback when tapped outside input field and options' menu.
final
- onTextChanged → void Function(String value)?
-
Callback on
text changein input fieldfinal -
optionBuilder
→ Widget Function(BuildContext context, Option<
T> option, bool isSelected, void onOptionSelected(Option<T> option))? -
Callback for creating
custom option widget.final -
options
→ List<
Option< T> > -
List of options for the select field menu.
final
- prefixIconBuilder → IconBuilder?
-
An icon that appears before the InputDecoration.prefix or InputDecoration.prefixText
and before the editable part of the input field.
final
- restorationId → String?
-
Restoration ID to save and restore the state of the form field.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
searchOptions
→ SearchOptions<
T> ? -
By providing SearchOptions search is enabled. Note that options' widget height is now fixed to a provided value.
final
- strutStyle → StrutStyle?
-
Defines the strut, which sets the minimum height a line can be relative to the baseline.
See TextFormField for more.
final
- suffixIconBuilder → IconBuilder?
-
An icon that appears after the editable part of the text field and after the
InputDecoration.suffix or InputDecoration.suffixText.
final
- textAlign → TextAlign
-
Whether and how to align text horizontally in input field
final
- textAlignVertical → TextAlignVertical?
-
The vertical alignment of text within an input box.
final
- textController → TextEditingController?
-
Specifies the TextEditingController for SelectField.
final
- textDirection → TextDirection?
-
A direction in which text flows.
final
- validator → String? Function(String? value)?
-
Method that validates an input.
Returns an error string to display if the input is invalid, or null otherwise.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< SelectField< 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