neumorphic-compose
neumorphic-compose copied to clipboard
Using it in Pager causes the slide to lag, I don't understand what's happening
Hi! I'm using it in Pager and it causes sliding jams, I don't understand what's happening
Hi, Could you please share a video or your code snippet reproducing the issue? It would help to understand me better Thanks.
A simple example I wrote, here is the code
@OptIn(ExperimentalPagerApi::class)
@Composable
fun GuideScreen() {
Column {
val pagerState = rememberPagerState()
HorizontalPager(
count = 6,
state = pagerState,
modifier = Modifier.fillMaxHeight(),
) { page ->
ExamplePage(page)
}
}
}
@Composable
fun ExamplePage(currentPage: Int) {
Card(
elevation = 0.dp,
shape = RoundedCornerShape(20.dp),
backgroundColor = MaterialTheme.colors.backgroundColor,
modifier = Modifier
.padding(horizontal = 20.dp, vertical = 28.dp)
.neumorphic(neuShape = Punched.Rounded(20.dp))
) {
Box(contentAlignment = Alignment.Center) {
Image(
painter = painterResource(id = R.drawable.ic_launcher_foreground),
contentDescription = "",
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
.padding(5.dp)
.clip(
RoundedCornerShape(20.dp)
),
contentScale = ContentScale.FillWidth
)
Text(
text = "Page $currentPage",
fontSize = 40.sp,
textAlign = TextAlign.Center,
)
}
}
}
Here is the actual effect link
I used this library Pager Layout @CuriousNikhil
@hurist, Thanks for sharing. I'll take a look. Meanwhile, if you figure it out, I would be happy to appreciate PR.