https://kotlinlang.org logo
Title
y

Yan Pujante

05/22/2022, 3:53 PM
I noticed that using a
Slider
within a row does not work if the other elements in the row change sizes (see attached screenshot). Code that demonstrates the behavior
fun main() = singleWindowApplication {
    var zoom by remember { mutableStateOf(1f) }
    Row {
        Text(text = "Zoom = ${zoom}")
//        Text(text = "Hello") // using a "static" text fixes the issue
        Slider(value = zoom, valueRange = 0.25f..1.5f, onValueChange = { zoom = it })
    }
}
Is this an expected behavior or is this a bug that I should report somewhere?
😕 1
f

Fudge

05/22/2022, 6:56 PM
Cool phone number selector
😅 3
x

xxfast

05/22/2022, 9:57 PM
Feels like intended behaviour
🤔 2
d

Dragos Rachieru

05/23/2022, 2:16 PM
I think that's bad UX and can lead to other bugs what happens if the slider is still being clicked and the slider moves to the left, then the slide will have to be moved to the right because that's where the mouse is, but that will trigger a new value in the text which will redraw the text and move the slider again and so on