Исправил прыжки списка чатов при пустых запросах

This commit is contained in:
2026-03-19 16:35:41 +05:00
parent 09df7586e7
commit 4d4130fefd

View File

@@ -1792,6 +1792,11 @@ fun ChatsListScreen(
val requestsCount = chatsState.requestsCount val requestsCount = chatsState.requestsCount
val showSkeleton = isLoading val showSkeleton = isLoading
val chatListState = rememberLazyListState()
var isRequestsVisible by remember { mutableStateOf(true) }
var lastAutoScrolledVerificationId by remember {
mutableStateOf<String?>(null)
}
AnimatedContent( AnimatedContent(
targetState = showDownloadsScreen, targetState = showDownloadsScreen,
@@ -2057,11 +2062,6 @@ fun ChatsListScreen(
} }
// Track scroll direction to hide/show Requests // Track scroll direction to hide/show Requests
val chatListState = rememberLazyListState()
var isRequestsVisible by remember { mutableStateOf(true) }
var lastAutoScrolledVerificationId by remember {
mutableStateOf<String?>(null)
}
val hapticFeedback = LocalHapticFeedback.current val hapticFeedback = LocalHapticFeedback.current
// When a new device confirmation banner appears at the top, // When a new device confirmation banner appears at the top,
@@ -2163,13 +2163,11 @@ fun ChatsListScreen(
} }
} }
item(key = "requests_section") { if (requestsCount > 0) {
val isRequestsSectionVisible = item(key = "requests_section") {
requestsCount > 0 && AnimatedVisibility(
isRequestsVisible visible =
AnimatedVisibility( isRequestsVisible,
visible =
isRequestsSectionVisible,
enter = enter =
slideInVertically( slideInVertically(
initialOffsetY = { initialOffsetY = {
@@ -2238,27 +2236,28 @@ fun ChatsListScreen(
tween( tween(
durationMillis = durationMillis =
140 140
) )
) )
) { ) {
Column { Column {
RequestsSection( RequestsSection(
count = count =
requestsCount, requestsCount,
requests = requests =
requests, requests,
isDarkTheme = isDarkTheme =
isDarkTheme, isDarkTheme,
onClick = { onClick = {
openRequestsRouteSafely() openRequestsRouteSafely()
} }
) )
Divider( Divider(
color = color =
dividerColor, dividerColor,
thickness = thickness =
0.5.dp 0.5.dp
) )
}
} }
} }
} }