admin管理员组

文章数量:1401590

I have started trying to work with Compose Multiplatform and the following looks like a bug, but I'm new so I'll ask here before reporting. The following code produces web view with 1 text and 6 buttons arranged vertically as expected. If I shrink the window so that only a portion of the buttons can be seen, I can scroll the column, but the scroll stops too soon, and the last item never becomes visible. The original code was much more complicated but I edited down to this and still observe the problem.

NOTE: the actual interface here typically fits all on screen, scroll is just to cover corner cases or amazingly small devices, so let's not spend time talking about LazyColumn, thanks.

@Composable
@Preview
fun App() {
    MaterialTheme {
        val state = rememberScrollState()
        Column(Modifier.verticalScroll(state = state)) {
            Text(
                text = "Foobar",
            )
            Button(onClick = { /*todo*/ }) {
                Text("Log In")
            }
            Button(onClick = { /*todo*/ }) {
                Text("Sign Up")
            }
            Button(onClick = { /*todo*/ }) {
                Text("Check Foo")
            }
            Button(onClick = { /*todo*/ }) {
                Text("Log In")
            }
            Button(onClick = { /*todo*/ }) {
                Text("Sign Up")
            }
            Button(onClick = { /*todo*/ }) {
                Text("Check Foo")
            }
        }
    }
}

The issue can be seen in these three images:

  1. Initial render

  1. Scrolling as far down as possible

  1. Window expanded such that scrolling is not required

I have tried with various numbers and types of items and adding a spacer at the bottom hacks it away, but am I doing something wrong here? Is this a bug in CMP?

I haven't bothered to test this on devices yet since anything that doesn't work on web is a no-go.

Edit: I did eventually test it on iOS and Android, same result

本文标签: compose multiplatformVertical scroll in Column() off by oneStack Overflow