https://kotlinlang.org logo
#compose
Title
# compose
c

caelum19

08/07/2020, 2:51 PM
Hey, I've found that there is pretty low fps scrolling in a ScrollableColumn inside a ConstraintLayout with height set to Dimension.fillToConstraints, that contains text. No lag:
Copy code
setContent {
    ConstraintLayout(modifier = Modifier.fillMaxSize()) {
        val d = createRef()

        ScrollableColumn(modifier = Modifier.constrainAs(d) {
            top.linkTo(<http://parent.top|parent.top>, 30.dp)
            bottom.linkTo(parent.bottom, 30.dp)
            width = Dimension.value(360.0.dp)
            height = Dimension.fillToConstraints
        }) {
            for (i in 0..30) {
                Box(
                    Modifier.size(135.dp, 60.dp).background(Color.Red)
                        .drawBorder(1.dp, Color.Black)
                ) {
                    //  Text("scrrt scrrt")
                    for (i2 in 0..40 step 2)
                        Box(
                            Modifier.size((135 - i2).dp, (60 - i2).dp).background(Color.Red)
                                .drawBorder(1.dp, Color.Black)
                        ) {

                        }
                }
            }
        }
    }
}
Uncomment // Text("scrrt scrrt") and scrolling is pretty stuttery (even without the many cascading boxes) But with text, and height = Dimension.value(600.dp), the lag is gone. Without the ConstraintLayout there is also no lag. Am I doing something silly? I'll create an issue if I'm not 🙂 Using dev 16, though was equally an issue in 15 that I've just potentially isolated
Also slow using Dimension.percent
a

Adam Powell

08/07/2020, 3:17 PM
This looks like a good repro case! If you can file an issue for it we'd definitely appreciate it
👍 2
c

caelum19

08/07/2020, 5:13 PM
👍 2
3 Views