I am trying to detect the activity of user like Mouse Moving or Typing in Text field or Clicking on screen anywhere. Using Timer Function I can achieve to logout from the Portal if there is no activity for 15 minutes but this functionality is only working when user set idle the window pane. For example: In Browser user open two tabs and on first tab user using the portal and suddenly working on the another tab of same window pane then this feature is not working (it's pause the time) but if user using two different applications then this feature is working.
So need help how to make this functionality better.
Flutter Web Only...
I tried simple Timer Function of Flutter. I am trying to logout the user from the portal after some time if there is no activity.
I am sure I developed this code from some other question here on SO, but I can't find it.
Anyway, I have a similar function in a webapp of mine: it detects mouse clicks and the likes (not mouse movement!), and logs out the user if the timer runs out. As far as I know, it doesn't have any problem with different tabs.
This is the class that acts as timer:
This is the
HomePagestate that has the session timer:This is the
GestureDetectorat the top of the widget tree (after the user has logged in, of course):Hope this helps.