替换按钮,替换文字

This commit is contained in:
2024-10-10 01:26:23 +08:00
parent 4c5a9dfe5c
commit 19bb7715a2

View File

@@ -20,6 +20,7 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicTextField import androidx.compose.foundation.text.BasicTextField
import androidx.compose.material.Icon
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
@@ -71,20 +72,18 @@ fun EditCommentBottomModal(
modifier = Modifier.fillMaxWidth() modifier = Modifier.fillMaxWidth()
) { ) {
Text( Text(
if (replyComment == null) "评论" else "回复", if (replyComment == null) "Comment" else "Reply",
fontWeight = FontWeight.W600, fontWeight = FontWeight.W600,
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
fontSize = 20.sp, fontSize = 20.sp,
fontStyle = FontStyle.Italic fontStyle = FontStyle.Italic
) )
Crossfade(targetState = text.isNotEmpty(), animationSpec = tween(500)) { isNotEmpty -> Crossfade(targetState = text.isNotEmpty(), animationSpec = tween(500),
Image( label = ""
painter = rememberUpdatedState( ) { isNotEmpty ->
if (isNotEmpty) painterResource(id = R.drawable.rider_pro_send) else painterResource( Icon(
id = R.drawable.rider_pro_send_disable painter = painterResource(id = R.drawable.rider_pro_video_share),
) contentDescription = "Emoji",
).value,
contentDescription = "Send",
modifier = Modifier modifier = Modifier
.size(32.dp) .size(32.dp)
.noRippleClickable { .noRippleClickable {
@@ -94,6 +93,7 @@ fun EditCommentBottomModal(
} }
}, },
tint = if (isNotEmpty) Color.Red else Color(0xffe0e0e0)
) )
} }
} }