Fix excessive bottom padding

This commit is contained in:
世界
2025-12-30 17:39:47 +08:00
parent 81720c4d6f
commit c3478efc3c
3 changed files with 19 additions and 9 deletions

View File

@@ -37,10 +37,16 @@ fun SFANavHost(
if (dashboardViewModel != null) { if (dashboardViewModel != null) {
DashboardScreen( DashboardScreen(
serviceStatus = serviceStatus, serviceStatus = serviceStatus,
showStartFab = showStartFab,
showStatusBar = showStatusBar,
viewModel = dashboardViewModel, viewModel = dashboardViewModel,
) )
} else { } else {
DashboardScreen(serviceStatus = serviceStatus) DashboardScreen(
serviceStatus = serviceStatus,
showStartFab = showStartFab,
showStatusBar = showStatusBar,
)
} }
} }

View File

@@ -41,6 +41,8 @@ data class CardRenderItem(
@Composable @Composable
fun DashboardScreen( fun DashboardScreen(
serviceStatus: Status = Status.Stopped, serviceStatus: Status = Status.Stopped,
showStartFab: Boolean = false,
showStatusBar: Boolean = false,
viewModel: DashboardViewModel = viewModel(), viewModel: DashboardViewModel = viewModel(),
) { ) {
val uiState by viewModel.uiState.collectAsState() val uiState by viewModel.uiState.collectAsState()
@@ -105,16 +107,18 @@ fun DashboardScreen(
Box( Box(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
) { ) {
val bottomPadding = when {
showStartFab -> 88.dp
showStatusBar -> 74.dp
else -> 0.dp
}
LazyColumn( LazyColumn(
modifier = modifier =
Modifier Modifier
.fillMaxSize() .fillMaxSize()
.padding(horizontal = 16.dp), .padding(horizontal = 16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp), verticalArrangement = Arrangement.spacedBy(16.dp),
contentPadding = contentPadding = PaddingValues(bottom = bottomPadding),
PaddingValues(
bottom = 88.dp, // Increased to accommodate FAB (56dp height + 32dp padding)
),
) { ) {
// Dynamic dashboard cards // Dynamic dashboard cards
// Show cards when service is running OR if it's the Profiles card (always available) // Show cards when service is running OR if it's the Profiles card (always available)

View File

@@ -372,9 +372,9 @@ fun LogScreen(
} }
} else { } else {
// Log list // Log list
val extraBottomPadding = when { val bottomPadding = when {
showStartFab -> 72.dp showStartFab -> 88.dp
showStatusBar -> 58.dp showStatusBar -> 74.dp
else -> 0.dp else -> 0.dp
} }
LazyColumn( LazyColumn(
@@ -385,7 +385,7 @@ fun LogScreen(
start = 8.dp, start = 8.dp,
end = 8.dp, end = 8.dp,
top = 8.dp, top = 8.dp,
bottom = 88.dp + extraBottomPadding, // Space for FAB bottom = bottomPadding,
), ),
verticalArrangement = Arrangement.spacedBy(2.dp), verticalArrangement = Arrangement.spacedBy(2.dp),
) { ) {