CustomDropdown<T> class
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- CustomDropdown
Constructors
-
CustomDropdown({Key? key, required List<
T> ? items, required dynamic onChanged(T?)?, SingleSelectController<T?> ? controller, ScrollController? itemsScrollController, T? initialItem, String? hintText, String? labelText, Widget? label, CustomDropdownDecoration? decoration, String? validator(T?)?, bool validateOnChange = true, dynamic visibility(bool)?, OverlayPortalController? overlayController, _ListItemBuilder<T> ? listItemBuilder, _HeaderBuilder<T> ? headerBuilder, _HintBuilder? hintBuilder, int maxlines = 1, TextAlign textAlign = TextAlign.start, double? overlayHeight, EdgeInsets? closedHeaderPadding, EdgeInsets? expandedHeaderPadding, EdgeInsets? itemsListPadding, EdgeInsets? listItemPadding, bool canCloseOutsideBounds = true, bool hideSelectedFieldWhenExpanded = false, bool excludeSelected = true, bool enabled = true, bool canClearSelection = false, bool selectOnItemTap = true, CustomDropdownAnimation animation = const CustomDropdownAnimation(), bool initiallyOpen = false, bool autofocusOnSearch = false, DropdownOverlayDirection overlayDirection = DropdownOverlayDirection.auto, CustomDropdownDisabledDecoration? disabledDecoration}) -
CustomDropdown.multiSelect({Key? key, required List<
T> ? items, required dynamic onListChanged(List<T> )?, MultiSelectController<T> ? multiSelectController, SingleSelectController<T?> ? controller, List<T> ? initialItems, OverlayPortalController? overlayController, ScrollController? itemsScrollController, String? listValidator(List<T> )?, dynamic visibility(bool)?, _HeaderListBuilder<T> ? headerListBuilder, String? hintText, String? labelText, Widget? label, CustomDropdownDecoration? decoration, bool validateOnChange = true, _ListItemBuilder<T> ? listItemBuilder, _HintBuilder? hintBuilder, bool canCloseOutsideBounds = true, bool hideSelectedFieldWhenExpanded = false, int maxlines = 1, TextAlign textAlign = TextAlign.start, double? overlayHeight, EdgeInsets? closedHeaderPadding, EdgeInsets? expandedHeaderPadding, EdgeInsets? itemsListPadding, EdgeInsets? listItemPadding, bool enabled = true, bool canClearSelection = false, bool selectOnItemTap = true, CustomDropdownAnimation animation = const CustomDropdownAnimation(), bool initiallyOpen = false, bool autofocusOnSearch = false, DropdownOverlayDirection overlayDirection = DropdownOverlayDirection.auto, CustomDropdownDisabledDecoration? disabledDecoration}) -
CustomDropdown.multiSelectSearch({Key? key, required List<
T> ? items, required dynamic onListChanged(List<T> )?, MultiSelectController<T> ? multiSelectController, List<T> ? initialItems, SingleSelectController<T?> ? controller, dynamic visibility(bool)?, ScrollController? itemsScrollController, OverlayPortalController? overlayController, String? listValidator(List<T> )?, _ListItemBuilder<T> ? listItemBuilder, _HintBuilder? hintBuilder, CustomDropdownDecoration? decoration, _HeaderListBuilder<T> ? headerListBuilder, String? noResultFoundText, _NoResultFoundBuilder? noResultFoundBuilder, String? hintText, String? labelText, Widget? label, String? searchHintText, bool validateOnChange = true, bool canCloseOutsideBounds = true, bool hideSelectedFieldWhenExpanded = false, int maxlines = 1, TextAlign textAlign = TextAlign.start, double? overlayHeight, EdgeInsets? closedHeaderPadding, EdgeInsets? expandedHeaderPadding, EdgeInsets? itemsListPadding, EdgeInsets? listItemPadding, bool enabled = true, bool canClearSelection = false, bool selectOnItemTap = true, CustomDropdownAnimation animation = const CustomDropdownAnimation(), bool initiallyOpen = false, bool autofocusOnSearch = false, DropdownOverlayDirection overlayDirection = DropdownOverlayDirection.auto, CustomDropdownDisabledDecoration? disabledDecoration, bool closeDropDownOnClearFilterSearch = false}) -
CustomDropdown.multiSelectSearchRequest({Key? key, Future<
List< futureRequest(String)?, required dynamic onListChanged(List<T> >T> )?, PaginatedSearchRequest<T> ? paginatedRequest, int pageSize = 20, Widget? loadMoreIndicator, MultiSelectController<T> ? multiSelectController, Duration? futureRequestDelay, int searchRequestMinChars = 0, List<T> ? initialItems, List<T> ? items, SingleSelectController<T?> ? controller, ScrollController? itemsScrollController, OverlayPortalController? overlayController, dynamic visibility(bool)?, String? hintText, String? labelText, Widget? label, CustomDropdownDecoration? decoration, String? searchHintText, String? noResultFoundText, _HeaderListBuilder<T> ? headerListBuilder, _ListItemBuilder<T> ? listItemBuilder, _HintBuilder? hintBuilder, _NoResultFoundBuilder? noResultFoundBuilder, String? listValidator(List<T> )?, bool validateOnChange = true, int maxlines = 1, TextAlign textAlign = TextAlign.start, double? overlayHeight, Widget? searchRequestLoadingIndicator, EdgeInsets? closedHeaderPadding, EdgeInsets? expandedHeaderPadding, EdgeInsets? itemsListPadding, EdgeInsets? listItemPadding, bool canCloseOutsideBounds = true, bool hideSelectedFieldWhenExpanded = false, bool enabled = true, bool canClearSelection = false, bool selectOnItemTap = true, CustomDropdownAnimation animation = const CustomDropdownAnimation(), bool initiallyOpen = false, bool autofocusOnSearch = false, DropdownOverlayDirection overlayDirection = DropdownOverlayDirection.auto, CustomDropdownDisabledDecoration? disabledDecoration, bool closeDropDownOnClearFilterSearch = false}) -
const
-
CustomDropdown.search({Key? key, required List<
T> ? items, required dynamic onChanged(T?)?, SingleSelectController<T?> ? controller, ScrollController? itemsScrollController, T? initialItem, String? hintText, String? labelText, Widget? label, CustomDropdownDecoration? decoration, dynamic visibility(bool)?, OverlayPortalController? overlayController, String? searchHintText, String? noResultFoundText, _ListItemBuilder<T> ? listItemBuilder, _HeaderBuilder<T> ? headerBuilder, _HintBuilder? hintBuilder, _NoResultFoundBuilder? noResultFoundBuilder, String? validator(T?)?, bool validateOnChange = true, int maxlines = 1, TextAlign textAlign = TextAlign.start, double? overlayHeight, EdgeInsets? closedHeaderPadding, EdgeInsets? expandedHeaderPadding, EdgeInsets? itemsListPadding, EdgeInsets? listItemPadding, bool excludeSelected = true, bool canCloseOutsideBounds = true, bool hideSelectedFieldWhenExpanded = false, bool enabled = true, bool canClearSelection = false, bool selectOnItemTap = true, CustomDropdownAnimation animation = const CustomDropdownAnimation(), bool initiallyOpen = false, bool autofocusOnSearch = false, DropdownOverlayDirection overlayDirection = DropdownOverlayDirection.auto, CustomDropdownDisabledDecoration? disabledDecoration, bool closeDropDownOnClearFilterSearch = false}) -
CustomDropdown.searchRequest({Key? key, Future<
List< futureRequest(String)?, required dynamic onChanged(T?)?, PaginatedSearchRequest<T> >T> ? paginatedRequest, int pageSize = 20, Widget? loadMoreIndicator, Duration? futureRequestDelay, int searchRequestMinChars = 0, T? initialItem, List<T> ? items, SingleSelectController<T?> ? controller, ScrollController? itemsScrollController, String? hintText, String? labelText, Widget? label, CustomDropdownDecoration? decoration, dynamic visibility(bool)?, OverlayPortalController? overlayController, String? searchHintText, String? noResultFoundText, _ListItemBuilder<T> ? listItemBuilder, _HeaderBuilder<T> ? headerBuilder, _HintBuilder? hintBuilder, _NoResultFoundBuilder? noResultFoundBuilder, String? validator(T?)?, bool validateOnChange = true, int maxlines = 1, TextAlign textAlign = TextAlign.start, double? overlayHeight, EdgeInsets? closedHeaderPadding, EdgeInsets? expandedHeaderPadding, EdgeInsets? itemsListPadding, EdgeInsets? listItemPadding, Widget? searchRequestLoadingIndicator, bool excludeSelected = true, bool canCloseOutsideBounds = true, bool hideSelectedFieldWhenExpanded = false, bool enabled = true, bool canClearSelection = false, bool selectOnItemTap = true, CustomDropdownAnimation animation = const CustomDropdownAnimation(), bool initiallyOpen = false, bool autofocusOnSearch = false, DropdownOverlayDirection overlayDirection = DropdownOverlayDirection.auto, CustomDropdownDisabledDecoration? disabledDecoration, bool closeDropDownOnClearFilterSearch = false}) -
const
Properties
- animation → CustomDropdownAnimation
-
Controls how the overlay animates open and closed.
final
- autofocusOnSearch → bool
-
Autofocus the search field (raising the keyboard) when the overlay opens.
Only applies to the search constructors. Defaults to
false.final - canClearSelection → bool
-
When
true, a clear button is shown on the closed field while there is a selection, allowing the user to reset it back to the empty/hint state.final - canCloseOutsideBounds → bool
-
Can close CustomDropdown overlay by tapping outside.
Here "outside" covers the entire screen.
final
- closedHeaderPadding → EdgeInsets?
-
Padding for CustomDropdown header (closed state).
final
- closeDropDownOnClearFilterSearch → bool
-
CustomDropdown will close on tap Clear filter for all search
and searchRequest constructors
final
-
controller
→ SingleSelectController<
T?> ? -
The controller that can be used to control CustomDropdown selected item.
final
- decoration → CustomDropdownDecoration?
-
CustomDropdown decoration.
Contain sub-decorations SearchFieldDecoration, ListItemDecoration and ScrollbarThemeData.
final
- disabledDecoration → CustomDropdownDisabledDecoration?
-
CustomDropdown disabled decoration.
final
- enabled → bool
-
CustomDropdown enabled/disabled state.
If disabled, you can not open the dropdown.
final
- excludeSelected → bool
-
Hide the selected item from the items list.
final
- expandedHeaderPadding → EdgeInsets?
-
Padding for CustomDropdown header (opened/expanded state).
final
-
futureRequest
→ Future<
List< Function(String)?T> > -
The asynchronous computation from which the items list returns.
final
- futureRequestDelay → Duration?
-
Duration after which the futureRequest is to be executed.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headerBuilder
→ _HeaderBuilder<
T> ? -
The headerBuilder that will be used to build CustomDropdown header field.
final
-
headerListBuilder
→ _HeaderListBuilder<
T> ? -
The headerListBuilder that will be used to build CustomDropdown header field.
final
- hideSelectedFieldWhenExpanded → bool
-
Hide the header field when CustomDropdown overlay opened/expanded.
final
- hintBuilder → _HintBuilder?
-
The hintBuilder that will be used to build CustomDropdown hint of header field.
final
- hintText → String?
-
Text that suggests what sort of data the dropdown represents.
final
- initialItem → T?
-
Initial selected item from the list of items.
final
-
initialItems
→ List<
T> ? -
Initial selected items from the list of items.
final
- initiallyOpen → bool
-
Open the dropdown overlay automatically on first build.
final
-
items
→ List<
T> ? -
The list of items user can select.
final
- itemsListPadding → EdgeInsets?
-
Padding for CustomDropdown items list.
final
- itemsScrollController → ScrollController?
-
Scroll controller to access items list scroll behavior.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → Widget?
-
A custom widget for the floating label, used instead of labelText for
full control (e.g. an icon + text). It is positioned and floated the same
way; plain Text descendants still pick up CustomDropdownDecoration's
labelStyle/floatingLabelStyleunless you style them explicitly.final - labelText → String?
-
Optional Material-style floating label shown above/inside the closed
field. When provided it acts as the field's placeholder while resting and
floats up once the dropdown has a value or is open (see
CustomDropdownDecoration.floatingLabelBehavior).
final
-
listItemBuilder
→ _ListItemBuilder<
T> ? -
The listItemBuilder that will be used to build item on demand.
final
- listItemPadding → EdgeInsets?
-
Padding for CustomDropdown each list item.
final
-
listValidator
→ String? Function(List<
T> )? -
A method that validates the selected items.
Returns an error string to display as per the validation, or null otherwise.
final
- loadMoreIndicator → Widget?
-
Widget shown at the bottom of the list while the next page loads.
final
- maxlines → int
-
Text maxlines for header and list item text.
final
-
multiSelectController
→ MultiSelectController<
T> ? -
The multiSelectController that can be used to control CustomDropdown.multiSelect selected items.
final
- noResultFoundBuilder → _NoResultFoundBuilder?
-
The noResultFoundBuilder that will be used to build area when there's no search results match.
final
- noResultFoundText → String?
-
Text that notify there's no search results match.
final
- onChanged → dynamic Function(T?)?
-
Called when the item of the CustomDropdown should change.
final
-
onListChanged
→ dynamic Function(List<
T> )? -
Called when the list of items of the CustomDropdown should change.
final
- overlayController → OverlayPortalController?
-
The overlayController allows you to explicitly handle the CustomDropdown overlay states (show/hide).
final
- overlayDirection → DropdownOverlayDirection
-
The side the overlay opens towards.
final
- overlayHeight → double?
-
CustomDropdown opened/expanded area height.
Only applicable if items are greater than 4 otherwise adjust automatically.
final
- pageSize → int
-
Number of items per page for paginatedRequest. A page with fewer than
this many items is treated as the last page. Defaults to
20.final -
paginatedRequest
→ PaginatedSearchRequest<
T> ? -
Page-aware async request enabling infinite scroll (lazy loading).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- searchHintText → String?
-
Text that suggests what to search in the search field.
final
- searchRequestLoadingIndicator → Widget?
-
Widget to display while search request loading.
final
- searchRequestMinChars → int
-
Minimum number of characters that must be typed before futureRequest
is triggered. Below this length the request is not made and the base
items are shown. Only applies to the search-request constructors.
final
- selectOnItemTap → bool
-
Whether tapping a list item selects it.
final
- textAlign → TextAlign
-
Text align for head, hint and list item and so on.
Default TextAlign.start
final
- validateOnChange → bool
-
Enable the validation listener on item change.
This implies to validator everytime when the item change.
final
- validator → String? Function(T?)?
-
A method that validates the selected item.
Returns an error string to display as per the validation, or null otherwise.
final
- visibility → dynamic Function(bool)?
-
Callback for dropdown visibility.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< CustomDropdown< 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