i'm trying to make a TextField that is a minimum size, and that expands around the text being written inside it, how can i achieve this?
This is my test code
var text by rememberSaveable { mutableStateOf("Prova") }
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(text = "Test")
TextField(
modifier = Modifier
// .widthIn(10.dp, Dp.Infinity)
// .width(IntrinsicSize.Min)
.width(30.dp)
.wrapContentWidth(),
value = text,
onValueChange = {
text = it
},
textStyle = TextStyle.Default.copy(
textAlign = TextAlign.End
)
)
}
This is the result i seek (should expand with more text in width up until it hits the left Text)

Thanks for the help!
Using
SpacerwithModifier.weight(1f)in between will make it work.I would suggest replacing
TextFieldwithBasicTextFieldto get finer control over its look (specifically achieving smaller minimum width thanMinWidthdefault value of280.dp).