@@ -358,7 +358,8 @@ fun MainUI(viewModel: ChatViewModel) {
358358 }
359359 },
360360 sendImg = if (sendImg== 1 ){Icons .Default .ArrowUpward }
361- else {ImageVector .vectorResource(R .drawable.ic_rectangle)}, vibrator
361+ else {ImageVector .vectorResource(R .drawable.ic_rectangle)},
362+ vibrator,LocalSoftwareKeyboardController .current
362363 )
363364 }
364365 ) { innerPadding ->
@@ -491,7 +492,8 @@ fun MessageInputBar(
491492 onMsgChange : (String ) -> Unit ,
492493 onSend : (String ) -> Unit ,
493494 sendImg : ImageVector ,
494- vibrator : Vibrator
495+ vibrator : Vibrator ,
496+ keyboardController : SoftwareKeyboardController
495497) {
496498 Surface (
497499 modifier = Modifier
@@ -507,7 +509,8 @@ fun MessageInputBar(
507509 value = msg,
508510 onValueChange = onMsgChange,
509511 modifier = Modifier .weight(1f ),
510- placeholder = { Text (" 输入消息..." ) }
512+ placeholder = { Text (" 输入消息..." ) },
513+ maxLines = 7
511514 )
512515 Spacer (Modifier .size(6 .dp))
513516 Box (
@@ -517,13 +520,14 @@ fun MessageInputBar(
517520 .background(MaterialTheme .colorScheme.primary)
518521 .clickable {
519522 clickVibrate(vibrator)
523+ keyboardController.hide()
520524 onSend(msg)
521525 },
522526 contentAlignment = Alignment .Center
523527 ) {
524528 Icon (
525529 imageVector = sendImg,
526- contentDescription = " " ,
530+ contentDescription = null ,
527531 tint = MaterialTheme .colorScheme.onPrimary,
528532 modifier = Modifier .size(24 .dp))
529533 }
0 commit comments