feat: add composer autofocus management for improved chat input experience

- Introduced ComposerAutofocusEnabled provider to manage the auto-focus state of the chat composer, allowing for better control over user interactions.
- Updated ModernChatInput to respect the autofocus setting, ensuring the keyboard behavior aligns with user intent and context.
- Enhanced ChatPage to suppress auto-focus when opening the slide drawer, improving user experience during navigation.
- Refactored SlideDrawer to include an onOpenStart callback for dismissing the keyboard, ensuring a smoother transition when the drawer is opened.
This commit is contained in:
cogwheel0
2025-10-10 15:22:54 +05:30
parent fe1e03c198
commit e73c5ee93a
5 changed files with 94 additions and 16 deletions

View File

@@ -75,6 +75,16 @@ class ComposerHasFocus extends _$ComposerHasFocus {
void set(bool value) => state = value;
}
// Whether the chat composer is allowed to auto-focus.
// When false, the composer will remain unfocused until the user taps it.
@Riverpod(keepAlive: true)
class ComposerAutofocusEnabled extends _$ComposerAutofocusEnabled {
@override
bool build() => true;
void set(bool value) => state = value;
}
// Chat messages notifier class
class ChatMessagesNotifier extends Notifier<List<ChatMessage>> {
StreamingResponseController? _messageStream;