Zhelyazko Atanasov
04/05/2021, 6:09 AMwidth
of a Column
to a percentage of the screen width. So I'm using Modifier.fillMaxWidth(0.8f)
but the Column
is still occupying the max screen width. Is this an expected behaviour and I haven't fully understood the fraction
argument or it's some kind of a bug? I'm using beta03
If that matters, the Column
is put inside a Surface
with fillMaxSize()
set.
Column(
modifier = Modifier
.fillMaxWidth(0.8f)
.fillMaxHeight()
.background(Color.Green)
) {
val (email, setEmail) = remember { mutableStateOf(TextFieldValue()) }
TextField(
value = email,
onValueChange = { setEmail(it) },
modifier = Modifier
.align(CenterHorizontally)
)
}
Albert Chang
04/05/2021, 6:51 AMSurface
always propagates min size constraints to its children. You are setting fillMaxSize()
on the surface, so the min width, which is the screen width, is passed to the Column
. If you want to use Surface
outside, remove the fillMaxSize()
modifier or wrap the Column
in a Box
.Zhelyazko Atanasov
04/05/2021, 7:14 AMColumn
be 80% of the min width? Unless the incoming max width is Infinity... the docs say that the incoming max width is multiplied by the fraction.Albert Chang
04/05/2021, 7:15 AM