ZeroDropdown<T> class

ZeroDropdown is built on top of ZeroDropdownButton and ZeroTextField to simplify the implementation of the widget This uses decoration taken from InputDecorationType.

Inheritance

Constructors

ZeroDropdown.new({Key? key, required dynamic onChanged(dynamic), required List<T> items, String? labelText, String? hintText, String? helperText, String? errorText, TextStyle? labelStyle, TextStyle? hintStyle, TextStyle? helperStyle, TextStyle? errorStyle, Widget? prefixIcon, Widget? suffixIcon, double? itemHeight, double? dropdownWidth, bool? alignedDropdown, T? value, Widget menuItemBuilder(T)?, Widget selectedMenuItemBuilder(T)?, InputDecorationType inputDecorationType = InputDecorationType.outline, ZeroTextfieldSize? textfieldSize})
factory
ZeroDropdown.icon({Key? key, required dynamic onChanged(dynamic), required List<T> items, Widget? icon, double? size, double? dropdownWidth, T? value, Widget menuItemBuilder(T)?, Widget selectedMenuItemBuilder(T)?})
Constructor to create dropdown with only icon as the button. No Input Decoration needed
factory
ZeroDropdown.multiple({Key? key, required dynamic onChanged(dynamic), required List<T> items, String? labelText, String? hintText, String? helperText, String? errorText, TextStyle? labelStyle, TextStyle? hintStyle, TextStyle? helperStyle, TextStyle? errorStyle, Widget? prefixIcon, Widget? suffixIcon, List<T> selectedItems = const [], double? itemHeight, double? dropdownWidth, bool? alignedDropdown, T? value, Widget menuItemBuilder(T)?, Widget selectedMenuItemBuilder(T)?, InputDecorationType inputDecorationType = InputDecorationType.outline, MultipleItemsVariant? multipleItemsVariant, ZeroTextfieldSize textfieldSize = ZeroTextfieldSize.small, SelectedItemsStyle selectedItemsStyle = SelectedItemsStyle.text, dynamic onMenuStateChange(bool isOpen)?})
factory

Properties

alignedDropdown bool?
If false, the width of the dropdown will be larger than the dropdown button
final
ZeroDropdownMenuItem's width, the default value is equal to the screen's width
final
enabled bool?
final
enableMultipleItems bool
Default value: false If true, the dropdown menu item would become multi-selectable This, the dropdown would not be automatically closed when an item is checked/uncheck But rather user has to click outside or press back button
final
errorStyle TextStyle?
final
errorText String?
final
focusNode FocusNode?
final
hashCode int
The hash code for this object.
no setterinherited
helperStyle TextStyle?
final
helperText String?
final
hintText String?
final
icon Widget?
If set, this will override suffixIcon that is defined in InputDecoration
final
inputDecorationType InputDecorationType?
Types that are also used on ZeroTextField to provide default styling parameters based on the selected type: ZeroTextField.outline, ZeroTextField.rounded, ZeroTextField.filled, or ZeroTextField.underline
final
itemHeight double?
ZeroDropdownMenuItem's height, the default value is as per set on ZeroTextfieldSize.small height
final
items List<T>
List containing only all the values, not the ZeroDropdownMenuItem
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labelStyle TextStyle?
final
labelText String?
final
Builder to build default menu item widget If not set, it will default to _MenuItem
final
multipleItemsVariant MultipleItemsVariant?
Variant on whether the Dropdown menu item contains only text or text with a checkbox values: MultipleItemsVariant.plain and MultipleItemsVariant.checkboxes
final
onChanged → dynamic Function(T?)?
final
onMenuStateChange → dynamic Function(bool isOpen)?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedItems List<T>
List containing only the selected values, not the ZeroDropdownMenuItem
final
selectedItemsStyle SelectedItemsStyle
Default value: SelectedItemsStyle.text Only used when parameter enableMultiItems of ZeroDropdown is true.
final
selectedMenuItemBuilder Widget Function(T)?
Builder to build selected menu item widget If not set, it will default to _MenuItem
final
textfieldSize ZeroTextfieldSize
Default value: ZeroTextfieldSize.small
final
value → T?
The value of the last selected item. If enableMultipleItems is true, then the value would be the last selectedItems element
final
variant DropdownVariant?
Indicates whether it is a form ZeroDropdownButton or an icon one.
final

Methods

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