*Hello, I was playing around with a slightly tilte...
# compose
o
Hello, I was playing around with a slightly tilted (about 3–5°)
LazyRow
in Compose, and I had a crazy idea about how gestures behave in more extreme cases. So I tested the behaviour of the
LazyRow
when rotated by 90° and 180°.
Honestly, I expected rotate to be a graphics-layer transform, so the rotation wouldn’t affect how gestures work. Surprisingly, drag works well on the rotated
LazyRow
(it moves in the direction you actually dragged, despite the rotation), but fling doesn’t (at 180°, it flings in the opposite direction to the drag).
The more confusing thing is the inconsistency. Is this expected? If not, which of the two implements the correct behaviour? The code looks something like this:
Copy code
LazyRow(
  horizontalArrangement = Arrangement.spacedBy(16.dp),
  modifier = Modifier.padding(16.dp).rotate(180f)
) {
  items(20) {
    Box(
      Modifier
        .height(200.dp)
        .width(120.dp)
        .background(Color.Red)
    ) {
      Text(it.toString())
    }
  }
}
This is with androidx.compose.foundation:foundation 1.12.1