flutter_multi_select_dropdown 1.0.0

SDKflutter
Platformandroidioswindowslinuxmacos

A customizable multi-select dropdown for Flutter applications.

MultiSelect Dropdown

The Flutter MultiSelect Dropdown for Flutter is a powerful and customizable widget that empowers you to effortlessly manage and search through multiple items in a dropdown list. Customize the dropdown with your own style, and use the controller to programmatically control the dropdown.

Preview | Controller | Parameters

Preview

Controller

You can use the controller to programmatically select/unselect items, clear the selection, and get the selected items, set disabled items, show/hide the dropdown. It is still in beta, will be stable in the next release.

final MultiSelectController<User> _controller = MultiSelectController<User>();

_controller.clearAll()?/// Clear all selected items

_controller.selectWhere(bool Function(DropdownItem<User>) predicate); /// Select items based on a predicate

_controller.setItems(List<DropdownItem<User>> options); /// Set items of the dropdown

_controller.addItem(DropdownItem<User> option); /// Add item to dropdown

_controller.addItems(List<DropdownItem<User>> options); /// Add  items to dropdown

_controller.disableWhere(bool Function(DropdownItem<User>) predicate); /// Disable items based on a predicate

_controller.selectAll(); /// Select all items

_controller.selectAtIndex(int index); /// Select item at index

_controller.selectWhere(bool Function(DropdownItem<User>) predicate); /// Select items based on a predicate

_controller.deselectWhere(bool Function(DropdownItem<User>) predicate); /// Deselect items based on a predicate

_controller.items; /// Get all items

_controller.selectedItems; /// Get selected items

_controller.disabledItems; /// Get disabled items

_controller.openDropdown(); /// Show the dropdown

_controller.closeDropdown(); /// Hide the dropdown if it is open

Parameters

MultiDropdown

ParameterTypeDescriptionDefault
itemsList<DropdownItem>The list of dropdown items.Required
singleSelectboolThe selection type of the dropdown.false
chipDecorationChipDecorationThe configuration for the chips.ChipDecoration()
fieldDecorationFieldDecorationThe decoration of the field.FieldDecoration()
dropdownDecorationDropdownDecorationThe decoration of the dropdown.DropdownDecoration()
searchDecorationSearchFieldDecorationThe decoration of the search field.SearchFieldDecoration()
dropdownItemDecorationDropdownItemDecorationThe decoration of the dropdown items.DropdownItemDecoration()
itemBuilderDropdownItemBuilder?The builder for the dropdown items.null
selectedItemBuilderSelectedItemBuilder?The builder for the selected items.null
itemSeparatorWidget?The separator between the dropdown items.null
validatorString? Function(List<DropdownItem>? selectedOptions)?The validator for the dropdown.null
autovalidateModeAutovalidateModeThe autovalidate mode for the dropdown.AutovalidateMode.disabled
controllerMultiSelectController?The controller for the dropdown.null
maxSelectionsintThe maximum number of selections allowed.0
enabledboolWhether the dropdown is enabled.true
searchEnabledboolWhether the search field is enabled.false
focusNodeFocusNode?The focus node for the dropdown.null
futureFutureRequest?The future request for the dropdown items.null
onSelectionChangeOnSelectionChanged?The callback when the item is changed.null
closeOnBackButtonboolCloses the dropdown on back buttonfalse
onSearchChangeValueChanged?The callback when the search text changes.null
ParameterTypeDescriptionDefault
labelStringThe label of the dropdown item.Required
valueTThe value associated with the dropdown item.Required
disabledboolIndicates whether the dropdown item is disabled.false
selectedboolIndicates whether the dropdown item is selected.false

ChipDecoration

ParameterTypeDescriptionDefault
deleteIconIconThe icon to display for deleting a chip.Icon(Icons.close)
backgroundColorColorThe background color of the chip.Colors.blue
labelStyleTextStyleThe style of the chip label.TextStyle()
paddingEdgeInsetsThe padding around the chip.EdgeInsets.all(8.0)
borderBoxBorderThe border of the chip.Border()
spacingdoubleThe spacing between chips.8.0
runSpacingdoubleThe spacing between chip rows (when the chips wrap).8.0
borderRadiusBorderRadiusGeometryThe border radius of the chip.BorderRadius.circular(12)
wrapboolWhether to wrap chips or scroll them.true

FieldDecoration

ParameterTypeDescriptionDefault
labelTextString?The label text to display above the dropdown field.null
hintTextString?The hint text to display in the dropdown field.null
borderInputBorder?The border of the dropdown field.null
focusedBorderInputBorder?The border of the dropdown field when it is focused.null
disabledBorderInputBorder?The border of the dropdown field when it is disabled.null
errorBorderInputBorder?The border of the dropdown field when there is an error.null
suffixIconWidget?The icon to display at the end of the dropdown field.Icon(Icons.arrow_drop_down)
prefixIconWidget?The icon to display at the start of the dropdown field.null
labelStyleTextStyle?The style of the label text.null
hintStyleTextStyle?The style of the hint text.null
borderRadiusdoubleThe border radius of the dropdown field.8.0
animateSuffixIconboolAnimate the icon or not.true
paddingEdgeInsets?Padding around the dropdown field.null
showClearIconboolShow the clear icon or not.true
ParameterTypeDescriptionDefault
backgroundColorColorThe background color of the dropdown.Colors.white
elevationdoubleThe elevation of the dropdown.1.0
maxHeightdoubleThe max height of the dropdown.400.0
borderRadiusBorderRadiusThe border radius of the dropdown.BorderRadius.circular(12.0)
marginTopdoubleThe margin top of the dropdown.0.0
headerWidget?The header of the dropdown.null
footerWidget?The footer of the dropdown.null

SearchFieldDecoration

ParameterTypeDescriptionDefault
hintTextStringThe hint text to display in the search field.'Search'
borderInputBorder?The border of the search field.null
focusedBorderInputBorder?The border of the search field when it is focused.null
searchIconIconThe icon to display in the search field.Icon(Icons.search)
ParameterTypeDescriptionDefault
backgroundColorColorThe background color of the dropdown item.null
disabledBackgroundColorColorThe background color of the disabled dropdown item.null
selectedBackgroundColorColorThe background color of the selected dropdown item.null
selectedTextColorColorThe text color of the selected dropdown item.null
textColorColorThe text color of the dropdown item.null
disabledTextColorColorThe text color of the disabled dropdown item.null
selectedIconIconThe icon to display for the selected dropdown item.null
disabledIconIconThe icon to display for the disabled dropdown item.null

Credits : This is upgraded verion of previous dart package https://pub.dev/packages/multi_dropdown and major updated will be released soon.