Updated on 2026-08-14
This commit is contained in:
parent
5ee06b0a31
commit
bd8a72194e
2 changed files with 24 additions and 12 deletions
|
|
@ -141,19 +141,27 @@ private fun TangemTextField(
|
|||
},
|
||||
trailingIcon = {
|
||||
val iconRes by rememberUpdatedState(
|
||||
newValue = if (isError) R.drawable.ic_alert_24 else R.drawable.ic_close_24,
|
||||
newValue = if (isError) {
|
||||
R.drawable.ic_alert_24
|
||||
} else if (value.text.isNotEmpty()) {
|
||||
R.drawable.ic_close_24
|
||||
} else {
|
||||
null
|
||||
},
|
||||
)
|
||||
IconButton(
|
||||
modifier = Modifier.size(32.dp),
|
||||
onClick = onClear,
|
||||
enabled = !isError && enabled,
|
||||
) {
|
||||
Icon(
|
||||
modifier = Modifier.size(24.dp),
|
||||
painter = painterResource(id = iconRes),
|
||||
tint = colors.trailingIconColor(enabled = enabled, isError = isError).value,
|
||||
contentDescription = "Clear input",
|
||||
)
|
||||
if (iconRes != null) {
|
||||
IconButton(
|
||||
modifier = Modifier.size(32.dp),
|
||||
onClick = onClear,
|
||||
enabled = !isError && enabled,
|
||||
) {
|
||||
Icon(
|
||||
modifier = Modifier.size(24.dp),
|
||||
painter = painterResource(id = iconRes!!),
|
||||
tint = colors.trailingIconColor(enabled = enabled, isError = isError).value,
|
||||
contentDescription = "Clear input",
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ class TangemColors internal constructor(
|
|||
plain: Color,
|
||||
action: Color,
|
||||
fade: Color,
|
||||
warning: Color = TangemColorPalette.Flamingo,
|
||||
) {
|
||||
var primary by mutableStateOf(primary)
|
||||
private set
|
||||
|
|
@ -159,6 +160,8 @@ class TangemColors internal constructor(
|
|||
private set
|
||||
var fade by mutableStateOf(fade)
|
||||
private set
|
||||
var warning by mutableStateOf(warning)
|
||||
private set
|
||||
|
||||
fun update(other: Background) {
|
||||
primary = other.primary
|
||||
|
|
@ -166,6 +169,7 @@ class TangemColors internal constructor(
|
|||
plain = other.plain
|
||||
action = other.action
|
||||
fade = other.fade
|
||||
warning = other.warning
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue