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

JimK

10/02/2020, 8:52 PM
Updated to canary 13 with alpha04 and found that my imports for Modifiers need a package change from :
Copy code
import androidx.compose.foundation.layout.RowScope.weight
to
Copy code
import androidx.compose.foundation.layout.RowScope.Companion.weight
Has anyone else experienced this? The IDE doesn't suggest the change, had to stumble into it myself
r

Rudolf Tammekivi

10/02/2020, 8:53 PM
this was discussed here just yesterday
j

JimK

10/02/2020, 8:53 PM
I'll look, my apologies
a

Adam Powell

10/02/2020, 9:14 PM
These are not meant to be statically imported at all; expect this to change again such that the latter doesn't work either. 🙂 If you are using these modifiers directly in a Row or Column, they are already available and do not need to be imported. If you are using them at the top level of an unrelated composable function, you should declare that function as an extension of RowScope or ColumnScope, which will enforce that they must be used inside a Row or Column and also make the child modifiers available
🙏 1
j

JimK

10/02/2020, 9:28 PM
Much appreciated on the response + explanation. I was using
LazyColumnFor()
and my
weight
modifier went red. Got it all sorted with your helps thanks again
a

Adam Powell

10/02/2020, 9:58 PM
Ah, then yes, chances are it wasn't doing anything for you there anyway 🙂
👍 1
2 Views