circular_countdown_timer icon indicating copy to clipboard operation
circular_countdown_timer copied to clipboard

CountDown timer not working on the background state of App

Open sajjad-yousaf opened this issue 2 years ago • 3 comments

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

sajjad-yousaf avatar Nov 07 '22 10:11 sajjad-yousaf

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

TomasWard1 avatar Nov 21 '22 02:11 TomasWard1

same problem.

kasrakasaian avatar Jan 01 '23 08:01 kasrakasaian

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,
          ),
),

emmggi avatar Feb 11 '23 18:02 emmggi