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

CountDown timer not working on the background state of App #48

Open
sajjad-yousaf opened this issue Nov 7, 2022 · 3 comments
Open

CountDown timer not working on the background state of App #48

sajjad-yousaf opened this issue Nov 7, 2022 · 3 comments

Comments

@sajjad-yousaf
Copy link

I have a workout app that plays different exercises and some beep and tts onChange condition. So whenever the app goes on background timer stop working even not restarted in the background. Kindly help me to solve this problem. Thank you

@TomasWard1
Copy link

same problem. Need to notify the user when my timer completes, even if in the background. Please clarify.

@kasrakasaian
Copy link

same problem.

@emmggi
Copy link

emmggi commented Feb 11, 2023

Mine is also a workout app. I have an issue where it says

_AssertionError ('package:flutter/src/animation/animation_controller.dart': Failed assertion: line 493 pos 7: '_ticker != null': AnimationController.reverse() called after AnimationController.dispose()
AnimationController methods should not be used after calling dispose.)

when I try to display this widget after it was hidden (another one was shown using a conditional). The error leads me to this line:

void start() {
    if (_isReverse != null && _state != null && _state?._controller != null) {
      if (_isReverse!) {
        _state?._controller?<PUTS CURSOR HERE>.reverse(
            from: _initialDuration == 0
                ? 1
                : 1 - (_initialDuration! / _duration!));
      } else {
        _state?._controller?.forward(
            from: _initialDuration == 0 ? 0 : (_initialDuration! / _duration!));
      }
      isStarted = true;
      isPaused = false;
      isResumed = false;
      isRestarted = false;
    }
  }

and these are my args

CircularCountDownTimer(
          duration: currentSecond,
          fillColor: Colors.transparent,
          ringColor: Colors.transparent,
          height: MediaQuery.of(context).size.height * 0.40,
          width: 180,
          autoStart: false,
          isReverse: true,
          controller: _countdownController,
          onComplete: () async => await _onFinished(),
          textStyle: TextStyle(
            fontSize: 160,
            color: resting ? Colors.grey : Colors.black,
          ),
),

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

4 participants