关注和取消关注

This commit is contained in:
2024-10-13 06:18:02 +08:00
parent fab1e0206d
commit 6cb19eb6cf
3 changed files with 19 additions and 7 deletions

View File

@@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Clear
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -48,15 +49,24 @@ fun OtherProfileAction(
onFollow?.invoke()
}
) {
Icon(
Icons.Default.Add,
contentDescription = "",
modifier = Modifier.size(24.dp),
tint = if (profile.isFollowing) Color.Black else Color.White
)
if (profile.isFollowing) {
Icon(
Icons.Default.Clear,
contentDescription = "",
modifier = Modifier.size(24.dp),
tint = Color.Black
)
} else {
Icon(
Icons.Default.Add,
contentDescription = "",
modifier = Modifier.size(24.dp),
tint = Color.White
)
}
Spacer(modifier = Modifier.width(4.dp))
Text(
text = stringResource(if (profile.isFollowing) R.string.following_upper else R.string.follow_upper),
text = stringResource(if (profile.isFollowing) R.string.unfollow_upper else R.string.follow_upper),
fontSize = 14.sp,
fontWeight = FontWeight.W600,
color = if (profile.isFollowing) Color.Black else Color.White,