Fudge
08/29/2021, 5:50 PM@Composable
fun FancyTextField(value: String, onValueChange: (String) -> Unit, modifier: Modifier = Modifier) {
Column(modifier) {
TextField(value, onValueChange)
Text("fancy!")
}
}
While looking innocent, this code breaks the passed modifiers. If I pass for example Modifier.fillMaxWidth()
, then only the Column
will have expanded width, and the TextField
will stay the same size, meaning that fillMaxWidth
will not make FancyTextField
fill max width (in practice). Obviously passing a modifier to TextFIeld
(instead or in addition) won't work well.
So how should FancyTextField
be declared in such a way that modifiers work as expected?Adam Powell
08/29/2021, 6:29 PMAdam Powell
08/29/2021, 6:30 PMLayout
that arranges things in a column that propagates this is pretty simple to write until then, provided you don't need to also implement weight and alignment lines like the stock Column
doesFudge
08/29/2021, 6:33 PMAdam Powell
08/29/2021, 6:38 PMAdam Powell
08/29/2021, 6:39 PMZach Klippenstein (he/him) [MOD]
08/29/2021, 10:42 PMFudge
08/30/2021, 7:32 AM