-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Change cursor when hovering on DropdownButton #80567
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
Change cursor when hovering on DropdownButton #80567
Conversation
Implement functionality to change the mouse cursor to a clickable cursor when hovering on the DropdownButton, similar to the IconButton and TextField widgets. flutter#77136
Add one test that verifies cursor behavior when hovering over the DropdownButton widget, both when enabled and disabled. flutter#77136
ea9331c
to
d33c5de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the change!
await gesture.moveTo(offDropdownButton); | ||
expect(RendererBinding.instance!.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.basic); | ||
|
||
// Test that mouse cursor doesn't change when button is disabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to split this test into a separate one. See https://github.com/flutter/flutter/wiki/Writing-Effective-Tests#one-behavior-per-test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay sounds good, thanks for the feedback!
Implement functionality to change the mouse cursor when hovering over a DropdownButton widget. Currently there is no cursor change, which is unlike the current HTML standard and the standard across similar widgets, such as the IconButton widget. Added a MouseRegion with a default clickable cursor, inspired by the IconButton widget implementation. The changes are minimal and lightweight by only implementing a default cursor, and they can be easily extended in the future.
Also added a DropdownButton test in
dropdown_test.dart
to test that the mouse cursor changes appropriately when the button is both enabled and disabled.This PR addresses issue #77136.
Pre-launch Checklist
///
).