DropdownFlutter<T> constructor
DropdownFlutter<T> ({
- Key? key,
- required List<
T> ? items, - required dynamic onChanged(
- T?
- SingleSelectController<
T?> ? controller, - ScrollController? itemsScrollController,
- T? initialItem,
- String? hintText,
- CustomDropdownDecoration? decoration,
- String? validator(
- T?
- bool validateOnChange = true,
- dynamic visibility()?,
- OverlayPortalController? overlayController,
- _ListItemBuilder<
T> ? listItemBuilder, - _HeaderBuilder<
T> ? headerBuilder, - _HintBuilder? hintBuilder,
- int maxlines = 1,
- double? overlayHeight,
- EdgeInsets? closedHeaderPadding,
- EdgeInsets? expandedHeaderPadding,
- EdgeInsets? itemsListPadding,
- EdgeInsets? listItemPadding,
- bool canCloseOutsideBounds = true,
- bool hideSelectedFieldWhenExpanded = false,
- bool excludeSelected = true,
- bool enabled = true,
- CustomDropdownDisabledDecoration? disabledDecoration,
- Duration? animationDuration,
- Curve? animationCurve,
- bool enableHapticFeedback = false,
- String groupBy(
- T item
- _GroupHeaderBuilder? groupHeaderBuilder,
- int recentSelectionsMaxCount = 0,
- List<
T> ? initialRecentItems, - ValueChanged<
List< ? onRecentItemsChanged,T> > - bool highlightMatchedText = false,
- bool showSelectAll = false,
- String? selectAllText,
- String? clearAllText,
Implementation
DropdownFlutter({
super.key,
required this.items,
required this.onChanged,
this.controller,
this.itemsScrollController,
this.initialItem,
this.hintText,
this.decoration,
this.validator,
this.validateOnChange = true,
this.visibility,
this.overlayController,
this.listItemBuilder,
this.headerBuilder,
this.hintBuilder,
this.maxlines = 1,
this.overlayHeight,
this.closedHeaderPadding,
this.expandedHeaderPadding,
this.itemsListPadding,
this.listItemPadding,
this.canCloseOutsideBounds = true,
this.hideSelectedFieldWhenExpanded = false,
this.excludeSelected = true,
this.enabled = true,
this.disabledDecoration,
this.animationDuration,
this.animationCurve,
this.enableHapticFeedback = false,
this.groupBy,
this.groupHeaderBuilder,
this.recentSelectionsMaxCount = 0,
this.initialRecentItems,
this.onRecentItemsChanged,
this.enableKeyboardNavigation = false,
this.highlightMatchedText = false,
this.showSelectAll = false,
this.selectAllText,
this.clearAllText,
}) : assert(
initialItem == null || controller == null,
'Only one of initialItem or controller can be specified at a time',
),
assert(
initialItem == null || items!.contains(initialItem),
'Initial item must match with one of the item in items list.',
),
assert(
controller == null ||
controller.value == null ||
items!.contains(controller.value),
'Controller value must match with one of the item in items list.',
),
_searchType = null,
_dropdownType = _DropdownType.singleSelect,
futureRequest = null,
futureRequestDelay = null,
noResultFoundBuilder = null,
noResultFoundText = null,
searchHintText = null,
initialItems = null,
onListChanged = null,
listValidator = null,
headerListBuilder = null,
searchRequestLoadingIndicator = null,
closeDropDownOnClearFilterSearch = false,
multiSelectController = null;