diff --git a/sheaf/app/src/main/java/systems/lupine/sheaf/ui/SheafApp.kt b/sheaf/app/src/main/java/systems/lupine/sheaf/ui/SheafApp.kt index 2dc0ae2..c72e3c0 100644 --- a/sheaf/app/src/main/java/systems/lupine/sheaf/ui/SheafApp.kt +++ b/sheaf/app/src/main/java/systems/lupine/sheaf/ui/SheafApp.kt @@ -154,8 +154,10 @@ data class TopLevelDest( private val MAX_CONTENT_WIDTH = 840.dp // Destinations that should use the full window width rather than the capped -// content pane (a pan/zoom canvas wants all the room it can get). -private val FULL_BLEED_ROUTES = setOf(Routes.RELATIONSHIP_GRAPH) +// content pane: the pan/zoom graph canvas wants all the room it can get, and +// Home lays its fronting cards out in a grid that flows more columns the wider +// it gets (so capping it would just cost columns). +private val FULL_BLEED_ROUTES = setOf(Routes.RELATIONSHIP_GRAPH, Routes.HOME) val topLevelDestinations = listOf( TopLevelDest(Routes.HOME, "Home", Icons.Filled.Home, Icons.Outlined.Home), diff --git a/sheaf/app/src/main/java/systems/lupine/sheaf/ui/home/HomeScreen.kt b/sheaf/app/src/main/java/systems/lupine/sheaf/ui/home/HomeScreen.kt index d0a1a88..88b0a74 100644 --- a/sheaf/app/src/main/java/systems/lupine/sheaf/ui/home/HomeScreen.kt +++ b/sheaf/app/src/main/java/systems/lupine/sheaf/ui/home/HomeScreen.kt @@ -7,6 +7,10 @@ import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.lazy.grid.GridCells +import androidx.compose.foundation.lazy.grid.GridItemSpan +import androidx.compose.foundation.lazy.grid.LazyVerticalGrid +import androidx.compose.foundation.lazy.grid.items import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.People @@ -227,12 +231,25 @@ fun HomeScreen( } } else -> { - LazyColumn( + // Adaptive grid: one column on phones, flowing to two or + // more as the window widens (tablet, landscape, unfolded), + // so the fronting cards fill the space instead of a lone + // centred column. Announcements and the trailing spacer + // span the full row. Home opts out of the app-wide content + // width cap (see FULL_BLEED_ROUTES) so the grid gets the + // whole width to lay columns across. + LazyVerticalGrid( + columns = GridCells.Adaptive(minSize = 340.dp), contentPadding = PaddingValues(horizontal = 16.dp, vertical = 12.dp), + horizontalArrangement = Arrangement.spacedBy(12.dp), verticalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier.fillMaxSize(), ) { - items(state.visibleAnnouncements, key = { "ann_${it.id}" }) { announcement -> + items( + state.visibleAnnouncements, + key = { "ann_${it.id}" }, + span = { GridItemSpan(maxLineSpan) }, + ) { announcement -> AnnouncementCard( announcement = announcement, onDismiss = { viewModel.dismissAnnouncement(announcement.id) }, @@ -249,7 +266,7 @@ fun HomeScreen( } // Spacer clears the FAB and the pinned quick-switch // bottomBar above the system nav. - item { Spacer(Modifier.height(80.dp)) } + item(span = { GridItemSpan(maxLineSpan) }) { Spacer(Modifier.height(80.dp)) } } } }