Jetpack Compose Material Design TextField WrapContentWidth

Viewed 37

I have a disabled OutlinedTextField and i am giving it a value manually. I want to change textfield width by using wrapContentSize because i want to make it small as much as possible.

ConstraintLayout(
    constraintSet = constraints,
    modifier = modifier.fillMaxSize()
) {
   // This is working with "+44" but it's not working with "+444". 
   OutlinedTextField(
        value = +44,
        onValueChange = {},
        enabled = false,
        modifier = modifier.layoutId("country_code").width(61.dp)

    )
// This is not working.
OutlinedTextField(
        value = +44,
        onValueChange = {},
        enabled = false,
        modifier = modifier.layoutId("country_code").width(IntrinsicSize.Min)

    )
}
 constrain(countryCode){
        top.linkTo(country.bottom, margin = 24.dp)
        start.linkTo(country.start)
        
        //These methods are not working too and it's using defaultMinSize property which is MinWidth = 280.dp
        width = Dimension.wrapContent
        width = Dimension.fillToConstraints

    }

Pictures

+44: It has single line.

+444: It has 2 lines and i don't want it.

0 Answers
Related