feat: refactor ListDetailScreen layout for improved header and content alignment; enhance empty state messaging

This commit is contained in:
2025-11-13 18:17:13 +01:00
parent a8c7b859a8
commit d7f10c8887
@@ -495,17 +495,11 @@ fun ListDetailScreen(
pendingScrollToBottom = false
}
}
Column(
modifier =
Modifier
.fillMaxSize()
.horizontalScroll(horizontalScrollState),
) {
// Fixed header (always visible even with zero items)
// Header: horizontally scrollable across the table width
Row(
modifier =
Modifier
.fillMaxWidth()
.horizontalScroll(horizontalScrollState)
.background(MaterialTheme.colorScheme.surface),
verticalAlignment = Alignment.CenterVertically,
) {
@@ -537,7 +531,7 @@ fun ListDetailScreen(
}
}
// Render content states outside the horizontalScroll so empty state centers relative to viewport
// Content area: if empty, center message; else render horizontally scrollable rows
when {
isLoading && stableItems.isEmpty() -> {
Box(
@@ -546,9 +540,9 @@ fun ListDetailScreen(
) { androidx.compose.material3.CircularProgressIndicator() }
}
stableItems.isEmpty() -> {
// Use full-width Box + centered text (header remains above inside scroll container)
Box(
modifier = Modifier.fillMaxSize(),
modifier = Modifier
.fillMaxSize(),
contentAlignment = Alignment.Center,
) {
Text(
@@ -582,6 +576,13 @@ fun ListDetailScreen(
}
}
else -> {
// Content list in a horizontally scrollable container to stay aligned with header
Column(
modifier =
Modifier
.fillMaxSize()
.horizontalScroll(horizontalScrollState),
) {
LazyColumn(
modifier = Modifier.fillMaxSize(),
state = listState,