Select<T> constructor
const
Select<T> ({
- Key? key,
- ValueChanged<
T?> ? onChanged, - Widget? placeholder,
- Widget? leading,
- Widget? trailing,
- Widget? indicatorIcon,
- bool filled = false,
- FocusNode? focusNode,
- BoxConstraints? constraints,
- BoxConstraints? popupConstraints,
- PopoverConstraint popupWidthConstraint = PopoverConstraint.anchorFixedSize,
- T? value,
- bool disableHoverEffect = false,
- BorderRadiusGeometry? borderRadius,
- EdgeInsetsGeometry? padding,
- AlignmentGeometry popoverAlignment = Alignment.topCenter,
- AlignmentGeometry? popoverAnchorAlignment,
- bool canUnselect = false,
- bool? autoClosePopover = true,
- bool? enabled,
- SelectValueSelectionHandler<
T> ? valueSelectionHandler, - SelectValueSelectionPredicate<
T> ? valueSelectionPredicate, - Predicate<
T> ? showValuePredicate, - Widget? expandIcon = const SelectExpandIcon(),
- required SelectPopupBuilder popup,
- required SelectValueBuilder<
T> itemBuilder,
Creates a single-selection dropdown widget.
The popup and itemBuilder parameters are required to define the
dropdown content and how selected values are displayed.
Parameters:
key(Key?): Widget key for controlling widget identityonChanged(ValueChanged<T?>?): Callback when selection changes; if null, select is disabledplaceholder(Widget?): Widget shown when no value is selectedleading(Widget?): Widget displayed before the selected value or placeholdertrailing(Widget?): Widget displayed after the selected value or placeholderindicatorIcon(Widget?): Widget displayed as the dropdown indicatorfilled(bool): Whether to use filled background style, defaults to falsefocusNode(FocusNode?): Focus node for keyboard interactionconstraints(BoxConstraints?): Size constraints for the select buttonpopupConstraints(BoxConstraints?): Size constraints for the popup menupopupWidthConstraint(PopoverConstraint): Width constraint mode for popup, defaults toPopoverConstraint.anchorFixedSizevalue(T?): Currently selected valuedisableHoverEffect(bool): Whether to disable hover visual feedback, defaults to falseborderRadius(BorderRadiusGeometry?): Custom border radiuspadding(EdgeInsetsGeometry?): Custom paddingpopoverAlignment(AlignmentGeometry): Popup alignment, defaults toAlignment.topCenterpopoverAnchorAlignment(AlignmentGeometry?): Anchor alignment for popup positioningcanUnselect(bool): Whether user can deselect current value, defaults to falseautoClosePopover(bool?): Whether popup closes after selection, defaults to trueenabled(bool?): Whether select is enabled for interactionvalueSelectionHandler(SelectValueSelectionHandler<T>?): Custom selection logicvalueSelectionPredicate(SelectValueSelectionPredicate<T>?): Predicate for allowing selectionshowValuePredicate(Predicate<T>?): Predicate for showing itemspopup(SelectPopupBuilder): Required builder for popup contentitemBuilder(SelectValueBuilder<T>): Required builder for selected value displayexpandIcon(Widget): The expand icon for the select, defaults to SelectExpandIcon widget
Implementation
const Select({
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,
this.value,
this.disableHoverEffect = false,
this.borderRadius,
this.padding,
this.popoverAlignment = Alignment.topCenter,
this.popoverAnchorAlignment,
this.canUnselect = false,
this.autoClosePopover = true,
this.enabled,
this.valueSelectionHandler,
this.valueSelectionPredicate,
this.showValuePredicate,
this.expandIcon = const SelectExpandIcon(),
required this.popup,
required this.itemBuilder,
});