From 71f951c5c4de46e9217f37adc49df318bfe283ea Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Tue, 24 Mar 2026 08:12:45 +0100
Subject: [PATCH] fix: dismiss keyboard after image/file picker, per-session typing indicator
---
lib/screens/chat_screen.dart | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart
index ff43850..4b209cf 100644
--- a/lib/screens/chat_screen.dart
+++ b/lib/screens/chat_screen.dart
@@ -213,8 +213,13 @@
case 'image':
_handleIncomingImage(msg);
case 'typing':
- final typing = msg['typing'] as bool? ?? msg['isTyping'] as bool? ?? true;
- ref.read(isTypingProvider.notifier).state = typing;
+ final typing = msg['typing'] as bool? ?? msg['isTyping'] as bool? ?? msg['active'] as bool? ?? true;
+ final typingSession = msg['sessionId'] as String?;
+ final activeId = ref.read(activeSessionIdProvider);
+ // Only show typing indicator for the active session
+ if (typingSession == null || typingSession == activeId) {
+ ref.read(isTypingProvider.notifier).state = typing;
+ }
case 'typing_end':
ref.read(isTypingProvider.notifier).state = false;
case 'screenshot':
@@ -794,7 +799,10 @@
// Show caption dialog
final fileNames = result.files.map((f) => f.name).join(', ');
final caption = await _showCaptionDialog(result.files.length);
- if (caption == null) return;
+ if (caption == null) {
+ if (mounted) FocusManager.instance.primaryFocus?.unfocus();
+ return;
+ }
// Handle voice caption
String textCaption = caption;
@@ -856,6 +864,8 @@
}
}
+ // Dismiss keyboard after file flow completes
+ if (mounted) FocusManager.instance.primaryFocus?.unfocus();
_scrollToBottom();
}
@@ -964,7 +974,10 @@
}
final caption = await _showCaptionDialog(images.length);
- if (caption == null) return; // user cancelled
+ if (caption == null) {
+ if (mounted) FocusManager.instance.primaryFocus?.unfocus();
+ return; // user cancelled
+ }
// Handle voice caption
String textCaption = caption;
@@ -1016,6 +1029,8 @@
ref.read(messagesProvider.notifier).addMessage(message);
}
+ // Dismiss keyboard after image flow completes
+ if (mounted) FocusManager.instance.primaryFocus?.unfocus();
_scrollToBottom();
}
--
Gitblit v1.3.1