feat: refactor ListDetailScreen layout for improved header and content alignment; enhance empty state messaging
This commit is contained in:
+12
-11
@@ -495,17 +495,11 @@ fun ListDetailScreen(
|
|||||||
pendingScrollToBottom = false
|
pendingScrollToBottom = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Column(
|
// Header: horizontally scrollable across the table width
|
||||||
modifier =
|
|
||||||
Modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.horizontalScroll(horizontalScrollState),
|
|
||||||
) {
|
|
||||||
// Fixed header (always visible even with zero items)
|
|
||||||
Row(
|
Row(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxWidth()
|
.horizontalScroll(horizontalScrollState)
|
||||||
.background(MaterialTheme.colorScheme.surface),
|
.background(MaterialTheme.colorScheme.surface),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
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 {
|
when {
|
||||||
isLoading && stableItems.isEmpty() -> {
|
isLoading && stableItems.isEmpty() -> {
|
||||||
Box(
|
Box(
|
||||||
@@ -546,9 +540,9 @@ fun ListDetailScreen(
|
|||||||
) { androidx.compose.material3.CircularProgressIndicator() }
|
) { androidx.compose.material3.CircularProgressIndicator() }
|
||||||
}
|
}
|
||||||
stableItems.isEmpty() -> {
|
stableItems.isEmpty() -> {
|
||||||
// Use full-width Box + centered text (header remains above inside scroll container)
|
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier
|
||||||
|
.fillMaxSize(),
|
||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
@@ -582,6 +576,13 @@ fun ListDetailScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
|
// Content list in a horizontally scrollable container to stay aligned with header
|
||||||
|
Column(
|
||||||
|
modifier =
|
||||||
|
Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.horizontalScroll(horizontalScrollState),
|
||||||
|
) {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
state = listState,
|
state = listState,
|
||||||
|
|||||||
Reference in New Issue
Block a user