Always scroll rows w/ overview to top

This commit is contained in:
Damontecres 2025-10-28 21:47:46 -04:00
parent d578dca0cf
commit 5682f61b02
No known key found for this signature in database

View file

@ -13,6 +13,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@ -152,11 +153,15 @@ fun HomePageContent(
}
var focusedItem = position.let { homeRows.getOrNull(it.row)?.items?.getOrNull(it.column) }
val listState = rememberLazyListState()
val focusRequester = remember { FocusRequester() }
val positionFocusRequester = remember { FocusRequester() }
LaunchedEffect(Unit) {
positionFocusRequester.tryRequestFocus()
}
LaunchedEffect(position) {
listState.animateScrollToItem(position.row)
}
Box(modifier = modifier) {
if (focusedItem?.backdropImageUrl.isNotNullOrBlank()) {
val gradientColor = MaterialTheme.colorScheme.background
@ -200,13 +205,14 @@ fun HomePageContent(
.padding(16.dp),
)
LazyColumn(
state = listState,
verticalArrangement = Arrangement.spacedBy(8.dp),
contentPadding =
PaddingValues(
start = 16.dp,
end = 16.dp,
top = 0.dp,
bottom = 48.dp,
bottom = Cards.height2x3,
),
modifier = Modifier,
) {