Does it possible to change the order so I get 1 2 ...
# compose
a
Does it possible to change the order so I get 1 2 3?
Copy code
Row {
    Text(text = "2")
    Text(text = "3")
    Text(text = "1")
}
f
If you write it like this:
Copy code
val items = listOf(2, 3, 1)

// ...

Row {
    for (item in items) 
        Text(text = item.toString())
}
and want to change the order, you can just sort the items and you'll get
1 2 3
a
It was a bad example. what if I have Text and Icon or I want to show one row before another?
f
Just change the order in the list ­čĄĚ The example is still valid. It really depends on your exact usecase. I can't give you better advice from the information given
You can use all the power of kotlin to execute something before other thing.
if
,
when
,
for
, ...
a
okay I get it now, thank you ­čśä
v
https://stackoverflow.com/q/74829791/115145 you can try something like this
z
The fact that composition order corresponds to visual order is a property of the Row layout. If you are trying to do something tricky you can always write a custom layout and place them in whatever order you want.