5

I need a little help there.

I want to disconnect the user from the app when he has been inactive for 5 minutes. So I used this solution : Detect when user is not interacting the app in Flutter

It is perfectly working when the user tap on a widget that is not clickable. For example, when I tap on Text widget, the timer is restarting without an issue, but when I tap on a RaisedButton or ListTile, the timer is not restarting.

So, I'm wondering how it is possible for example with this code :

GestureDetector(
  onTap: () => print("gestureDetector"),
  child: RaisedButton(
    onPressed: () => print("raisedButton"),
  ),
),

to print "gestureDetector" AND "raisedButton".

Thank you in advance for your help, cheers ;)

1
  • Btw, I've tried to use IgnorePointer widget or the behavior property of GestureDetector : not working :'( Commented Nov 27, 2019 at 10:14

1 Answer 1

18

Use a Listener instead of GestureDetector.

Listener(
  onPointerDown: (e) => print('listener'),
  child: RaisedButton(
    onPressed: () => print('raisedButton'),
  ),
),
Sign up to request clarification or add additional context in comments.

2 Comments

Wow, thank you for this quick answer and the solution is working fine ! Love u mate :D
You sir need a medal. This works very nicely to handle session management.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.