Skip to content

Commit

Permalink
Fix trailing text color when text field is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
paulinea committed May 12, 2022
1 parent ce38d52 commit e87ef0e
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ fun OdsTextField(
modifier = Modifier.padding(end = dimensionResource(id = R.dimen.ods_spacing_xs)),
text = trailingText,
style = MaterialTheme.typography.subtitle1,
color = MaterialTheme.colors.trailingTextColor(value.isEmpty())
color = MaterialTheme.colors.trailingTextColor(value.isEmpty(), enabled)
)
}
}
Expand Down Expand Up @@ -178,8 +178,8 @@ private fun OdsTextFieldIcon(painter: Painter, contentDescription: String?, onCl
}

@Composable
private fun Colors.trailingTextColor(isValueEmpty: Boolean = false) =
if (isValueEmpty) {
private fun Colors.trailingTextColor(isValueEmpty: Boolean, isTextFieldEnabled: Boolean) =
if (isValueEmpty || !isTextFieldEnabled) {
MaterialTheme.colors.onSurface.copy(alpha = ContentAlpha.disabled)
} else {
MaterialTheme.colors.onSurface
Expand Down

0 comments on commit e87ef0e

Please sign in to comment.