You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add mouse cursor support to the remaining widgets #58192
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.
It's actually RichText with an InlineSpan that has recognizers; however there is a "hyperlink_test.dart".
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.
@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?
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:
@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).
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.
@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
@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.
Reacted by Herbert Poul, Jan Lübeck, David Mednikov and Hendrix Tavarez
Activity
happyharis commentedon Jun 1, 2020
dkwingsmt commentedon Jun 1, 2020
@happyharis
GestureDetectoris 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,GestureDetectorcontains way more than just clicking. For example, it supports dragging, which you might want to use the "drag" cursor instead.RichTextwith anInlineSpanthat has recognizers; however there is a "hyperlink_test.dart".esDotDev commentedon Jun 3, 2020
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.
dkwingsmt commentedon Jun 3, 2020
@esDotDev By GT do you mean GestureDetector? I don’t quite get you yet, but does MouseRegion, which has a
cursorproperty to customize cursors work for you?esDotDev commentedon Jun 3, 2020
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:
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:
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?
dkwingsmt commentedon Jun 3, 2020
@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).
esDotDev commentedon Jun 3, 2020
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.
dkwingsmt commentedon Jun 3, 2020
@esDotDev Nevertheless, would you mind making it a separate issue? It'll get more notice and discussion in that way.
jlubeck commentedon Jun 24, 2020
@dkwingsmt you mentioned that
It's actually RichText with an InlineSpan that has recognizers;however, when adding aTapGestureRecognizerto that, it does not show the mouse cursor which would be expecteddkwingsmt commentedon Jun 24, 2020
@jlubeck Yes that's intended (although I get what you want).
TapGestureRecognizeronly 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.32 remaining items
#163840 - CupertinoButton cursor doesn't change to clickable on deskt…
Feat: Add mouse cursor for CupertinoDialogAction (#169051)
Feat: Add mouse cursor for CupertinoDialogAction (flutter#169051)
flutter#163840 - CupertinoButton cursor doesn't change to clickable o…
Make `CupertinoRadio`'s `mouseCursor` a `WidgetStateProperty` (#151910)
Add `mouseCursor` property to `CupertinoCheckbox` (#151788)
Add `mouseCursor` parameter to `Chip`s (#159422)
Add `mouseCursor` to `Tooltip` (#159922)
Add `mouseCursor` parameter to `ReorderableListView` (#160246)
#163840 - CupertinoButton cursor doesn't change to clickable on deskt…
erf commentedon Jun 14, 2026
I'm missing a
mouseCursorfield toPopupMenuButton.