feat: enhance swipe back functionality in OtherProfileScreen with pager state checks

This commit is contained in:
2026-02-14 01:24:43 +05:00
parent b1458b9cc7
commit 645d8913ac

View File

@@ -189,8 +189,10 @@ fun OtherProfileScreen(
} }
val screenHeightDp = LocalConfiguration.current.screenHeightDp.dp val screenHeightDp = LocalConfiguration.current.screenHeightDp.dp
val sharedPagerMinHeight = (screenHeightDp * 0.45f).coerceAtLeast(240.dp) val sharedPagerMinHeight = (screenHeightDp * 0.45f).coerceAtLeast(240.dp)
LaunchedEffect(showImageViewer) { val isPagerSwiping = pagerState.isScrollInProgress
onSwipeBackEnabledChanged(!showImageViewer) val isOnFirstPage = pagerState.currentPage == 0 && pagerState.currentPageOffsetFraction == 0f
LaunchedEffect(showImageViewer, isPagerSwiping, isOnFirstPage) {
onSwipeBackEnabledChanged(!showImageViewer && !isPagerSwiping && isOnFirstPage)
} }
val backgroundColor = if (isDarkTheme) Color(0xFF1A1A1A) else Color(0xFFFFFFFF) val backgroundColor = if (isDarkTheme) Color(0xFF1A1A1A) else Color(0xFFFFFFFF)
@@ -696,7 +698,7 @@ fun OtherProfileScreen(
modifier = Modifier.fillMaxWidth().heightIn(min = sharedPagerMinHeight), modifier = Modifier.fillMaxWidth().heightIn(min = sharedPagerMinHeight),
beyondBoundsPageCount = 0, beyondBoundsPageCount = 0,
verticalAlignment = Alignment.Top, verticalAlignment = Alignment.Top,
userScrollEnabled = false userScrollEnabled = true
) { page -> ) { page ->
Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.TopStart) { Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.TopStart) {
OtherProfileSharedTabContent( OtherProfileSharedTabContent(