Merge pull request #216 from cogwheel0/improve-chat-input-semantics
feat(chat): Improve chat input semantics and keyboard interactions
This commit is contained in:
@@ -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>
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user