Detect when user interact with the app (Flutter)
1,733
Use a Listener
instead of GestureDetector
.
Listener(
onPointerDown: (e) => print('listener'),
child: RaisedButton(
onPressed: () => print('raisedButton'),
),
),
![NqbraL](https://lh3.googleusercontent.com/-rK7BLSh0LPA/AAAAAAAAAAI/AAAAAAAAABo/TEyP_Yev3Ts/photo.jpg?sz=256)
Author by
NqbraL
Updated on December 15, 2022Comments
-
NqbraL over 1 year
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 ;)
-
NqbraL over 4 yearsBtw, I've tried to use IgnorePointer widget or the behavior property of GestureDetector : not working :'(
-
-
NqbraL over 4 yearsWow, thank you for this quick answer and the solution is working fine ! Love u mate :D
-
user481610 about 4 yearsYou sir need a medal. This works very nicely to handle session management.