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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user