diff --git a/watch/wearos/app/src/main/java/com/doctate/watch/presentation/CaseListScreen.kt b/watch/wearos/app/src/main/java/com/doctate/watch/presentation/CaseListScreen.kt index 7b30cf6..9cfa583 100644 --- a/watch/wearos/app/src/main/java/com/doctate/watch/presentation/CaseListScreen.kt +++ b/watch/wearos/app/src/main/java/com/doctate/watch/presentation/CaseListScreen.kt @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -40,6 +41,17 @@ fun CaseListScreen( val cases by CaseStoreStub.cases.collectAsStateWithLifecycle() val listState = rememberScalingLazyListState() + // Display oldest-first so the newest entry sits next to the `Neu` EdgeButton. + // Store invariant (lastActivityAt desc) stays untouched for Tile / Complication consumers. + val displayed = cases.asReversed() + + // Scroll to the newest entry (now at the bottom) once data is available. + LaunchedEffect(displayed.isNotEmpty()) { + if (displayed.isNotEmpty()) { + listState.scrollToItem(displayed.lastIndex) + } + } + ScreenScaffold( scrollState = listState, edgeButton = { @@ -47,8 +59,9 @@ fun CaseListScreen( Text("● Neu") } }, + edgeButtonSpacing = 4.dp, ) { contentPadding -> - if (cases.isEmpty()) { + if (displayed.isEmpty()) { EmptyState(onNewCase) } else { ScalingLazyColumn( @@ -58,7 +71,7 @@ fun CaseListScreen( verticalArrangement = Arrangement.spacedBy(4.dp, Alignment.CenterVertically), modifier = Modifier.fillMaxSize(), ) { - items(cases, key = { it.caseId }) { case -> + items(displayed, key = { it.caseId }) { case -> CaseRow(case, onTap = { onCaseTap(case.caseId) }) } }