pageScrollStateChanges

Create a Flow of page scroll state change events on the ViewPager instance where the value emitted can be one of SCROLL_STATE_IDLE, SCROLL_STATE_DRAGGING} or SCROLL_STATE_SETTLING.

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

Example of usage:

viewPager.pageScrollStateChanges()
.onEach { state ->
// handle state
}
.launchIn(uiScope)