AmrJyniat
05/10/2025, 4:52 PMerrorContainerColor
in OutlinedTextField, it appears only with Dark mode, when IsError
value is changed, the TextField color highlight? Before switching from one color to another, am I missing something?AmrJyniat
05/10/2025, 4:53 PMval customTextSelectionColors = TextSelectionColors(
handleColor = CustomColors.primary,
backgroundColor = CustomColors.primary.copy(alpha = .4f)
)
CompositionLocalProvider(LocalTextSelectionColors provides customTextSelectionColors) {
OutlinedTextField(
value = textValue,
singleLine = true,
textStyle = customTypography.bold(),
shape = RoundedCornerShape(8.dp),
isError = isError,
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number),
onValueChange = { value ->
val newValue = value.copy(
text = value.text.filter { it.isDigit() }
)
onValueChange(newValue)
},
colors = OutlinedTextFieldDefaults.colors(
focusedTextColor = CustomColors.dynamicBlack,
unfocusedTextColor = CustomColors.dynamicBlack,
errorTextColor = CustomColors.dynamicBlack,
unfocusedBorderColor = Color.Transparent,
focusedBorderColor = Color.Transparent,
cursorColor = CustomColors.primary,
errorContainerColor = MaterialTheme.colorScheme.errorContainer,
errorBorderColor = Color.Transparent,
focusedContainerColor = Color.LightGray.copy(alpha = 0.2f),
unfocusedContainerColor = Color.LightGray.copy(alpha = 0.2f)
),
modifier = Modifier.fillMaxWidth(),
trailingIcon = {
Text(
text = stringResource(Res.string.px),
style = customTypography.regular(),
color = CustomColors.labelSecondary,
)
}
)
}
AmrJyniat
05/11/2025, 12:33 PM