Predictive Back Handler
actual fun PredictiveBackHandler(enabled: Boolean, onBackStarted: (BackEventCompat) -> Unit?, onBackProgressed: (BackEventCompat) -> Unit?, onBackCancelled: () -> Unit?, onBack: () -> Unit)
expect fun PredictiveBackHandler(enabled: Boolean = true, onBackStarted: (BackEventCompat) -> Unit? = null, onBackProgressed: (BackEventCompat) -> Unit? = null, onBackCancelled: () -> Unit? = null, onBack: () -> Unit)
Handles the predictive back gesture with callbacks for different stages. On non-Android platforms, this falls back to simple BackHandler behavior.
Parameters
enabled
Whether the back handler is enabled.
on Back Started
Called when the back gesture starts. Receives initial BackEventCompat.
on Back Progressed
Called when the back gesture progresses. Receives updated BackEventCompat.
on Back Cancelled
Called when the back gesture is cancelled (user didn't complete the swipe).
on Back
Called when the back gesture is completed or when back button is pressed.
actual fun PredictiveBackHandler(enabled: Boolean, onBackStarted: (BackEventCompat) -> Unit?, onBackProgressed: (BackEventCompat) -> Unit?, onBackCancelled: () -> Unit?, onBack: () -> Unit)