New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added refreshTime parameter #38
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
I commented because I would love to merge it, but would like to see some refactoring.
@@ -108,6 +110,7 @@ class StopWatchTimer { | |||
int _startTime = 0; | |||
int _stopTime = 0; | |||
late int _presetTime; | |||
late int _refreshTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final int refreshTime;
@@ -40,6 +41,7 @@ class StopWatchTimer { | |||
}) { | |||
/// Set presetTime | |||
_presetTime = presetMillisecond; | |||
_refreshTime = refreshTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
@@ -32,6 +32,7 @@ class StopWatchTimer { | |||
this.isLapHours = true, | |||
this.mode = StopWatchMode.countUp, | |||
int presetMillisecond = 0, | |||
int refreshTime = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.refreshTime = 1,
@@ -313,7 +316,7 @@ class StopWatchTimer { | |||
void _start() { | |||
if (!isRunning) { | |||
_startTime = DateTime.now().millisecondsSinceEpoch; | |||
_timer = Timer.periodic(const Duration(milliseconds: 1), _handle); | |||
_timer = Timer.periodic(Duration(milliseconds: _refreshTime), _handle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refreshTime
I added the capability to adjust the refresh interval