https://kotlinlang.org logo
#compose-wear
Title
# compose-wear
b

bod

03/29/2024, 6:46 PM
Do we have an example somewhere of a app with a pager whose pages are lists? And so the timeText should probably disappear when scrolling on the lists, but re-appear when switching pages? (And same for the horizontal page indicator, I suppose).
y

yschimke

03/29/2024, 6:50 PM
I think Horologist has one. I can dig one out later. AppScaffold, ScreenScaffold and PagerScaffold are designed for this case.
b

bod

03/29/2024, 6:53 PM
Ah that's great news!
y

yschimke

03/29/2024, 8:03 PM
Nope, not exactly. But something like
Copy code
@Composable
fun SamplePagerScreen(swipeToDismissBoxState: SwipeToDismissBoxState) {
    PagerScreen(
        modifier = Modifier.edgeSwipeToDismiss(swipeToDismissBoxState),
        state = rememberPagerState {
            10
        },
    ) {
        PagerItemScreen(item = it)
    }
}

@Composable
internal fun PagerItemScreen(
    item: Int,
) {
    val columnState = rememberResponsiveColumnState(
        contentPadding = ScalingLazyColumnDefaults.padding(
            first = ScalingLazyColumnDefaults.ItemType.Text,
            last = ScalingLazyColumnDefaults.ItemType.Chip
        )
    )
    ScreenScaffold(scrollState = columnState) {
        ScalingLazyColumn(columnState = columnState) {
            item {
                ResponsiveListHeader(
                    contentPadding = firstItemPadding(),
                ) {
                    Text(text = "Page $item")
                }
            }
            items(10) {
                Chip(label = "Chip $it", onClick = { /*TODO*/ })
            }
        }
    }
}
👀 1
This example assumes it's inside AppScaffold and SwipeDismissableNavHost.
b

bod

03/30/2024, 9:15 AM
Thanks a lot! I'll have a look at it today
YES it works 👍 Not sure if the page indicators should also move away though? (yes it's a conf app but not Confetti 😂)
y

yschimke

03/30/2024, 3:53 PM
I'll check about that on Tuesday.
🙏 1