SignalDropdown<T> class
A reactive DropdownButtonFormField bound to a Field<T>.
Writes the selected item's value to field.value and calls Field.touch
on selection. Field.error appears as InputDecoration.errorText once the
field is touched.
T is the type of the selected dropdown value.
field is the backing Field<T>.
items is the list of DropdownMenuItem entries shown in the overlay.
decoration wraps the dropdown button with a Material InputDecoration.
hint is shown when no value is selected (placeholder).
disabledHint is shown instead of hint when enabled is false.
onChanged is called after field.value is updated on each selection.
onTap fires when the user taps the dropdown button (before the overlay opens).
enabled — when false, the dropdown is read-only and visually dimmed.
focusNode overrides the internally managed FocusNode.
Example:
final country = Field<String>('country')
..required(message: 'Selecione um país');
SignalDropdown<String>(
field: country,
decoration: const InputDecoration(labelText: 'País'),
hint: const Text('Selecione...'),
items: const [
DropdownMenuItem(value: 'BR', child: Text('Brasil')),
DropdownMenuItem(value: 'US', child: Text('Estados Unidos')),
DropdownMenuItem(value: 'PT', child: Text('Portugal')),
],
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SignalDropdown
Constructors
-
SignalDropdown({Key? key, required Field<
T> field, required List<DropdownMenuItem< items, InputDecoration decoration = const InputDecoration(), Widget? hint, Widget? disabledHint, ValueChanged<T> >T?> ? onChanged, VoidCallback? onTap, bool enabled = true, FocusNode? focusNode}) -
const
Properties
- decoration → InputDecoration
-
final
- disabledHint → Widget?
-
final
- enabled → bool
-
final
-
field
→ Field<
T> -
final
- focusNode → FocusNode?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hint → Widget?
-
final
-
items
→ List<
DropdownMenuItem< T> > -
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
onChanged
→ ValueChanged<
T?> ? -
final
- onTap → VoidCallback?
-
final
- 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(
) → State< SignalDropdown< 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