fix: scroll to bottom appearing after send

This commit is contained in:
cogwheel0
2025-09-07 23:28:18 +05:30
parent 30f1650faf
commit bbb1f081d1

View File

@@ -925,6 +925,9 @@ class _ChatPageState extends ConsumerState<ChatPage> {
// Keyboard visibility // Keyboard visibility
final keyboardVisible = MediaQuery.of(context).viewInsets.bottom > 0; final keyboardVisible = MediaQuery.of(context).viewInsets.bottom > 0;
// Whether the messages list can actually scroll (avoids showing button when not needed)
final canScroll = _scrollController.hasClients &&
_scrollController.position.maxScrollExtent > 0;
// Auto-select model when in reviewer mode with no selection // Auto-select model when in reviewer mode with no selection
if (isReviewerMode && selectedModel == null) { if (isReviewerMode && selectedModel == null) {
@@ -1410,6 +1413,7 @@ class _ChatPageState extends ConsumerState<ChatPage> {
}, },
child: (_showScrollToBottom && child: (_showScrollToBottom &&
!keyboardVisible && !keyboardVisible &&
canScroll &&
ref.watch(chatMessagesProvider).isNotEmpty) ref.watch(chatMessagesProvider).isNotEmpty)
? Center( ? Center(
key: const ValueKey('scroll_to_bottom_visible'), key: const ValueKey('scroll_to_bottom_visible'),