Skip to content

Change cursor when hovering on DropdownButton - #80567

Merged
fluttergithubbot merged 2 commits into
flutter:masterfrom
jushutch:77136-dropdown-button-cursor
May 14, 2021
Merged

Change cursor when hovering on DropdownButton#80567
fluttergithubbot merged 2 commits into
flutter:masterfrom
jushutch:77136-dropdown-button-cursor

Conversation

@jushutch

@jushutch jushutch commented Apr 16, 2021

Copy link
Copy Markdown
Contributor

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

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt.
  • All existing and new tests are passing.

@flutter-dashboard flutter-dashboard Bot added p: material_ui material_ui package in flutter/packages framework flutter/packages/flutter repository. See also f: labels. labels Apr 16, 2021
@google-cla google-cla Bot added the cla: yes label Apr 16, 2021
@Hixie

Hixie commented Apr 21, 2021

Copy link
Copy Markdown
Contributor

cc @gspencergoog @dkwingsmt

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
@jushutch
jushutch force-pushed the 77136-dropdown-button-cursor branch from ea9331c to d33c5de Compare April 21, 2021 21:49
@HansMuller
HansMuller requested a review from dkwingsmt April 22, 2021 23:48

@dkwingsmt dkwingsmt left a comment

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants