MultiSelect<T> constructor

const MultiSelect<T>({
  1. Key? key,
  2. ValueChanged<Iterable<T>?>? onChanged,
  3. Widget? placeholder,
  4. Widget? leading,
  5. Widget? trailing,
  6. Widget? indicatorIcon,
  7. bool filled = false,
  8. FocusNode? focusNode,
  9. BoxConstraints? constraints,
  10. BoxConstraints? popupConstraints,
  11. PopoverConstraint popupWidthConstraint = PopoverConstraint.anchorFixedSize,
  12. required Iterable<T>? value,
  13. bool disableHoverEffect = false,
  14. BorderRadiusGeometry? borderRadius,
  15. EdgeInsetsGeometry? padding,
  16. AlignmentGeometry popoverAlignment = Alignment.topCenter,
  17. AlignmentGeometry? popoverAnchorAlignment,
  18. bool canUnselect = true,
  19. bool? autoClosePopover = false,
  20. bool? enabled,
  21. SelectValueSelectionHandler<Iterable<T>>? valueSelectionHandler,
  22. SelectValueSelectionPredicate<Iterable<T>>? valueSelectionPredicate,
  23. Predicate<Iterable<T>>? showValuePredicate,
  24. Widget? expandIcon = const SelectExpandIcon(),
  25. required SelectPopupBuilder popup,
  26. required SelectValueBuilder<T> itemBuilder,
})

Creates a multi-selection dropdown widget.

Allows selecting multiple items from a dropdown list, displaying them as chips. The value, popup, and itemBuilder parameters are required.

Parameters:

  • key (Key?): Widget key for controlling widget identity
  • onChanged (ValueChanged<Iterable<T>?>?): Callback when selection changes; if null, widget is disabled
  • placeholder (Widget?): Widget shown when no values are selected
  • leading (Widget?): Widget displayed before the selected values or placeholder
  • trailing (Widget?): Widget displayed after the selected values or placeholder
  • indicatorIcon (Widget?): Widget displayed as the dropdown indicator
  • filled (bool): Whether to use filled background style, defaults to false
  • focusNode (FocusNode?): Focus node for keyboard interaction
  • constraints (BoxConstraints?): Size constraints for the select button
  • popupConstraints (BoxConstraints?): Size constraints for the popup menu
  • popupWidthConstraint (PopoverConstraint): Width constraint mode for popup, defaults to PopoverConstraint.anchorFixedSize
  • value (Iterable<T>): Required currently selected values
  • disableHoverEffect (bool): Whether to disable hover visual feedback, defaults to false
  • borderRadius (BorderRadiusGeometry?): Custom border radius
  • padding (EdgeInsetsGeometry?): Custom padding
  • popoverAlignment (AlignmentGeometry): Popup alignment, defaults to Alignment.topCenter
  • popoverAnchorAlignment (AlignmentGeometry?): Anchor alignment for popup positioning
  • canUnselect (bool): Whether user can deselect items, defaults to true
  • autoClosePopover (bool?): Whether popup closes after selection, defaults to false
  • enabled (bool?): Whether multi-select is enabled for interaction
  • valueSelectionHandler (SelectValueSelectionHandler<Iterable<T>>?): Custom selection logic
  • valueSelectionPredicate (SelectValueSelectionPredicate<Iterable<T>>?): Predicate for allowing selection
  • showValuePredicate (Predicate<Iterable<T>>?): Predicate for showing items
  • popup (SelectPopupBuilder): Required builder for popup content
  • itemBuilder (SelectValueBuilder<T>): Required builder for individual chip items
  • expandIcon (Widget): The expand icon for the select, defaults to SelectExpandIcon widget

Implementation

const MultiSelect({
  super.key,
  this.onChanged,
  this.placeholder,
  this.leading,
  this.trailing,
  this.indicatorIcon,
  this.filled = false,
  this.focusNode,
  this.constraints,
  this.popupConstraints,
  this.popupWidthConstraint = PopoverConstraint.anchorFixedSize,
  required this.value,
  this.disableHoverEffect = false,
  this.borderRadius,
  this.padding,
  this.popoverAlignment = Alignment.topCenter,
  this.popoverAnchorAlignment,
  this.canUnselect = true,
  this.autoClosePopover = false,
  this.enabled,
  this.valueSelectionHandler,
  this.valueSelectionPredicate,
  this.showValuePredicate,
  this.expandIcon = const SelectExpandIcon(),
  required this.popup,
  required SelectValueBuilder<T> itemBuilder,
}) : multiItemBuilder = itemBuilder;