Skip to content

GestureDetector -> onTap does not provide globalPosition #18552

@lukepighetti

Description

@lukepighetti

Hello,

I am making a widget that used onHorizontalDragUpdate and MediaQuery to find the X position such that it can be used to update the state of 5 rating stars. The idea is you can drag left and right and the starts go from 1 to 5.

I am trying to add the ability to tap on the stars, and I realized that my life would be so easy to use GestureDetector -> onTap to add this feature at the top level. But because onTap does not provide a details object with globalPosition it looks like my only option (that I am personally aware of) is to do a callback at the star object all the way through the tree to my list item object.

I see that onTap returns void, it would seem like a great opportunity to return some information about where on the screen has been tapped. It is, after all, GestureDetector, and not like a button.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions