Skip to content
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

Merged
merged 1 commit into from Jan 22, 2024
Merged

Conversation

GoodVibesLab
Copy link
Contributor

I added the capability to adjust the refresh interval

Copy link
Owner

@hukusuke1007 hukusuke1007 left a 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;
Copy link
Owner

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;
Copy link
Owner

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,
Copy link
Owner

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);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refreshTime

@hukusuke1007 hukusuke1007 merged commit 3901246 into hukusuke1007:master Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants