Is it possible to flip a `LazyColumn` in Compose a...
# compose
j
Is it possible to flip a
LazyColumn
in Compose and still have the scrolling work? Small example:
Copy code
@Composable
fun MyScreen(modifier: Modifier = Modifier) {
    Column(modifier.fillMaxSize()) {
        DummyList(Modifier.weight(1f).rotate(180f))
        DummyList(Modifier.weight(1f))
    }
}

@Composable
fun DummyList(modifier: Modifier) {
    LazyColumn(modifier, verticalArrangement = Arrangement.spacedBy(8.dp)) {
        items(100) {
            Card {
                Text("Test ${it}", Modifier.padding(16.dp).fillMaxWidth())
            }
        }
    }
}
Scrolling works, but the fling is completely broken in this case. I tried using a custom
flingBehaviour
(see 🧵), but it didn't work.
Custom `flingBehavior`:
Copy code
val defaultFlingBehaviour = ScrollableDefaults.flingBehavior()
remember {
    object : FlingBehavior {
        override suspend fun ScrollScope.performFling(initialVelocity: Float): Float =
            defaultFlingBehaviour.run { performFling(-initialVelocity) }
    }
}
I would expect that the scrolling in the upper List is reversed.
y
What are you trying to achieve? Just flipping the layout can be achieved by setting the following:
LazyColumn(reverseLayout = true)
j
The layout should be flipped as well. Not the reversed order, but the whole thing should be upside down
But this seems to work when I just flip the single items with the reversed layout 👍 Thank you!
👍 1
y
You're welcome 🙂