I have made a custom pager indicator that I want to update by checking the current or target page. I have some issues with this:
pagerState.currentPage only updates after scrolling has finished. This is too late for what I need.
pagerState.targetPage updates instantly (as soon as the next page is visible), but only when paging up. When it pages down, it updates when the scroll animation starts. This if fine but it is inconsistent.
Meanwhile, if I use OnPageChangeCallback from ViewPager2 and implement onPageSelected, the selected page always updates when the scroll animation starts (so when the user lifts his or her finger). Which is exactly what I need. This feature is present in targetPage, but only when paging down. Is this a bug?
Shouldn't the behavior overlap as much as possible with ViewPager2 ?
I have made a custom pager indicator that I want to update by checking the current or target page. I have some issues with this:
pagerState.currentPage
only updates after scrolling has finished. This is too late for what I need.pagerState.targetPage
updates instantly (as soon as the next page is visible), but only when paging up. When it pages down, it updates when the scroll animation starts. This if fine but it is inconsistent.Meanwhile, if I use
OnPageChangeCallback
fromViewPager2
and implementonPageSelected
, the selected page always updates when the scroll animation starts (so when the user lifts his or her finger). Which is exactly what I need. This feature is present intargetPage
, but only when paging down. Is this a bug?Shouldn't the behavior overlap as much as possible with
ViewPager2
?Version: 0.18.0