Updated on 2026-08-14
This commit is contained in:
parent
2c1f4c0784
commit
e9ed80c7a4
4 changed files with 176 additions and 32 deletions
|
|
@ -2,15 +2,17 @@ package com.tangem.feature.wallet.presentation.wallet.ui.components.common
|
|||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyListScope
|
||||
import androidx.compose.runtime.key
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.tangem.core.ui.components.FontSizeRange
|
||||
import com.tangem.core.ui.components.buttons.HorizontalActionChips
|
||||
import com.tangem.core.ui.components.buttons.actions.ActionButton
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletManageButton
|
||||
import com.tangem.feature.wallet.presentation.wallet.ui.components.fastForEach
|
||||
import com.tangem.feature.wallet.presentation.wallet.ui.components.multicurrency.MultiCurrencyAction
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
|
||||
|
|
@ -64,9 +66,18 @@ internal fun LazyListScope.actions(
|
|||
horizontalArrangement = Arrangement.spacedBy(space = TangemTheme.dimens.spacing8),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
actions.fastForEach {
|
||||
key(it::class.java) {
|
||||
ActionButton(config = it.config, modifier = Modifier.weight(1f))
|
||||
val fontSizeRange = FontSizeRange(min = 10.sp, max = 14.sp)
|
||||
var fontSizeValue by remember { mutableFloatStateOf(fontSizeRange.max.value) }
|
||||
|
||||
actions.fastForEach { action ->
|
||||
key(action::class.java) {
|
||||
MultiCurrencyAction(
|
||||
config = action.config,
|
||||
fontSizeValue = fontSizeValue.sp,
|
||||
fontSizeRange = fontSizeRange,
|
||||
onFontSizeChange = { fontSizeValue = it },
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
package com.tangem.feature.wallet.presentation.wallet.ui.components.multicurrency
|
||||
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.TextUnit
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.tangem.core.ui.components.FontSizeRange
|
||||
import com.tangem.core.ui.components.ResizableText
|
||||
import com.tangem.core.ui.components.buttons.actions.ActionBaseButton
|
||||
import com.tangem.core.ui.components.buttons.actions.ActionButtonConfig
|
||||
import com.tangem.core.ui.components.buttons.actions.ActionButtonContent
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
@Composable
|
||||
internal fun MultiCurrencyAction(
|
||||
config: ActionButtonConfig,
|
||||
fontSizeValue: TextUnit,
|
||||
fontSizeRange: FontSizeRange,
|
||||
onFontSizeChange: (Float) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
ActionBaseButton(
|
||||
config = config,
|
||||
shape = RoundedCornerShape(size = TangemTheme.dimens.radius12),
|
||||
content = { contentModifier ->
|
||||
ActionButtonContent(
|
||||
config = config,
|
||||
text = { color ->
|
||||
ResizableText(
|
||||
text = config.text.resolveReference(),
|
||||
fontSizeValue = fontSizeValue,
|
||||
fontSizeRange = fontSizeRange,
|
||||
onFontSizeChange = onFontSizeChange,
|
||||
color = color,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
maxLines = 1,
|
||||
style = TangemTheme.typography.button,
|
||||
)
|
||||
},
|
||||
modifier = contentModifier.padding(horizontal = 4.dp),
|
||||
paddingBetweenIconAndText = 4.dp,
|
||||
)
|
||||
},
|
||||
modifier = modifier,
|
||||
color = TangemTheme.colors.button.secondary,
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue