Skip to content

Conversation

@dkwingsmt
Copy link
Contributor

@dkwingsmt dkwingsmt commented May 20, 2020

Description

This PR adds default cursor and/or mouseCursor property to a number of widgets.

This PR also adds MaterialStateMouseCursor, which is a mouse cursor that depends on material states, as well as ClickableMouseCursor, which is a material state mouse cursor that is click normally but basic when disabled.

The complete list of widgets are as follows:

  • InkWell
  • InkResponse
  • RawMaterialButton
  • MaterialButton
  • IconButton
  • FloatingActionButton
  • RaisedButton
  • OutlineButton
  • FlatButton
  • ToggleButtons
  • Switch
  • Radio
  • Checkbox
  • PopupMenuItem
  • Tabs
  • ModalBarrier (no property, only default cursor basic)
  • EditableText (no property, only default cursor text)
  • SelectableText (no property, only default cursor text)
  • TextField
  • Slider
  • BottomNavigationBar
  • ListTile
  • FocusableActionDetector

Open question

  • Is there a better name for ClickableMouseCursor?
  • Should we implement MaterialStateMouseCursor in a currying-like way so that the states of InkResponse can be directly used?

Related Issues

Tests

I added the following tests:

  • For every widget, the following tests are added:
    • Every constructor correctly applies mouseCursor property
    • The default mouse cursor is correct
    • If the default mouse cursor is ClickableMouseCursor, then the widget displays the correct cursor when disabled.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.

@fluttergithubbot fluttergithubbot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels May 20, 2020
@dkwingsmt dkwingsmt changed the title [WIP] Add mouse cursor API to widgets Add mouse cursor API to widgets (phase 1) May 26, 2020
Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This look good, just wanted to consider merging the two MaterialState cursor classes.

@dkwingsmt
Copy link
Contributor Author

@HansMuller I made ClickableMouseCursor private and moved it to MaterialStateMouseCursor.clickable. Also fixed some docs per your suggestion.

@HansMuller
Copy link
Contributor

Thanks, will take a look. I wasn't able to come up with a better name than MaterialStateMouseCursor.clickable.

Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dkwingsmt dkwingsmt merged commit 60f1aa2 into flutter:master May 28, 2020
@dkwingsmt dkwingsmt deleted the widget-mouse-cursor branch May 28, 2020 20:16
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants