I modified my textfield according to this article. I want to make this.
It's the my code's result. As you can see border is disabled but the text is still enabled.
CodePudding user response:
Set the color of your BasicTextField
's textStyle
to the color from TextFieldDefaults.outlinedTextFieldColors()
val colors = TextFieldDefaults.outlinedTextFieldColors()
val enabled = false
OutlinedTextField(
textStyle = TextStyle.Default.copy(color = colors.textColor(enabled).value),
...
)
CodePudding user response:
It seems a bug.
As workaround you can use something like:
val colors = TextFieldDefaults.outlinedTextFieldColors()
val enabled = false
val textColor = colors.textColor(enabled).value
val mergedTextStyle = TextStyle.Default.merge(TextStyle(color = textColor))
BasicTextField(
//your implementation
textStyle = mergedTextStyle,
) {
TextFieldDefaults.OutlinedTextFieldDecorationBox(
//your implementation
)
}