Unverified Commit 8557ffa0 authored by Josh Matthews's avatar Josh Matthews Committed by GitHub

Fix PlatformMenuItems with onSelectedIntent are never enabled (#121885)

Fix PlatformMenuItems with onSelectedIntent are never enabled
parent 91dea4d1
......@@ -738,7 +738,8 @@ class PlatformMenuItem with Diagnosticable {
/// An optional callback that is called when this [PlatformMenuItem] is
/// selected.
///
/// If unset, this menu item will be disabled.
/// At most one of [onSelected] and [onSelectedIntent] may be set. If neither
/// field is set, this menu item will be disabled.
final VoidCallback? onSelected;
/// Returns a callback, if any, to be invoked if the platform menu receives a
......@@ -760,7 +761,8 @@ class PlatformMenuItem with Diagnosticable {
/// An optional intent that is invoked when this [PlatformMenuItem] is
/// selected.
///
/// If unset, this menu item will be disabled.
/// At most one of [onSelected] and [onSelectedIntent] may be set. If neither
/// field is set, this menu item will be disabled.
final Intent? onSelectedIntent;
/// Returns all descendant [PlatformMenuItem]s of this item.
......@@ -805,7 +807,7 @@ class PlatformMenuItem with Diagnosticable {
return <String, Object?>{
_kIdKey: getId(item),
_kLabelKey: item.label,
_kEnabledKey: item.onSelected != null,
_kEnabledKey: item.onSelected != null || item.onSelectedIntent != null,
if (shortcut != null)...shortcut.serializeForMenu().toChannelRepresentation(),
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment