DropdownSuperFormField<T> class
Regular material DropdownButton wrapped in InputDecorator that extends SuperFormField
This widget's state automatically registers field for name so there is no need for manual registration.
Specify rules to add validation for this field. Errors will be displayed automatically as errorText of InputDecoration. Overriding this property will hide errors from validation.
If enabled
is set to false, the field will be displayed as disabled.
If non-null this property overrides the decoration
's
InputDecoration.enabled property.
Most fields are kept the same as in DropdownButton so see there for documentation of specific properties.
DropdownSuperFormField(
name: "employment_status",
items: const [
DropdownMenuItem(value: "employed", child: Text("Employed")),
DropdownMenuItem(value: "self-employed", child: Text("Self-employed")),
DropdownMenuItem(value: "student", child: Text("Student")),
DropdownMenuItem(value: "unemployed", child: Text("Unemployed")),
DropdownMenuItem(value: "retired", child: Text("Retired")),
],
rules: [RequiredRule("Cannot be empty")],
)
See also:
- DropdownButton, which is non-connected version of this widget
DropdownButtonField
, which is Flutter form version of this widget
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SuperFormField
- DropdownSuperFormField
Constructors
-
DropdownSuperFormField({Key? key, required String name, List<
SuperFormFieldRule> ? rules, required List<DropdownMenuItem< ? items, DropdownButtonBuilder? selectedItemBuilder, Widget? hint, Widget? disabledHint, VoidCallback? onTap, int elevation = 8, TextStyle? style, Widget? icon, Color? iconDisabledColor, Color? iconEnabledColor, double iconSize = 24.0, bool isDense = true, bool isExpanded = false, double? itemHeight, Color? focusColor, FocusNode? focusNode, bool autofocus = false, Color? dropdownColor, InputDecoration? decoration, ValueChanged<T> >T?> ? onChanged, bool? enabled})
Properties
- builder → SuperFormFieldBuilder
-
finalinherited
- focusNode → FocusNode?
-
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- name → String
-
Name of the field
finalinherited
- noFormFallback → Widget
-
Fallback widget for a case where SuperForm ancestor is unavailable
finalinherited
-
rules
→ List<
SuperFormFieldRule> -
Field validation rules
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → SuperFormFieldState -
Creates the mutable state for this widget at a given location in the tree.
inherited
-
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