CountdownTimer
fun CountdownTimer(state: CountdownTimerState, modifier: Modifier = Modifier, style: CountdownTimerStyle = CountdownTimerDefaults.style(), dimensions: CountdownTimerDimensions = CountdownTimerDefaults.dimensions(), onTimerFinish: () -> Unit = {})(source)
Shows the time left on state as HH : MM : SS boxes, and hides itself when it reaches zero.
val timer = rememberCountdownTimerState(duration = 2.minutes)
CountdownTimer(state = timer, onTimerFinish = { canResend = true })Content copied to clipboard
Screen readers announce the time as a sentence, like "4 minutes, 32 seconds remaining", when the timer is focused. It isn't a live region, so it won't interrupt the user every second.
Parameters
onTimerFinish
Called once when the countdown reaches zero, including when state had already ended by the time this was first shown.