From 19dbda5354c43a36706c983a8cd942e00702106f Mon Sep 17 00:00:00 2001 From: Tyemy Kuga Date: Wed, 21 Oct 2020 22:57:54 -0300 Subject: [PATCH] Adding pause and resume to timer --- CHANGELOG.md | 1 + lib/time.dart | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c732438a..9e6446b4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [next] - Fix spriteAsWidget deprecation message +- Adding pause and resume methods to time class ## 0.27.0 - Improved the accuracy of the `FPSCounter` by using Flutter's internal frame timings. diff --git a/lib/time.dart b/lib/time.dart index 1fa3df0f2..6f02bac7d 100644 --- a/lib/time.dart +++ b/lib/time.dart @@ -48,6 +48,14 @@ class Timer { _running = false; } + void pause() { + _running = false; + } + + void resume() { + _running = true; + } + /// A value between 0 and 1 indicating the timer progress double get progress => _current / _limit; }