Does anybody know what's the difference between ha...
# compose
z
Does anybody know what's the difference between having a
Modifier
passed in as an argument and then adding more modifiers on top of it, e.g.:
Copy code
fun Info(modifier: Modifier) {
    Text(modifier.size(16.dp)
}
Versus having the same case, but using
then
to merge the 2 modifiers:
Copy code
fun Info(modifier: Modifier) {
    Text(modifier then Modifier.size(16.dp)
}
a
The second is a more complicated way of saying exactly what the first does. In math terms it's like the difference between
2 + 2
vs.
2 + (1 * 2)
z
Thanks, but then another question comes up - is there a case where we'd like to use
then
?
d
It can be useful when you're writing your own modifiers and not basing them on an existing modifier
fun Modifier.custom() = this then { ...} @Zhelyazko Atanasov
🙏 1