Snippets Collections
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
Row {
    Button(onClick = {
        coroutineScope.launch {
            // 0 is the first item index
            scrollState.animateScrollToItem(0)
        }
    }) {
        Text("Scroll to the top")
    }

    Button(onClick = {
        coroutineScope.launch {
            // listSize - 1 is the last index of the list
            scrollState.animateScrollToItem(listSize - 1)
        }
    }) {
        Text("Scroll to the end")
    }
}
star

Mon Jun 21 2021 18:47:28 GMT+0000 (Coordinated Universal Time) https://github.com/waliasanchit007/FirstJetpackCompose

#by #kotlin #jetpackcompose
star

Sun Jun 20 2021 19:49:37 GMT+0000 (Coordinated Universal Time) https://developer.android.com/courses/pathways/compose

#lazycolumn #list #jetpackcompose

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension