Search code examples
flutterflame

How to detect tap on Flutter Flame v1.0.0-rc6 and later?


What's the equivalent of:

TapGestureRecognizer tapper = TapGestureRecognizer(); 
tapper.onTapDown = game.onTapDown; 
flameUtil.addGestureRecognizer(tapper);

in Flame 1.0.0-rc6 and later ?

I've tried many ways to detect tap but it don't seems to work. It was working before the AddGestureRecognizer removing update.

Thank you :)


Solution

  • I found my error,

    my UI (menu, life etc...) was "over" the touch detection so onTapDown wasn't able to detect any touch because it was under.

    I solved it by reducing my containers's sizes to be able to reach the "bottom" layer of onTapDown.