AppDropdown<T> class

A custom dropdown widget that wraps DropdownButtonFormField2 with standard styling and optional search functionality.

This widget provides a consistent look and feel for dropdowns across the app, with built-in support for validation, custom item builders, and search.

Example usage:

AppDropdown<String>(
  hint: 'Select an option',
  items: ['Option 1', 'Option 2', 'Option 3'],
  builder: (item) => item.toString(),
  onChanged: (value) => print('Selected: $value'),
)
Inheritance

Constructors

AppDropdown({Key? key, T? value, required String hint, required List<T> items, required Widget builder(T), ValueSetter<T?>? onChanged, String? validator(T?)?, Color? fillColor, double? vPadding, double? width, TextEditingController? searchController, bool searchMatchFn(DropdownItem<T>, String)?})
const

Properties

builder → Widget Function(T)
A function that builds the widget for each item in the items list.
final
fillColor → Color?
The background color of the dropdown.
final
hashCode → int
The hash code for this object.
no setterinherited
hint → String
The text to display when no item is selected.
final
items → List<T>
The list of items to display in the dropdown.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onChanged → ValueSetter<T?>?
Callback function called when the user selects an item.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
searchController → TextEditingController?
Optional controller for the search field. If provided, search functionality is enabled.
final
searchMatchFn → bool Function(DropdownItem<T>, String)?
Optional function to filter items based on search text.
final
validator → String? Function(T?)?
Optional validator function for use within a Form.
final
value → T?
The currently selected value.
final
vPadding → double?
Vertical padding for the dropdown content.
final
width → double?
The width of the dropdown widget.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<AppDropdown<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