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 ─────────────────────
|
// ── Scrollable body with bottom shadow indicator ─────────────────────
|
||||||
val scrollState = rememberScrollState()
|
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(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.then(
|
.drawWithContent {
|
||||||
if (showShadow) Modifier.drawWithContent {
|
|
||||||
drawContent()
|
drawContent()
|
||||||
// Thin shadow strip along the bottom edge
|
if (shadowAlpha > 0f) {
|
||||||
drawRect(
|
drawRect(
|
||||||
brush = Brush.verticalGradient(
|
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(),
|
startY = size.height - 24.dp.toPx(),
|
||||||
endY = size.height,
|
endY = size.height,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
} else Modifier
|
}
|
||||||
)
|
}
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|||||||
Reference in New Issue
Block a user