diff --git a/.gitignore b/.gitignore index 3b1708c..13e3093 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ .cxx local.properties /.idea/* +app/release/* diff --git a/app/src/main/java/com/aiosman/riderpro/ui/chat/ChatScreen.kt b/app/src/main/java/com/aiosman/riderpro/ui/chat/ChatScreen.kt index 918447e..d8be418 100644 --- a/app/src/main/java/com/aiosman/riderpro/ui/chat/ChatScreen.kt +++ b/app/src/main/java/com/aiosman/riderpro/ui/chat/ChatScreen.kt @@ -109,13 +109,11 @@ fun ChatScreen(userId: String) { } // 监听滚动状态,触发加载更多 LaunchedEffect(listState) { - snapshotFlow { listState.layoutInfo.visibleItemsInfo.firstOrNull()?.index } + snapshotFlow { listState.layoutInfo.visibleItemsInfo.lastOrNull()?.index } .collect { index -> - if (index != null && index < 10 && !isLoadingMore && viewModel.hasMore) { // 调整阈值为 10 - isLoadingMore = true + if (index == listState.layoutInfo.totalItemsCount - 1) { coroutineScope.launch { viewModel.onLoadMore(context) - isLoadingMore = false } } }