diff --git a/CHANGELOG.md b/CHANGELOG.md index 47a8309a..af166e92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - fix : The EditableComboBox is missing the part that applies the style to the TextBox, so add it. - feat: Add `BreadcrumbBar.chevronIconBuilder` and `BreadcrumbBar.chevronIconSize` ([#1111](https://github.com/bdlukaa/fluent_ui/issues/1111)) * fix: Consider object translation on Menu Flyouts ([#1104](https://github.com/bdlukaa/fluent_ui/issues/1104)) +* fix: Correctly disable `DropDownButton` items if `onPressed` is not provided ([#1116](https://github.com/bdlukaa/fluent_ui/issues/1116#issuecomment-2347153074)) ## 4.9.1 diff --git a/example/lib/screens/inputs/button.dart b/example/lib/screens/inputs/button.dart index c79d212d..eeb93d8f 100644 --- a/example/lib/screens/inputs/button.dart +++ b/example/lib/screens/inputs/button.dart @@ -270,7 +270,7 @@ ToggleButton( items: [ MenuFlyoutItem(text: const Text('Send'), onPressed: () {}), MenuFlyoutSeparator(), - MenuFlyoutItem(text: const Text('Reply'), onPressed: () {}), + MenuFlyoutItem(text: const Text('Reply'), onPressed: null), MenuFlyoutItem(text: const Text('Reply all'), onPressed: () {}), ], )''', @@ -280,7 +280,7 @@ ToggleButton( items: [ MenuFlyoutItem(text: const Text('Send'), onPressed: () {}), MenuFlyoutSeparator(), - MenuFlyoutItem(text: const Text('Reply'), onPressed: () {}), + MenuFlyoutItem(text: const Text('Reply'), onPressed: null), MenuFlyoutItem(text: const Text('Reply all'), onPressed: () {}), ], ), diff --git a/lib/src/controls/inputs/dropdown_button.dart b/lib/src/controls/inputs/dropdown_button.dart index 89d46b0c..8cabfda3 100644 --- a/lib/src/controls/inputs/dropdown_button.dart +++ b/lib/src/controls/inputs/dropdown_button.dart @@ -373,9 +373,7 @@ class DropDownButtonState extends State { MenuFlyoutItem _createMenuItem(MenuFlyoutItem item, BuildContext context) { return MenuFlyoutItem( - onPressed: () { - item.onPressed?.call(); - }, + onPressed: item.onPressed, closeAfterClick: widget.closeAfterClick, key: item.key, leading: item.leading,