diff --git a/packages/dropdown_button2/lib/src/dropdown_menu_item.dart b/packages/dropdown_button2/lib/src/dropdown_menu_item.dart index aea156a..c8df5ba 100644 --- a/packages/dropdown_button2/lib/src/dropdown_menu_item.dart +++ b/packages/dropdown_button2/lib/src/dropdown_menu_item.dart @@ -14,6 +14,7 @@ class DropdownItem extends _DropdownMenuItemContainer { super.intrinsicHeight, super.alignment, this.onTap, + this.onLongPress, this.value, this.enabled = true, this.closeOnTap = true, @@ -23,6 +24,9 @@ class DropdownItem extends _DropdownMenuItemContainer { /// Called when the dropdown menu item is tapped. final VoidCallback? onTap; + /// Called when the dropdown menu item is long pressed. + final VoidCallback? onLongPress; + /// The value to return if the user selects this menu item. /// /// Eventually returned in a call to [DropdownButton.onChanged]. @@ -223,6 +227,7 @@ class _DropdownItemButtonState extends State<_DropdownItemButton> { autofocus: isSelectedItem, enableFeedback: widget.enableFeedback, onTap: _handleOnTap, + onLongPress: dropdownItem.onLongPress, onFocusChange: _handleFocusChange, borderRadius: menuItemStyle.borderRadius, overlayColor: menuItemStyle.overlayColor,