Skip to content

Set default MouseCursor in ButtonThemeData #59575

Closed

Description

@JonLatane

Use case

The new "clickable" mouseCursor is inappropriate and confusing for desktop apps, and the implementation of defaulting to a static const in every widget using cursors means a single point of responsibility for cursor behavior is not accessible to developers.

The default mouseCursor for any widgets using it should be in ButtonThemeData, not a hardcoded const.

Proposal

ButtonThemeData.mouseCursor field is added, and all buttons and other Widgets in a given BuildContext using MaterialStateMouseCursor.clickable instead use ButtonTheme.of(context).mouseCursor.

Relates to #31952

Activity

  1. added
    a: mouseIssues related to using a mouse or mouse support
    frameworkflutter/packages/flutter repository. See also f: labels.
    c: proposalA detailed proposal for a change to Flutter
    c: new featureNothing broken; request for a new capability
    platform-webWeb applications specifically
    on Jun 17, 2020
  2. dkwingsmt commented on Jun 17, 2020

    @dkwingsmt
    Contributor

    I agree that we should be able to customize cursors globally in theming.

    @HansMuller Do you think it's ok to add these APIs despite the ongoing theming update?

  3. HansMuller commented on Jun 17, 2020

    @HansMuller
    Contributor

    #59702, which - if all goes well - should land in the next week or so, adds mouse cursor support to the new (replacement) button classes and their themes. I'd really prefer to not make additional changes to ButtonTheme because that's what we're trying to leave behind. However, I think it it would make sense for Theme/ThemeData to define an overall default mouse cursor.

  4. JonLatane commented on Jun 17, 2020

    @JonLatane
    Author

    Woohoo! Wasn't aware of this pending change. Looks good to me so far. Thank you!

  5. gspencergoog commented on Oct 14, 2020

    @gspencergoog
    Contributor

    @HansMuller should this issue be closed?

  6. HansMuller commented on Oct 14, 2020

    @HansMuller
    Contributor

    Yes, I'm going to close this issue. The new buttons define default mouse cursors and one can override the mouse cursor using a constructor parameter or a theme - https://flutter.dev/go/material-button-system-updates.

  7. github-actions commented on Aug 11, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  8. locked as resolved and limited conversation to collaborators on Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: desktopRunning on desktopa: mouseIssues related to using a mouse or mouse supportc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions