TDropdown<T> class
A generic dropdown widget that supports various styles and configurations.
- Supports async data loading, search functionality, and different popup styles.
- Allows customization of decoration, validation, and item formatting.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- TDropdown
Constructors
-
TDropdown.new({Key? key, required FutureOr<
List< items(String query, LoadProps?)?, T? selectedItem, String? labelText, String hintText = 'Select an option', void onChanged(T?)?, bool showSearchBox = false, DropdownPopupStyle popupStyle = DropdownPopupStyle.menu, Widget? title, String itemAsString(T)?, bool filterFn(T, String)?, String? validator(T?)?, bool enabled = true, Duration? searchDelay, Widget loadingIndicator = const CircularProgressIndicator(), String noResultsText = "No results found", bool compareFn(T, T)?, Widget? icon, Color? iconColor, String? errorText, String? helperText, Widget? suffixIcon, Widget? prefixIcon})T> > -
const
Properties
- compareFn → bool Function(T, T)?
-
Function to compare two items.
final
- enabled → bool
-
Whether the dropdown is enabled.
final
- errorText → String?
-
Error text displayed when validation fails.
final
- filterFn → bool Function(T, String)?
-
Function to filter search results.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- helperText → String?
-
Helper text displayed below the dropdown.
final
- hintText → String
-
Hint text displayed inside the dropdown.
final
- icon → Widget?
-
Icon for the dropdown.
final
- iconColor → Color?
-
Color of the dropdown icon.
final
- itemAsString → String Function(T)?
-
Function to convert items to string representation.
final
-
items
→ FutureOr<
List< Function(String query, LoadProps?)?T> > -
Function that provides items asynchronously or synchronously.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- labelText → String?
-
Label text for the dropdown.
final
- loadingIndicator → Widget
-
Widget shown when loading data.
final
- noResultsText → String
-
Text displayed when no results are found.
final
- onChanged → void Function(T?)?
-
Callback triggered when the selection changes.
final
- popupStyle → DropdownPopupStyle
-
Style of the dropdown popup (e.g., menu, modal, dialog, bottom sheet).
final
- prefixIcon → Widget?
-
Prefix icon displayed inside the dropdown field.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- searchDelay → Duration?
-
Delay duration for search input processing.
final
- selectedItem → T?
-
The currently selected item.
final
- showSearchBox → bool
-
Whether to display a search box inside the dropdown popup.
final
- suffixIcon → Widget?
-
Suffix icon displayed inside the dropdown field.
final
- title → Widget?
-
Optional title displayed in some popup styles.
final
- validator → String? Function(T?)?
-
Validator function for form validation.
final
Methods
-
bottomSheetStyle(
BuildContext context) → PopupProps< T> -
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's 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
-
dialogStyle(
BuildContext context) → PopupProps< T> -
modalStyle(
BuildContext context) → PopupProps< T> -
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