Function

smoothScroll

Rotate the mouse's scrollWheel by the given scrollAmount.

mouseInputSmoothScroll

@Sampled
fun mouseInputSmoothScroll() {
    composeTestRule.onNodeWithTag("horizontalScrollable").performMouseInput {
        // Scroll forwards horizontally, which is rightwards
        // unless scroll direction is reversed
        smoothScroll(100f, durationMillis = 500L, ScrollWheel.Horizontal)
        // The 100f scroll delta is equally divided into smaller scrolls,
        // such that the time in between two scroll events is more or less
        // equal to the default time between events, 16ms.
    }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: