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

The timer goes bellow 0 #8

Closed
cesarferreira opened this issue Jun 18, 2021 · 4 comments
Closed

The timer goes bellow 0 #8

cesarferreira opened this issue Jun 18, 2021 · 4 comments

Comments

@cesarferreira
Copy link

I was expecting the behaviour of onFinish to be triggered when it gets to Duration(seconds: 0) yet it didn't and it continued to negative values, is this a bug? thanks!

 Widget _timer() {
    return CustomTimer(
      controller: _timerController,
      from: widget.durationLeft,
      to: Duration(seconds: 0),
      interval: Duration(seconds: 1),
      onFinish: () => widget.onFinish(),
      onBuildAction: CustomTimerAction.auto_start,
      builder: (CustomTimerRemainingTime remaining) {
        return Text('${remaining.hours}:${remaining.minutes}:${remaining.seconds}');
      },
    );
  }
@federicodesia
Copy link
Owner

I am testing on the latest version of the package and the callback function works fine for me.
onFinish: () => print("Finished")
You may have a problem in the function you are executing? try to simplify it to see if it is a package problem.

@cesarferreira
Copy link
Author

But is the library supposed to continue after it reaches Duration.zero ?

@federicodesia
Copy link
Owner

No, it shouldn't continue.
What is the problem? does the callback function never get executed or does the counter get negative values ​​like in issue #7?
It is also difficult to solve it because I do not get either of the two problems from the latest version.

@federicodesia
Copy link
Owner

Hello! sorry for the inactivity.
I have updated the package fixing several of the problems that had appeared.

Closing for now, but if the problem continues please let me know!
Thank you very much for helping to improve this package! 🚀

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

No branches or pull requests

2 participants