From ef77858d82f6ae6fc397d56546105b014eab2aea Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Sun, 22 Mar 2026 07:46:08 +0100
Subject: [PATCH] fix: keyboard dismiss on tap outside, line breaks, session switch
---
lib/screens/chat_screen.dart | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart
index f1d4436..b773415 100644
--- a/lib/screens/chat_screen.dart
+++ b/lib/screens/chat_screen.dart
@@ -364,9 +364,10 @@
}
Future<void> _switchSession(String sessionId) async {
- // Stop any playing audio when switching sessions
+ // Stop any playing audio and dismiss keyboard when switching sessions
await AudioService.stopPlayback();
setState(() => _playingMessageId = null);
+ if (mounted) FocusScope.of(context).unfocus();
ref.read(activeSessionIdProvider.notifier).state = sessionId;
await ref.read(messagesProvider.notifier).switchSession(sessionId);
@@ -391,6 +392,7 @@
ref.read(messagesProvider.notifier).addMessage(message);
_textController.clear();
+ FocusScope.of(context).unfocus(); // dismiss keyboard
// Send as plain text (not command) — gateway handles plain messages
_ws?.send({
@@ -822,7 +824,9 @@
final unreadCounts = ref.watch(unreadCountsProvider);
final inputMode = ref.watch(inputModeProvider);
- return Scaffold(
+ return GestureDetector(
+ onTap: () => FocusScope.of(context).unfocus(),
+ child: Scaffold(
key: _scaffoldKey,
appBar: AppBar(
leading: IconButton(
@@ -927,6 +931,7 @@
),
],
),
+ ),
);
}
}
--
Gitblit v1.3.1