Updated on 2026-08-14

This commit is contained in:
Tangem 2026-07-09 14:16:32 +02:00
parent ae9eb162f6
commit 27d1bf4b9e
21 changed files with 291 additions and 264 deletions

View file

@ -32,7 +32,15 @@ import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.core.ui.res.TangemThemePreviewRedesign
enum class AccountIconSize {
Default, Large, Medium, Small, ExtraSmall, RedesignedDefault, RedesignExtraSmall, RedesignLarge, Contact
Default,
Large,
Medium,
Small,
ExtraSmall,
RedesignedDefault,
RedesignExtraSmall,
ContactLarge,
ContactDefault,
}
/**
@ -132,8 +140,8 @@ fun AccountCharIcon(char: Char, color: Color, size: AccountIconSize, modifier: M
AccountIconSize.ExtraSmall -> TangemTheme.typography.caption1
AccountIconSize.RedesignedDefault -> TangemTheme.typography2.headingSemibold28
AccountIconSize.RedesignExtraSmall -> TangemTheme.typography2.captionMedium11
AccountIconSize.RedesignLarge -> TangemTheme.typography3.heading.medium
AccountIconSize.Contact -> TangemTheme.typography3.body.medium
AccountIconSize.ContactLarge -> TangemTheme.typography3.heading.medium
AccountIconSize.ContactDefault -> TangemTheme.typography3.body.medium
}
val textSize by animateFloatAsState(
@ -168,8 +176,8 @@ private fun AccountIconSize.iconSizeInDp(): Dp = when (this) {
AccountIconSize.ExtraSmall -> 8.dp
AccountIconSize.RedesignedDefault -> 20.dp
AccountIconSize.RedesignExtraSmall -> 8.dp
AccountIconSize.RedesignLarge -> 32.dp
AccountIconSize.Contact -> 20.dp
AccountIconSize.ContactLarge -> 32.dp
AccountIconSize.ContactDefault -> 20.dp
}
fun AccountIconSize.toBoxSize(): Dp = when (this) {
@ -180,8 +188,8 @@ fun AccountIconSize.toBoxSize(): Dp = when (this) {
AccountIconSize.ExtraSmall -> 14.dp
AccountIconSize.RedesignedDefault -> 40.dp
AccountIconSize.RedesignExtraSmall -> 16.dp
AccountIconSize.RedesignLarge -> 80.dp
AccountIconSize.Contact -> 40.dp
AccountIconSize.ContactLarge -> 80.dp
AccountIconSize.ContactDefault -> 40.dp
}
private fun AccountIconSize.boxShapeSizeInDp(): Dp = when (this) {
@ -192,8 +200,8 @@ private fun AccountIconSize.boxShapeSizeInDp(): Dp = when (this) {
AccountIconSize.ExtraSmall -> 4.dp
AccountIconSize.RedesignedDefault -> 12.dp
AccountIconSize.RedesignExtraSmall -> 6.dp
AccountIconSize.RedesignLarge -> 80.dp
AccountIconSize.Contact -> 100.dp
AccountIconSize.ContactLarge -> 80.dp
AccountIconSize.ContactDefault -> 100.dp
}
@Preview(showBackground = true)
@ -236,9 +244,9 @@ private fun Sample() {
AccountIconSize.Small -> AccountIconSize.ExtraSmall
AccountIconSize.ExtraSmall -> AccountIconSize.RedesignedDefault
AccountIconSize.RedesignedDefault -> AccountIconSize.RedesignExtraSmall
AccountIconSize.RedesignExtraSmall -> AccountIconSize.RedesignLarge
AccountIconSize.RedesignLarge -> AccountIconSize.Contact
AccountIconSize.Contact -> AccountIconSize.Default
AccountIconSize.RedesignExtraSmall -> AccountIconSize.ContactLarge
AccountIconSize.ContactLarge -> AccountIconSize.ContactDefault
AccountIconSize.ContactDefault -> AccountIconSize.Default
}
}) { Text("Change") }

View file

@ -36,12 +36,10 @@ import com.tangem.core.ui.components.bottomsheets.sheet.TangemBottomSheetDraggab
import com.tangem.core.ui.components.sheetscaffold.TangemSheetState
import com.tangem.core.ui.components.sheetscaffold.TangemSheetValue
import com.tangem.core.ui.components.sheetscaffold.rememberSheetState
import com.tangem.core.ui.res.LocalBottomSheetAlwaysVisible
import com.tangem.core.ui.res.LocalWindowSize
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreviewRedesign
import com.tangem.core.ui.res.*
import com.tangem.core.ui.test.BaseBottomSheetTestTags
import com.tangem.core.ui.utils.WindowInsetsZero
import dev.chrisbanes.haze.rememberHazeState
/**
* Extra bottom inset that scrollable content under a [BasicBottomSheet] should reserve so it
@ -235,46 +233,48 @@ inline fun <reified T : TangemBottomSheetConfigContent> BasicBottomSheet(
}
val bsContent: @Composable ColumnScope.() -> Unit = {
val contentModifier = when (type) {
Default -> Modifier
.clip(
RoundedCornerShape(
topStart = TangemTheme.dimens2.x8,
topEnd = TangemTheme.dimens2.x8,
),
)
Modal -> Modifier
.padding(
start = TangemTheme.dimens2.x2,
end = TangemTheme.dimens2.x2,
bottom = bottomBarHeight,
)
.clip(RoundedCornerShape(TangemTheme.dimens2.x8))
}
Column(
modifier = contentModifier
.background(containerColor)
.heightIn(max = maxHeight)
.testTag(BaseBottomSheetTestTags.CONTAINER),
) {
Box(modifier = Modifier.fillMaxWidth()) {
title(model)
}
Box(modifier = Modifier.fillMaxWidth()) {
if (footer != null) {
FooterOverlay(
measuredFooterHeight = footerHeightDp,
onMeasureFooter = { newHeight ->
if (newHeight != footerHeightDp) {
footerHeightDp = newHeight
}
},
footer = { footer(model) },
content = { content(model) },
CompositionLocalProvider(LocalHazeState provides rememberHazeState()) {
val contentModifier = when (type) {
Default -> Modifier
.clip(
RoundedCornerShape(
topStart = TangemTheme.dimens2.x8,
topEnd = TangemTheme.dimens2.x8,
),
)
} else {
content(model)
Modal -> Modifier
.padding(
start = TangemTheme.dimens2.x2,
end = TangemTheme.dimens2.x2,
bottom = bottomBarHeight,
)
.clip(RoundedCornerShape(TangemTheme.dimens2.x8))
}
Column(
modifier = contentModifier
.background(containerColor)
.heightIn(max = maxHeight)
.testTag(BaseBottomSheetTestTags.CONTAINER),
) {
Box(modifier = Modifier.fillMaxWidth()) {
title(model)
}
Box(modifier = Modifier.fillMaxWidth()) {
if (footer != null) {
FooterOverlay(
measuredFooterHeight = footerHeightDp,
onMeasureFooter = { newHeight ->
if (newHeight != footerHeightDp) {
footerHeightDp = newHeight
}
},
footer = { footer(model) },
content = { content(model) },
)
} else {
content(model)
}
}
}
}