@@ -738,7 +738,8 @@ class PlatformMenuItem with Diagnosticable {
738
738
/// An optional callback that is called when this [PlatformMenuItem] is
739
739
/// selected.
740
740
///
741
- /// If unset, this menu item will be disabled.
741
+ /// At most one of [onSelected] and [onSelectedIntent] may be set. If neither
742
+ /// field is set, this menu item will be disabled.
742
743
final VoidCallback ? onSelected;
743
744
744
745
/// Returns a callback, if any, to be invoked if the platform menu receives a
@@ -760,7 +761,8 @@ class PlatformMenuItem with Diagnosticable {
760
761
/// An optional intent that is invoked when this [PlatformMenuItem] is
761
762
/// selected.
762
763
///
763
- /// If unset, this menu item will be disabled.
764
+ /// At most one of [onSelected] and [onSelectedIntent] may be set. If neither
765
+ /// field is set, this menu item will be disabled.
764
766
final Intent ? onSelectedIntent;
765
767
766
768
/// Returns all descendant [PlatformMenuItem] s of this item.
@@ -805,7 +807,7 @@ class PlatformMenuItem with Diagnosticable {
805
807
return < String , Object ? > {
806
808
_kIdKey: getId (item),
807
809
_kLabelKey: item.label,
808
- _kEnabledKey: item.onSelected != null ,
810
+ _kEnabledKey: item.onSelected != null || item.onSelectedIntent != null ,
809
811
if (shortcut != null )...shortcut.serializeForMenu ().toChannelRepresentation (),
810
812
};
811
813
}
0 commit comments