make Elevated&Outlined&TextButton support onHover&onFocus callback #90688
Conversation
Signed-off-by: yukai <yk3372@gmail.com>
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
|
|
@googlebot I signed it! |
|
@HansMuller @a14n could you review my PR, thanks. |
Signed-off-by: yukai <yk3372@gmail.com>
Signed-off-by: yukai <yk3372@gmail.com>
This looks good however I don't see any tests that verify that the onChange or onHover callbacks are called when expected. You could probably generalize the existing tests a little (including their titles) to cover that.
Signed-off-by: yukai <yk3372@gmail.com>
I have added the tests for onHover and onFocus. Refer to the test in ink_well_test.dart. Thanks |
LGTM
Signed-off-by: yukai yk3372@gmail.com
My Feature issue is #90686
What's the PR do?
My PR aim to make the ElevatedButton/OutlinedButton/TextButton to support onFocus and onHover callback.
Why need it?
Recently, I make an application for macOS and Web. I'm writing a NavMenu view like this: Element-Menu.
The Menu need onPress/onFocus/onHover functions.
I have known the TextButton is Powerful,and it's support the normal/pressed/hover/focus/disable states in MaterialState.
But when I try to use the onHover function, it's has no related param.
Then I read the flutter framework source, and found it use the InkWell widget. It support the onHover and onFocus callback.
And the MaterialStateMixin's updateMaterialState function also support the onChanged param.The TextButton to support onFocus and onHover callback is very easy.
What‘s the meaning of it?
The flutter is support all the platforms, such as macOS/Windows/TV. These platforms has keyboard and mouse, all need focus/hover state and callback.
Compare before and after:


Before:
After
The Demo Code:
Pre-launch Checklist
///).The text was updated successfully, but these errors were encountered: