diff --git a/lib/features/chat/presentation/message_input.dart b/lib/features/chat/presentation/message_input.dart index 395384f..03815fb 100644 --- a/lib/features/chat/presentation/message_input.dart +++ b/lib/features/chat/presentation/message_input.dart @@ -52,6 +52,7 @@ class MessageInput extends StatefulWidget { class _MessageInputState extends State { final _controller = TextEditingController(); + final _focusNode = FocusNode(); bool _hasText = false; bool _isPickingFile = false; @@ -67,6 +68,7 @@ class _MessageInputState extends State { @override void dispose() { _controller.dispose(); + _focusNode.dispose(); super.dispose(); } @@ -75,6 +77,8 @@ class _MessageInputState extends State { if (text.isEmpty) return; _controller.clear(); await widget.onSend(text); + // Return focus to the input so the user can keep typing. + _focusNode.requestFocus(); } Future _pickFile() async { @@ -180,6 +184,8 @@ class _MessageInputState extends State { Expanded( child: TextField( controller: _controller, + focusNode: _focusNode, + autofocus: true, decoration: const InputDecoration( hintText: 'Message', contentPadding: EdgeInsets.symmetric(