ImportScreen: shadow fades out over last 80px of scroll
shadowAlpha = (remaining / 80).coerceIn(0,1) — full strength when far from bottom, smoothly fades to zero over the last 80px.
This commit is contained in:
@@ -48,24 +48,32 @@ fun ImportScreen(state: AppState) {
|
||||
|
||||
// ── Scrollable body with bottom shadow indicator ─────────────────────
|
||||
val scrollState = rememberScrollState()
|
||||
val showShadow by remember { derivedStateOf { scrollState.value < scrollState.maxValue } }
|
||||
// shadowAlpha: 1.0 when far from bottom, fades to 0.0 over the last 80px
|
||||
val shadowAlpha by remember {
|
||||
derivedStateOf {
|
||||
val remaining = scrollState.maxValue - scrollState.value
|
||||
(remaining / 80f).coerceIn(0f, 1f)
|
||||
}
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.then(
|
||||
if (showShadow) Modifier.drawWithContent {
|
||||
.drawWithContent {
|
||||
drawContent()
|
||||
// Thin shadow strip along the bottom edge
|
||||
if (shadowAlpha > 0f) {
|
||||
drawRect(
|
||||
brush = Brush.verticalGradient(
|
||||
colors = listOf(Color.Transparent, Color.Black.copy(alpha = 0.10f)),
|
||||
colors = listOf(
|
||||
Color.Transparent,
|
||||
Color.Black.copy(alpha = 0.10f * shadowAlpha),
|
||||
),
|
||||
startY = size.height - 24.dp.toPx(),
|
||||
endY = size.height,
|
||||
)
|
||||
)
|
||||
} else Modifier
|
||||
)
|
||||
}
|
||||
}
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
|
||||
Reference in New Issue
Block a user