refactor: enhance chat message handling and scrolling behavior

- Added `sendMessageWithContainer` function to facilitate message sending with a ProviderContainer.
- Updated `_ChatPageState` to improve scroll behavior, ensuring smoother auto-scrolling when near the bottom of the chat.
- Refactored scroll logic to simplify conditions for showing and hiding the scroll-to-bottom button.
- Adjusted the `OptimizedList` widget to correctly handle item indexing based on the reverse property, enhancing list performance and usability.
This commit is contained in:
cogwheel0
2025-09-30 21:17:11 +05:30
parent 7debb7a055
commit 46bd057089
4 changed files with 43 additions and 36 deletions

View File

@@ -1447,6 +1447,15 @@ Future<void> sendMessageFromService(
await _sendMessageInternal(ref, message, attachments, toolIds);
}
Future<void> sendMessageWithContainer(
ProviderContainer container,
String message,
List<String>? attachments, [
List<String>? toolIds,
]) async {
await _sendMessageInternal(container, message, attachments, toolIds);
}
// Internal send message implementation
Future<void> _sendMessageInternal(
dynamic ref,