Created
June 16, 2021 08:42
-
-
Save tayormi/ab58546436d688daf3a26da496a187bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:quiver/async.dart'; | |
| CountdownTimer _countdownTimer; | |
| Listener( | |
| behavior: HitTestBehavior.translucent, | |
| onPointerMove: (_) { | |
| _countdownTimer = | |
| CountdownTimer(Duration(minutes: 5), Duration(seconds: 1)); | |
| }, | |
| onPointerUp: (_) { | |
| _countdownTimer = | |
| CountdownTimer(Duration(minutes: 5), Duration(seconds: 1)); | |
| }, | |
| onPointerDown: (e) { | |
| _countdownTimer = | |
| CountdownTimer(Duration(minutes: 5), Duration(seconds: 1)); | |
| _countdownTimer.listen(( | |
| event, | |
| ) { | |
| print(event.isRunning); | |
| print(_countdownTimer.remaining.inSeconds); | |
| if (_countdownTimer.remaining == Duration(seconds: 0)) { | |
| // timer.cancel(); | |
| print(_countdownTimer.remaining.inSeconds); | |
| handleTimeout(context); | |
| // print('timer cancelled'); | |
| } | |
| }); | |
| }, | |
| child: Container() ); | |
| handleTimeout(BuildContext context) async { | |
| print('logout now'); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment