startCountDown method
void
startCountDown()
倒计时
Implementation
void startCountDown() {
if (_isClosed) return;
isCountingDown.value = true;
_timer1 = Timer.periodic(const Duration(seconds: 1), (timer) {
if(timer.tick > totalDuration()){
isCountingDown.value = false;
timer.cancel();
onStop();
return;
}
countDownTime.value = totalDuration() - timer.tick;
if (countDownTime.value == 0) {
isCountingDown.value = false;
timer.cancel();
onStop();
return;
}
});
}