Updated on 2026-08-14

This commit is contained in:
Tangem 2024-04-25 19:53:21 +05:00
parent 901b95dc68
commit 5b50e044cd
2 changed files with 11 additions and 2 deletions

View file

@ -27,9 +27,15 @@ private const val NORMAL_ALPHA = 1f
* @param state cryptocurrency icon config
* @param modifier component modifier
* @param shouldDisplayNetwork specifies whether to display network badge
* @param shouldDisplayCustom specifies whether to display custom badge
*/
@Composable
fun TokenIcon(state: TokenIconState, modifier: Modifier = Modifier, shouldDisplayNetwork: Boolean = true) {
fun TokenIcon(
state: TokenIconState,
modifier: Modifier = Modifier,
shouldDisplayNetwork: Boolean = true,
shouldDisplayCustom: Boolean = true,
) {
BaseContainer(modifier = modifier) {
val iconModifier = Modifier
.align(Alignment.Center)
@ -46,6 +52,7 @@ fun TokenIcon(state: TokenIconState, modifier: Modifier = Modifier, shouldDispla
icon = state,
modifier = iconModifier,
shouldDisplayNetwork = shouldDisplayNetwork,
shouldDisplayCustom = shouldDisplayCustom,
)
}
}
@ -76,6 +83,7 @@ private fun BoxScope.ContentIconContainer(
icon: TokenIconState,
modifier: Modifier = Modifier,
shouldDisplayNetwork: Boolean = true,
shouldDisplayCustom: Boolean = true,
) {
val networkBadgeOffset = TangemTheme.dimens.spacing4
val (alpha, colorFilter) = remember(icon.isGrayscale) {
@ -104,7 +112,7 @@ private fun BoxScope.ContentIconContainer(
)
}
if (icon.showCustomBadge) {
if (icon.showCustomBadge && shouldDisplayCustom) {
CustomBadge(modifier = Modifier.align(Alignment.BottomEnd))
}
}

View file

@ -96,6 +96,7 @@ private fun SendAmountCurrencyButton(button: SendAmountSegmentedButtonsConfig, i
TokenIcon(
state = button.iconState,
shouldDisplayNetwork = false,
shouldDisplayCustom = false,
modifier = Modifier
.size(TangemTheme.dimens.size18),
)