feat: add 200 character limit with counter to chat input field
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -256,13 +256,23 @@ fun ChatScreen(
|
|||||||
}
|
}
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = inputText,
|
value = inputText,
|
||||||
onValueChange = { inputText = it },
|
onValueChange = { if (it.length <= 200) inputText = it },
|
||||||
placeholder = {
|
placeholder = {
|
||||||
Text(if (uiState.editingMessageId != null) "编辑消息..." else "输入消息...")
|
Text(if (uiState.editingMessageId != null) "编辑消息..." else "输入消息...")
|
||||||
},
|
},
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
maxLines = 8,
|
maxLines = 8,
|
||||||
enabled = !uiState.isLoading && !uiState.isStreaming
|
enabled = !uiState.isLoading && !uiState.isStreaming,
|
||||||
|
supportingText = {
|
||||||
|
Text(
|
||||||
|
"${inputText.length}/200",
|
||||||
|
style = MaterialTheme.typography.bodySmall,
|
||||||
|
color = if (inputText.length >= 200)
|
||||||
|
MaterialTheme.colorScheme.error
|
||||||
|
else
|
||||||
|
MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.width(8.dp))
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user