@Composable
fun BasicInputTextField(
modifier: Modifier = Modifier,
height: Int = R.dimen.cgux_text_field_normal_height,
) {
var text by remember { mutableStateOf("Hello") }
Box(
modifier = modifier
.height(dimensionResource(id = height))
.border(1.dp, Color.Gray, shape = RoundedCornerShape(4.dp)),
contentAlignment = Alignment.CenterStart,
) {
BasicTextField(
modifier = Modifier.padding(horizontal = 10.dp),
value = text,
onValueChange = { text = it },
textStyle = TextStyle(
fontSize = 14.sp,
lineHeight = 16.sp,
color = Color.Black,
),
singleLine = true,
)
}
}
我正在使用上面的代码自定义基本 TextField,因为我无法设置它的高度。有什么办法可以设置它的默认宽度吗?