Jasmin Fajkic
09/07/2022, 7:55 AMStylianos Gakis
09/07/2022, 8:47 AMModifier.fillMaxHeight(0.5f)
might be what you’re looking for.
Or potentially this
Column(Modifier.fillMaxSize()) {
Box(Modifier.weight(1f)) {}
Foo(Modifier.weight(1f))
}
if you’re looking for a column with an item that takes up half of the spaceJonas
09/07/2022, 9:54 AMfun Modifier.fractionOfScreenHeight(fraction: Float = 0.5f) = composed {
this.heightIn(max = LocalConfiguration.current.screenHeightDp.dp * fraction)
}
Stylianos Gakis
09/07/2022, 10:13 AMmax
height, and not the min one, so it could also occupy less than that. You’re only setting the upper bound there.
Also in general I would simply imagine querying the LocalConfig to get the height in DP is not the typical use case. Since you usually have to consider available space, the status/navigation bars, other content and so on. What is your use case of the fractionOfScreenHeight
modifier? Care to share an example or two?Jonas
09/16/2022, 11:34 AM