Skip to content

Add mouse cursor support to the remaining widgets #58192

Open

Description

@dkwingsmt

While #57628 added mouse cursor support to a number of material widgets, there are other widgets remaining to support.

  • Material:
    • Card (probably)
    • Tooltip
    • NavigationRail
    • ReorderableList
    • Stepper
    • TimePicker
    • Chip
    • DataTable
    • Hyperlinks (not a widget; actually InlineSpan with tap gesture recognizers)
  • Cupertino widgets (we might not do this until we start to support iPadOS cursors)

Please comment if widgets not mentioned here should also support mouse cursors.

Activity

  1. added
    p: cupertino_uicupertino_ui package in flutter/packages
    p: material_uimaterial_ui package in flutter/packages
    frameworkflutter/packages/flutter repository. See also f: labels.
    c: new featureNothing broken; request for a new capability
    a: mouseIssues related to using a mouse or mouse support
    on May 29, 2020
  2. happyharis commented on Jun 1, 2020

    @happyharis
    1. How about Material Card widget?
    2. Does making GestureDetector clickable make sense?
    3. Is the HyperLink widget out in the material library. Can't seem to find it.
  3. dkwingsmt commented on Jun 1, 2020

    @dkwingsmt
    ContributorAuthor

    @happyharis

    1. That's probably a good idea.
    2. I don't think so. GestureDetector is supposed to be a basic widget that serves one purpose, i.e. define gestures. Developers are supposed to compose it with others if desired. Additionally, GestureDetector contains way more than just clicking. For example, it supports dragging, which you might want to use the "drag" cursor instead.
    3. It's actually RichText with an InlineSpan that has recognizers; however there is a "hyperlink_test.dart".
  4. esDotDev commented on Jun 3, 2020

    @esDotDev

    If this is not being added to GT, is there plans to provide a less opinionated SimpleButton?

    Currently the next step up from GT is Inkwell and RawMaterialBtn, which are loaded with material specific behavior and issues which can be undesired.

    A standardized Widget that provides the Event surface of RawMatBtn, with builtin cursor handling would essentially deprecate GT in most code bases where GT is used primarily for taps, and could itself then be used to compose custom buttons.

    I can't think of any cases where someone using GT for taps, would not want easy custom cursor support.

  5. dkwingsmt commented on Jun 3, 2020

    @dkwingsmt
    ContributorAuthor

    @esDotDev By GT do you mean GestureDetector? I don’t quite get you yet, but does MouseRegion, which has a cursor property to customize cursors work for you?

  6. esDotDev commented on Jun 3, 2020

    @esDotDev

    Yes I mean Gesture Detector.

    Well, for use case, consider I need to build any custom non-material button. Ideally I could create this without writing 100+ lines of boilerplate to handle basic Btn functionality, or spending hours trying to strip away the myriad of behaviours that RawMaterialButton/Inkwell support.

    I would like to have basic button events like:

    • onDoubleTap
    • onFocusChange
    • onHighlightChanged
    • onHover
    • onLongPress
    • onTap
    • onTapCancel
    • onTapDown

    I would also like to have standard button behavior, like a mouse cursor on roll-over and traversal-focus-support.

    It's not that this would be a hard Widget to build, but the absence of something like this feels wrong. If GestureDetector is truly to be a single purpose widget, then it seems to make sense that the Flutter team would compose it + focus node + mouse region into a simple straightforward "Button" that we can then use as a key building block in all our custom designs.

    If flutter team provided something like this, I could create my simple button in as little as this:

    Color _overColor;
    Color _focusColor;
    
    return SimpleButton(
       child: Container(color: _focusColor ?? _overColor ?? Colors.red)
       onHover: (v) => _overColor = v? Colors.green : null,
       onFocusChange : (v) => _focusColor = v? Colors.blue : null,
    )
    

    It would be tabbable, it would have mouse-cursor support, and it would be extremely simple to construct.

    If you compare that to hand-rolling everything, hopefully the value is clear as a building block?

  7. dkwingsmt commented on Jun 3, 2020

    @dkwingsmt
    ContributorAuthor

    @esDotDev I suggest raising it as a separate issue, since it sounds highly above the scope of this issue (although personally I don't think it sounds "basic" and widespread enough).

  8. esDotDev commented on Jun 3, 2020

    @esDotDev

    It's literally applying the same single responsibility principle you just championed for GT, but for a clickable region. Does it really make sense that Inkwell, with all it's baggage and opinion, is the lowest-level clickable area we can use that has a complete btn implementation?

    This seem extremely basic/widespread to me. This simple component can be expanded to create any button design required. Removing the mundane boilerplate of cursor/focus management from the developers.

    Color _overColor;
    Color _focusColor;
    
    return SimpleButton(
       child: Container(color: _focusColor ?? _overColor ?? Colors.red)
       onHover: (v) => _overColor = v? Colors.green : null,
       onFocusChange : (v) => _focusColor = v? Colors.blue : null,
    )
    
  9. dkwingsmt commented on Jun 3, 2020

    @dkwingsmt
    ContributorAuthor

    @esDotDev Nevertheless, would you mind making it a separate issue? It'll get more notice and discussion in that way.

  10. jlubeck commented on Jun 24, 2020

    @jlubeck
    Contributor

    @dkwingsmt you mentioned that It's actually RichText with an InlineSpan that has recognizers; however, when adding a TapGestureRecognizer to that, it does not show the mouse cursor which would be expected

  11. dkwingsmt commented on Jun 24, 2020

    @dkwingsmt
    ContributorAuthor

    @jlubeck Yes that's intended (although I get what you want). TapGestureRecognizer only allows textspans to respond to pointer events. It takes something else to make it change mouse cursors, however the current design makes it very hard. I'm aware that cursor on links is an important demand and will take it as a high priority issue.

  12. 32 remaining items

  13. added a commit that references this issue on Mar 11, 2025
  14. added a commit that references this issue on Aug 14, 2025
  15. erf commented on Jun 14, 2026

    @erf

    I'm missing a mouseCursor field to PopupMenuButton.

  16. added
    packageflutter/packages repository. See also p: labels.
    and removed
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Aug 17, 2026
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

    P3Issues that are less important to the Flutter projecta: desktopRunning on desktopa: mouseIssues related to using a mouse or mouse supportc: new featureNothing broken; request for a new capabilityp: cupertino_uicupertino_ui package in flutter/packagesp: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions