Stanislav Pestov
08/20/2021, 9:54 AMPager
without parent measuring with BoxWithConstraints/SubcomposeLayout?Stanislav Pestov
08/20/2021, 9:54 AMHorizontalPager(
modifier = modifier.fillMaxWidth(),
itemSpacing = 8.dp,
state = pagerState,
) { pageIndex ->
BoxWithConstraints {
MyItem(
modifier = Modifier.width(maxWidth - 32.dp),
)
}
}
Zach Klippenstein (he/him) [MOD]
08/20/2021, 10:11 AMPager
component, but that looks like you’re re-implementing the padding
modifier using subcomposition, which is a bad idea for a host of reasons. Why not just use a proper layout modifier?cb
08/20/2021, 10:45 AMLayoutModifier
which does this without subcomposition. Its basically a fillMaxWidth(minus = 32.dp)
cb
08/20/2021, 11:01 AMfillMaxWidth(0.9f)
, but that obviously won’t always be 32dpStanislav Pestov
08/20/2021, 11:03 AMColton Idle
08/20/2021, 6:25 PMStanislav Pestov
08/23/2021, 10:10 AMModifier.fillMaxWidth(offset: Dp)
Colton Idle
08/23/2021, 2:39 PM