Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions sheaf/app/src/main/java/systems/lupine/sheaf/ui/SheafApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
23 changes: 20 additions & 3 deletions sheaf/app/src/main/java/systems/lupine/sheaf/ui/home/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) },
Expand All @@ -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)) }
}
}
}
Expand Down
Loading