AospPageIndicator
An Android 10 Quick Settings-inspired page indicator that tracks a PagerState continuously.
Unlike the original SystemUI implementation, this indicator reads the pager's continuous scroll offset during the draw phase instead of maintaining a pending-transition queue, preventing stale target desynchronization under rapid swipes or button jumps.
State ownership:
Callers own pagerState, sizing, colors, and pageDescription.
Nothing is rendered when
pagerState.pageCount <= 1.For page counts above maxVisibleDots, the visible dots form a continuous sliding window.
Parameters
Shared pager state providing pageCount, currentPage, and currentPageOffsetFraction.
Modifier applied to the indicator canvas.
Diameter of each circular dot (> 0.dp).
Horizontal gap between adjacent dots (>= 0.dp).
Maximum number of dots visible at once before sliding-window scrolling begins (>= 2).
Fill color of the active capsule.
Fill color of inactive dots, defaulting to 42% of selectedColor's alpha.
Optional localized accessibility state description overriding the default English label.
An Android 10 Quick Settings-inspired page indicator for components that manage an integer selectedIndex rather than a PagerState.
State ownership:
Callers own pageCount and selectedIndex.
Single-step transitions animate over animationDurationMillis; new targets interrupt in-flight animations, and multi-page jumps (
abs(delta) > 1) snap directly to the destination.
Parameters
Total number of pages. Nothing is rendered when pageCount <= 1.
Zero-based active page index, clamped to 0 until pageCount.
Modifier applied to the indicator canvas.
Diameter of each circular dot (> 0.dp).
Horizontal gap between adjacent dots (>= 0.dp).
Maximum number of dots visible at once before sliding-window scrolling begins (>= 2).
Duration in milliseconds for single-step page transitions (>= 0).
Fill color of the active capsule.
Fill color of inactive dots, defaulting to 42% of selectedColor's alpha.
Optional localized accessibility state description overriding the default English label.