Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Update to Compose 2023.10.01 #940

Merged
merged 2 commits into from
Dec 20, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ enum class SunflowerPage(
fun HomeScreen(
modifier: Modifier = Modifier,
onPlantClick: (Plant) -> Unit = {},
viewModel: PlantListViewModel = hiltViewModel()
viewModel: PlantListViewModel = hiltViewModel(),
pages: Array<SunflowerPage> = SunflowerPage.values()
) {
val pagerState = rememberPagerState()
val pagerState = rememberPagerState(pageCount = { pages.size })
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior()

Scaffold(
Expand All @@ -89,6 +90,7 @@ fun HomeScreen(
HomePagerScreen(
onPlantClick = onPlantClick,
pagerState = pagerState,
pages = pages,
Modifier.padding(top = contentPadding.calculateTopPadding())
)
}
Expand All @@ -99,8 +101,8 @@ fun HomeScreen(
fun HomePagerScreen(
onPlantClick: (Plant) -> Unit,
pagerState: PagerState,
pages: Array<SunflowerPage>,
modifier: Modifier = Modifier,
pages: Array<SunflowerPage> = SunflowerPage.values()
) {
Column(modifier) {
val coroutineScope = rememberCoroutineScope()
Expand Down Expand Up @@ -129,7 +131,6 @@ fun HomePagerScreen(
// Pages
HorizontalPager(
modifier = Modifier.background(MaterialTheme.colorScheme.background),
pageCount = pages.size,
state = pagerState,
verticalAlignment = Alignment.Top
) { index ->
Expand Down Expand Up @@ -200,9 +201,11 @@ private fun HomeTopAppBar(
@Composable
private fun HomeScreenPreview() {
SunflowerTheme {
val pages = SunflowerPage.values()
HomePagerScreen(
onPlantClick = {},
pagerState = PagerState(),
pagerState = rememberPagerState(pageCount = { pages.size }),
pages = pages
)
}
}
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ androidGradlePlugin = "8.1.2"
benchmark = "1.1.0"
# @keep
compileSdk = "34"
composeLatest = "1.4.0-alpha03"
composeBom = "2023.06.01"
composeLatest = "1.6.0-beta03"
composeBom = "2023.10.01"
compose-compiler = "1.5.3"
constraintLayoutCompose = "1.0.1"
coreTesting = "2.2.0"
Expand Down