update ui

This commit is contained in:
2026-07-03 11:00:31 +07:00
parent 6fe2ce3e31
commit 51c268c455

View File

@@ -6,6 +6,12 @@ import android.net.Uri
import android.speech.RecognizerIntent import android.speech.RecognizerIntent
import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.scaleIn
import androidx.compose.animation.scaleOut
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
@@ -608,33 +614,35 @@ fun ChatInput(
}, },
) )
Spacer(modifier = Modifier.size(8.dp)) Spacer(modifier = Modifier.size(8.dp))
if (value.isNotEmpty()) { AnimatedContent(
FilledTonalIconButton( targetState = value.isNotEmpty(),
onClick = onSend, transitionSpec = { (scaleIn() + fadeIn()) togetherWith (scaleOut() + fadeOut()) },
modifier = Modifier.size(56.dp), label = "send_mic_transition"
colors = IconButtonDefaults.filledTonalIconButtonColors( ) { isNotEmpty ->
containerColor = MaterialTheme.colorScheme.surfaceVariant, if (isNotEmpty) {
contentColor = MaterialTheme.colorScheme.onSurfaceVariant IconButton(
) onClick = onSend,
) { modifier = Modifier.size(56.dp),
Icon( colors = IconButtonDefaults.iconButtonColors(
painter = painterResource(Res.drawable.ic_send), containerColor = MaterialTheme.colorScheme.surfaceVariant,
contentDescription = "Send" contentColor = MaterialTheme.colorScheme.onSurfaceVariant
) )
} ) {
} else { Icon(
FilledTonalIconButton( painter = painterResource(Res.drawable.ic_send),
onClick = onMicClick, contentDescription = "Send"
modifier = Modifier.size(56.dp), )
colors = IconButtonDefaults.filledTonalIconButtonColors( }
containerColor = MaterialTheme.colorScheme.surfaceVariant, } else {
contentColor = MaterialTheme.colorScheme.onSurfaceVariant FilledTonalIconButton(
) onClick = onMicClick,
) { modifier = Modifier.size(56.dp),
Icon( ) {
painter = painterResource(Res.drawable.ic_audio), Icon(
contentDescription = "Speech to Text" painter = painterResource(Res.drawable.ic_audio),
) contentDescription = "Speech to Text"
)
}
} }
} }
} }