feat(chat): Improve chat input semantics and keyboard interactions

This commit is contained in:
cogwheel0
2025-12-03 15:04:53 +05:30
parent 8fa839f84e
commit 0daf840a03

View File

@@ -1293,15 +1293,17 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
} catch (_) {}
_ensureFocusedIfEnabled();
},
child: MergeSemantics(
child: Semantics(
textField: true,
label: AppLocalizations.of(context)!.messageInputLabel,
hint: AppLocalizations.of(context)!.messageInputHint,
child: Shortcuts(
shortcuts: () {
final map = <LogicalKeySet, Intent>{
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.enter):
const _SendMessageIntent(),
LogicalKeySet(
LogicalKeyboardKey.meta,
LogicalKeyboardKey.enter,
): const _SendMessageIntent(),
LogicalKeySet(
LogicalKeyboardKey.control,
LogicalKeyboardKey.enter,
@@ -1344,7 +1346,8 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
return null;
},
),
_SelectNextPromptIntent: CallbackAction<_SelectNextPromptIntent>(
_SelectNextPromptIntent:
CallbackAction<_SelectNextPromptIntent>(
onInvoke: (intent) {
_movePromptSelection(1);
return null;
@@ -1381,7 +1384,8 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
final FontWeight recordingWeight = _isRecording
? FontWeight.w500
: FontWeight.w400;
final TextStyle baseChatStyle = AppTypography.chatMessageStyle;
final TextStyle baseChatStyle =
AppTypography.chatMessageStyle;
return TextField(
controller: _controller,
@@ -1427,7 +1431,8 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
alignLabelWithHint: true,
),
// Enable pasting images and files from clipboard
contentInsertionConfiguration: ContentInsertionConfiguration(
contentInsertionConfiguration:
ContentInsertionConfiguration(
allowedMimeTypes: ClipboardAttachmentService
.supportedImageMimeTypes
.toList(),
@@ -1448,6 +1453,7 @@ class _ModernChatInputState extends ConsumerState<ModernChatInput>
),
),
),
),
);
}