fix(ui): shift year view grid upwards to make room for bottom FAB

This commit is contained in:
xfy 2026-07-24 13:20:08 +08:00
parent 13360029e1
commit 0703be68b4
2 changed files with 4 additions and 11 deletions

View File

@ -25,7 +25,6 @@ import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.FastOutSlowInEasing import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.LinearOutSlowInEasing import androidx.compose.animation.core.LinearOutSlowInEasing
import androidx.compose.animation.core.Spring import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.spring import androidx.compose.animation.core.spring
import androidx.compose.animation.core.tween import androidx.compose.animation.core.tween
@ -413,18 +412,12 @@ fun CalendarMonthView(
) )
} }
// FAB 浮动按钮(年视图下自动上移 110.dp 避免遮挡 10 月网格) // FAB 浮动按钮
val fabBottomPadding by animateDpAsState(
targetValue = if (isYearView) 110.dp else 32.dp,
animationSpec = spring(stiffness = Spring.StiffnessMediumLow, dampingRatio = Spring.DampingRatioNoBouncy),
label = "fab_bottom_padding"
)
FloatingActionButton( FloatingActionButton(
onClick = { isMenuExpanded = !isMenuExpanded }, onClick = { isMenuExpanded = !isMenuExpanded },
modifier = Modifier modifier = Modifier
.align(Alignment.BottomStart) .align(Alignment.BottomStart)
.padding(start = 24.dp, bottom = fabBottomPadding) .padding(start = 24.dp, bottom = 32.dp)
.testTag("fab_menu"), .testTag("fab_menu"),
shape = CircleShape, shape = CircleShape,
containerColor = MaterialTheme.colorScheme.primaryContainer, containerColor = MaterialTheme.colorScheme.primaryContainer,
@ -472,7 +465,7 @@ fun CalendarMonthView(
) + fadeOut(tween(120)), ) + fadeOut(tween(120)),
modifier = Modifier modifier = Modifier
.align(Alignment.BottomStart) .align(Alignment.BottomStart)
.padding(start = 24.dp, bottom = fabBottomPadding + 56.dp + 8.dp) .padding(start = 24.dp, bottom = 32.dp + 56.dp + 8.dp)
) { ) {
Card( Card(
shape = RoundedCornerShape(16.dp), shape = RoundedCornerShape(16.dp),

View File

@ -171,7 +171,7 @@ fun YearGridView(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.weight(1f) .weight(1f)
.padding(horizontal = 4.dp), .padding(start = 4.dp, end = 4.dp, bottom = 44.dp),
verticalArrangement = Arrangement.SpaceEvenly verticalArrangement = Arrangement.SpaceEvenly
) { ) {
(0 until gridRows).forEach { row -> (0 until gridRows).forEach { row ->