fix: remove AnimatedVisibility from chat bubbles to fix LazyColumn scroll limit

AnimatedVisibility with visible=false starts items at zero height. Inside a
reverseLayout LazyColumn, this causes the list to miscompute total content
height, preventing items beyond the visible viewport from being composed.
This was limiting the chat to ~9 visible messages that filled the screen.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 12:43:57 +08:00
parent 7fcf562648
commit e65a35a239
@@ -1,8 +1,5 @@
package top.yeij.cyrene.ui.screens.chat package top.yeij.cyrene.ui.screens.chat
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn
import androidx.compose.animation.slideInVertically
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.detectDragGesturesAfterLongPress import androidx.compose.foundation.gestures.detectDragGesturesAfterLongPress
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
@@ -67,25 +64,12 @@ import top.yeij.cyrene.ui.components.TypingIndicator
import top.yeij.cyrene.util.RecordState import top.yeij.cyrene.util.RecordState
import top.yeij.cyrene.viewmodel.ChatViewModel import top.yeij.cyrene.viewmodel.ChatViewModel
import top.yeij.cyrene.viewmodel.SettingsViewModel import top.yeij.cyrene.viewmodel.SettingsViewModel
import kotlin.math.min
@Composable @Composable
private fun AnimatedChatBubble( private fun AnimatedChatBubble(
message: Message, message: Message,
animIndex: Int, animIndex: Int,
) {
var visible by remember { mutableStateOf(false) }
LaunchedEffect(Unit) {
delay(min(animIndex, 10) * 60L)
visible = true
}
AnimatedVisibility(
visible = visible,
enter = fadeIn(animationSpec = androidx.compose.animation.core.tween(300)) +
slideInVertically(
animationSpec = androidx.compose.animation.core.tween(300),
initialOffsetY = { it / 4 },
),
) { ) {
ChatBubble( ChatBubble(
content = message.content, content = message.content,
@@ -94,7 +78,6 @@ private fun AnimatedChatBubble(
timestamp = message.timestamp, timestamp = message.timestamp,
) )
} }
}
@Composable @Composable
fun ChatScreen( fun ChatScreen(