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:
@@ -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,33 +64,19 @@ 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,
|
||||||
role = message.role,
|
role = message.role,
|
||||||
msgType = message.msgType,
|
msgType = message.msgType,
|
||||||
timestamp = message.timestamp,
|
timestamp = message.timestamp,
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|||||||
Reference in New Issue
Block a user