Updated on 2026-08-14

This commit is contained in:
Tangem 2026-07-21 14:14:24 +02:00
parent 3e900b5d5b
commit 33efe2ae52
12 changed files with 56 additions and 101 deletions

View file

@ -323,7 +323,9 @@ fun BoxScope.FooterOverlay(
.fillMaxWidth()
.align(Alignment.BottomCenter),
) {
if (gradientHeight > 0.dp) {
val isGradientDisplayed = gradientHeight > 0.dp
if (isGradientDisplayed) {
Fade(
backgroundColor = fadeMax,
height = gradientHeight,
@ -333,7 +335,7 @@ fun BoxScope.FooterOverlay(
modifier = Modifier
.fillMaxWidth()
.height(measuredFooterHeight ?: 0.dp)
.background(fadeMax),
.background(if (isGradientDisplayed) fadeMax else Color.Transparent),
)
}
}

View file

@ -21,7 +21,6 @@ import androidx.compose.ui.graphics.vector.rememberVectorPainter
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.tangem.core.ui.R
import com.tangem.core.ui.components.*
@ -39,9 +38,6 @@ import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.core.ui.utils.WindowInsetsZero
import com.tangem.core.ui.utils.toPx
/** Default reserved height for the [TangemModalBottomSheetWithFooter] footer slot. */
val DEFAULT_FOOTER_HEIGHT: Dp = 80.dp
/**
* Modal bottom sheet with [content], [footer] and optional [title].
*
@ -54,12 +50,6 @@ inline fun <reified T : TangemBottomSheetConfigContent> TangemModalBottomSheetWi
config: TangemBottomSheetConfig,
containerColor: Color = TangemTheme.colors.background.primary,
skipPartiallyExpanded: Boolean = true,
// FIXME([REDACTED_TASK_KEY]): temp workaround
// The footer slot reserves a fixed [DEFAULT_FOOTER_HEIGHT];
// callers whose footer differs must pass the real height explicitly. Exposed as an opt-in
// parameter so existing usages keep the previous behavior and nothing else is affected.
// Rework so the sheet measures the actual footer height internally and drops this parameter.
footerHeight: Dp = DEFAULT_FOOTER_HEIGHT,
noinline onBack: (() -> Unit)? = null,
crossinline title: @Composable BoxScope.(T) -> Unit = {},
crossinline content: @Composable (T) -> Unit,
@ -75,7 +65,6 @@ inline fun <reified T : TangemBottomSheetConfigContent> TangemModalBottomSheetWi
content = content,
footer = footer,
skipPartiallyExpanded = skipPartiallyExpanded,
footerHeight = footerHeight,
)
} else {
DefaultModalBottomSheetWithFooter<T>(
@ -86,7 +75,6 @@ inline fun <reified T : TangemBottomSheetConfigContent> TangemModalBottomSheetWi
footer = footer,
onBack = onBack,
skipPartiallyExpanded = skipPartiallyExpanded,
footerHeight = footerHeight,
)
}
}
@ -97,7 +85,6 @@ inline fun <reified T : TangemBottomSheetConfigContent> DefaultModalBottomSheetW
config: TangemBottomSheetConfig,
containerColor: Color,
skipPartiallyExpanded: Boolean = true,
footerHeight: Dp = DEFAULT_FOOTER_HEIGHT,
noinline onBack: (() -> Unit)? = null,
crossinline title: @Composable BoxScope.(T) -> Unit,
crossinline content: @Composable (T) -> Unit,
@ -130,7 +117,6 @@ inline fun <reified T : TangemBottomSheetConfigContent> DefaultModalBottomSheetW
onBack = onBack,
content = content,
footer = footer,
footerHeight = footerHeight,
)
}
@ -149,7 +135,6 @@ inline fun <reified T : TangemBottomSheetConfigContent> PreviewModalBottomSheetW
config: TangemBottomSheetConfig,
containerColor: Color,
skipPartiallyExpanded: Boolean = true,
footerHeight: Dp = DEFAULT_FOOTER_HEIGHT,
crossinline title: @Composable BoxScope.(T) -> Unit,
crossinline content: @Composable (T) -> Unit,
noinline footer: @Composable (BoxScope.(T) -> Unit)?,
@ -165,7 +150,6 @@ inline fun <reified T : TangemBottomSheetConfigContent> PreviewModalBottomSheetW
title = title,
content = content,
footer = footer,
footerHeight = footerHeight,
)
}
@ -177,7 +161,6 @@ inline fun <reified T : TangemBottomSheetConfigContent> BasicModalBottomSheetWit
sheetState: TangemSheetState,
containerColor: Color,
modifier: Modifier = Modifier,
footerHeight: Dp = DEFAULT_FOOTER_HEIGHT,
noinline onBack: (() -> Unit)? = null,
crossinline title: @Composable BoxScope.(T) -> Unit,
crossinline content: @Composable (T) -> Unit,
@ -195,8 +178,7 @@ inline fun <reified T : TangemBottomSheetConfigContent> BasicModalBottomSheetWit
val isKeyboardOpen by rememberIsKeyboardVisible()
val buttonHeight by animateDpAsState(
targetValue = if (footer != null) footerHeight else 0.dp,
label = "FooterHeight",
targetValue = if (footer != null) 80.dp else 0.dp,
)
// Offset calculation for keyboard scroll adjustment:
// 1) Button height (footer)