-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disabled Menu Item #11
Comments
FWIW, I needed this recently so added it in my local fork with this commit: edwardaux@3c2f5c4 A couple of important notes:
In any event, I just thought I'd share in case anyone else needed to do something similar. |
please do a PR
I'm completely ok with the breaking change (that will mean a major version
bump, so existing users are not affected unless upgrade the version)
the unused callback is likely a child of bad refactor
…On Sat, Apr 16, 2022, 12:03 AM Craig Edwards ***@***.***> wrote:
FWIW, I needed this recently so added it in my local fork with this
commit: ***@***.***
<edwardaux@3c2f5c4>
A couple of important notes:
- There's an onSelected function on MenuItem that doesn't seem like it
is used at the moment. It was a bit unclear what the difference was
designed to be between this callback and onItemSelected in
ContextMenuRegion. My assumption is that I'd use the former if I
wanted different functions to be called back for each item, and I'd use the
latter if I just wanted to have one function (and if both were present,
then both would be called). However, as I mentioned,
MenuItem.onSelected isn't currently hooked up, so I had to add a call
to ContextMenuRegion to make sure it calls both.
- For my personal needs, I adopted the Flutter convention of disabling
the widget if the onSelected function is not set. However, this would
be a breaking change for any current users of this library (all menu items
would be disabled unless they were setting the onSelected in their
MenuItem objects - which they wouldn't be because those callbacks
don't currently get called)
- I'm happy to raise a PR back here if @lesnitsky
<https://github.com/lesnitsky> would like, however a) I think the
caveats above may mean that it is a breaking change, and b) I don't have a
windows or a linux machine to be able to do a similar thing.
In any event, I just thought I'd share in case anyone else needed to do
something similar.
—
Reply to this email directly, view it on GitHub
<#11 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABPYUNUIN34GSWTMR3HPXPLVFHKRBANCNFSM5JB4C7DA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There should be a disabled state for menu item when no function is passed.
The text was updated successfully, but these errors were encountered: