offsetChanges

fun AppBarLayout.offsetChanges(): Flow<Int>

Create a Flow of offset changed events on the AppBarLayout instance where the value emitted is the verticalOffset of the AppBarLayout.

Note: Created flow keeps a strong reference to the AppBarLayout instance until the coroutine that launched the flow collector is cancelled.

Example of usage:

snackbar.offsetChanges()
.onEach { verticalOffset ->
// handle verticalOffset
}
.launchIn(uiScope)