https://kotlinlang.org logo
#compose
Title
# compose
d

Denis

02/25/2021, 7:25 PM
What's the point of this error (not a compile one, thankfully)? What if I want to pass separate modifiers and then apply them conditionally?
l

Luke

02/25/2021, 7:31 PM
Shouldn't the caller pass the proper modifier instead of passing both?
d

Denis

02/25/2021, 7:46 PM
That's a good idea. Maybe I just don't understand how to handle orientations properly. I ended up not needing a separate parameter, but I had something like
Copy code
@Composable fun Main() {
    when (LocalConfiguration.current.orientation) {
        ORIENTATION_LANDSCAPE -> Row {
            Other(weightModifier = Modifier.weight(1f), modifier = Modifier.fillMaxHeight())
        }
        else -> Column {
            Other(weightModifier = Modifier.weight(1f), modifier = Modifier.fillMaxWidth())
        }
    }
}

@Composable fun Other(weightModifier: Modifier, modifier: Modifier) {
    val someSetting = false
    val m = modifier.then(if (someSetting) weightModifier else Modifier)
}
I thought the
someSetting
is irrelevant on the level of
Main
.