Clear message input on send

This commit is contained in:
Janez T
2026-03-13 19:38:05 +01:00
parent a7ad4bb8ec
commit 63aa9619e6

View File

@@ -598,6 +598,9 @@ class _MessagesTabState extends State<MessagesTab> {
return; return;
} }
_textController.clear();
_focusNode.unfocus();
try { try {
// Check destination type and send accordingly // Check destination type and send accordingly
if (_destinationType == if (_destinationType ==
@@ -628,13 +631,18 @@ class _MessagesTabState extends State<MessagesTab> {
await _sendToChannel(text, connectionProvider, messagesProvider, 0); await _sendToChannel(text, connectionProvider, messagesProvider, 0);
} }
_textController.clear();
_focusNode.unfocus();
_markCurrentDestinationAsRead(); _markCurrentDestinationAsRead();
if (!mounted) return; if (!mounted) return;
} catch (e) { } catch (e) {
if (!mounted) return; if (!mounted) return;
if (_textController.text.isEmpty) {
_textController.text = text;
_textController.selection = TextSelection.collapsed(
offset: _textController.text.length,
);
_focusNode.requestFocus();
}
ToastLogger.error(context, 'Failed to send: $e'); ToastLogger.error(context, 'Failed to send: $e');
} }
} }