feat: Add dialog with annotation text for VerifiedBadge component
This commit is contained in:
@@ -14,7 +14,8 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import compose.icons.TablerIcons
|
||||
import compose.icons.tablericons.ArrowLeft
|
||||
import compose.icons.tablericons.X
|
||||
import compose.icons.tablericons.CircleCheck
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Verified
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
@@ -374,7 +375,7 @@ private fun RecentUserItem(
|
||||
if (user.verified != 0) {
|
||||
Spacer(modifier = Modifier.width(4.dp))
|
||||
Icon(
|
||||
TablerIcons.CircleCheck,
|
||||
Icons.Default.Verified,
|
||||
contentDescription = "Verified",
|
||||
tint = PrimaryBlue,
|
||||
modifier = Modifier.size(16.dp)
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
package com.rosetta.messenger.ui.components
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Verified
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import compose.icons.TablerIcons
|
||||
import compose.icons.tablericons.RosetteDiscountCheck
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
|
||||
/**
|
||||
* Значок верификации пользователя
|
||||
@@ -29,6 +29,8 @@ fun VerifiedBadge(
|
||||
) {
|
||||
if (verified <= 0) return
|
||||
|
||||
var showDialog by remember { mutableStateOf(false) }
|
||||
|
||||
// Цвет в зависимости от уровня верификации
|
||||
val badgeColor = when (verified) {
|
||||
1 -> Color(0xFF1DA1F2) // Стандартная верификация (синий как в Twitter/Telegram)
|
||||
@@ -36,10 +38,54 @@ fun VerifiedBadge(
|
||||
else -> Color(0xFF4CAF50) // Зеленая для других уровней
|
||||
}
|
||||
|
||||
// Текст аннотации
|
||||
val annotationText = when (verified) {
|
||||
1 -> "This is an official account belonging to a public figure, brand, or organization."
|
||||
2 -> "This is official account belonging to administration of Rosetta."
|
||||
else -> "This user is administrator of this group."
|
||||
}
|
||||
|
||||
Icon(
|
||||
TablerIcons.RosetteDiscountCheck,
|
||||
Icons.Default.Verified,
|
||||
contentDescription = "Verified",
|
||||
tint = badgeColor,
|
||||
modifier = modifier.size(size.dp)
|
||||
modifier = modifier
|
||||
.size(size.dp)
|
||||
.clickable { showDialog = true }
|
||||
)
|
||||
|
||||
// Диалог с аннотацией
|
||||
if (showDialog) {
|
||||
Dialog(onDismissRequest = { showDialog = false }) {
|
||||
Surface(
|
||||
shape = RoundedCornerShape(12.dp),
|
||||
color = MaterialTheme.colorScheme.surface,
|
||||
tonalElevation = 8.dp
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.padding(16.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Icon(
|
||||
Icons.Default.Verified,
|
||||
contentDescription = null,
|
||||
tint = badgeColor,
|
||||
modifier = Modifier.size(32.dp)
|
||||
)
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
Text(
|
||||
text = annotationText,
|
||||
fontSize = 14.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.7f),
|
||||
lineHeight = 20.sp,
|
||||
textAlign = androidx.compose.ui.text.style.TextAlign.Center
|
||||
)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
TextButton(onClick = { showDialog = false }) {
|
||||
Text("OK")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user