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