| .. | .. |
|---|
| 364 | 364 | } |
|---|
| 365 | 365 | |
|---|
| 366 | 366 | Future<void> _switchSession(String sessionId) async { |
|---|
| 367 | | - // Stop any playing audio when switching sessions |
|---|
| 367 | + // Stop any playing audio and dismiss keyboard when switching sessions |
|---|
| 368 | 368 | await AudioService.stopPlayback(); |
|---|
| 369 | 369 | setState(() => _playingMessageId = null); |
|---|
| 370 | + if (mounted) FocusScope.of(context).unfocus(); |
|---|
| 370 | 371 | |
|---|
| 371 | 372 | ref.read(activeSessionIdProvider.notifier).state = sessionId; |
|---|
| 372 | 373 | await ref.read(messagesProvider.notifier).switchSession(sessionId); |
|---|
| .. | .. |
|---|
| 391 | 392 | |
|---|
| 392 | 393 | ref.read(messagesProvider.notifier).addMessage(message); |
|---|
| 393 | 394 | _textController.clear(); |
|---|
| 395 | + FocusScope.of(context).unfocus(); // dismiss keyboard |
|---|
| 394 | 396 | |
|---|
| 395 | 397 | // Send as plain text (not command) — gateway handles plain messages |
|---|
| 396 | 398 | _ws?.send({ |
|---|
| .. | .. |
|---|
| 822 | 824 | final unreadCounts = ref.watch(unreadCountsProvider); |
|---|
| 823 | 825 | final inputMode = ref.watch(inputModeProvider); |
|---|
| 824 | 826 | |
|---|
| 825 | | - return Scaffold( |
|---|
| 827 | + return GestureDetector( |
|---|
| 828 | + onTap: () => FocusScope.of(context).unfocus(), |
|---|
| 829 | + child: Scaffold( |
|---|
| 826 | 830 | key: _scaffoldKey, |
|---|
| 827 | 831 | appBar: AppBar( |
|---|
| 828 | 832 | leading: IconButton( |
|---|
| .. | .. |
|---|
| 927 | 931 | ), |
|---|
| 928 | 932 | ], |
|---|
| 929 | 933 | ), |
|---|
| 934 | + ), |
|---|
| 930 | 935 | ); |
|---|
| 931 | 936 | } |
|---|
| 932 | 937 | } |
|---|