Приведен стиль меню в группах к единому стилю приложения
This commit is contained in:
@@ -44,8 +44,6 @@ import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.text.selection.SelectionContainer
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import compose.icons.TablerIcons
|
||||
import compose.icons.tablericons.Code
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
@@ -61,10 +59,10 @@ import androidx.compose.material.icons.filled.Search
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.Divider
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Tab
|
||||
@@ -93,6 +91,7 @@ import androidx.compose.ui.draw.clipToBounds
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.geometry.Size
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
@@ -110,6 +109,7 @@ import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.IntOffset
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.window.PopupProperties
|
||||
import com.airbnb.lottie.compose.LottieAnimation
|
||||
import com.airbnb.lottie.compose.LottieCompositionSpec
|
||||
import com.airbnb.lottie.compose.LottieConstants
|
||||
@@ -1010,52 +1010,71 @@ fun GroupInfoScreen(
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
DropdownMenu(
|
||||
expanded = showMenu,
|
||||
onDismissRequest = { showMenu = false }
|
||||
val menuBgColor = if (isDarkTheme) Color(0xFF272829) else Color.White
|
||||
val menuTextColor = if (isDarkTheme) Color.White else Color(0xFF222222)
|
||||
val menuIconColor = if (isDarkTheme) Color.White.copy(alpha = 0.47f) else Color(0xFF676B70)
|
||||
val menuDividerColor = if (isDarkTheme) Color(0xFF1C1D1F) else Color(0xFFF5F5F5)
|
||||
val menuDangerColor = Color(0xFFFF3B30)
|
||||
|
||||
MaterialTheme(
|
||||
colorScheme = MaterialTheme.colorScheme.copy(
|
||||
surface = menuBgColor,
|
||||
onSurface = menuTextColor
|
||||
)
|
||||
) {
|
||||
DropdownMenuItem(
|
||||
text = { Text("Search members") },
|
||||
leadingIcon = {
|
||||
Icon(Icons.Default.Search, contentDescription = null)
|
||||
},
|
||||
onClick = {
|
||||
showMenu = false
|
||||
selectedTab = GroupInfoTab.MEMBERS
|
||||
showSearch = true
|
||||
}
|
||||
)
|
||||
DropdownMenuItem(
|
||||
text = { Text("Copy invite") },
|
||||
leadingIcon = {
|
||||
Icon(Icons.Default.PersonAdd, contentDescription = null)
|
||||
},
|
||||
onClick = {
|
||||
showMenu = false
|
||||
copyInvite()
|
||||
}
|
||||
)
|
||||
DropdownMenuItem(
|
||||
text = { Text("Encryption key") },
|
||||
leadingIcon = {
|
||||
Icon(Icons.Default.Lock, contentDescription = null)
|
||||
},
|
||||
onClick = {
|
||||
showMenu = false
|
||||
openEncryptionKey()
|
||||
}
|
||||
)
|
||||
Divider()
|
||||
DropdownMenuItem(
|
||||
text = { Text("Leave group", color = Color(0xFFFF3B30)) },
|
||||
leadingIcon = {
|
||||
Icon(Icons.Default.ExitToApp, contentDescription = null, tint = Color(0xFFFF3B30))
|
||||
},
|
||||
onClick = {
|
||||
showMenu = false
|
||||
showLeaveConfirm = true
|
||||
}
|
||||
)
|
||||
DropdownMenu(
|
||||
expanded = showMenu,
|
||||
onDismissRequest = { showMenu = false },
|
||||
modifier = Modifier.widthIn(min = 196.dp).background(menuBgColor),
|
||||
properties = PopupProperties(
|
||||
focusable = true,
|
||||
dismissOnBackPress = true,
|
||||
dismissOnClickOutside = true
|
||||
)
|
||||
) {
|
||||
GroupInfoMenuItem(
|
||||
icon = Icons.Default.Search,
|
||||
text = "Search members",
|
||||
tintColor = menuIconColor,
|
||||
textColor = menuTextColor,
|
||||
onClick = {
|
||||
showMenu = false
|
||||
selectedTab = GroupInfoTab.MEMBERS
|
||||
showSearch = true
|
||||
}
|
||||
)
|
||||
GroupInfoMenuItem(
|
||||
icon = Icons.Default.PersonAdd,
|
||||
text = "Copy invite",
|
||||
tintColor = menuIconColor,
|
||||
textColor = menuTextColor,
|
||||
onClick = {
|
||||
showMenu = false
|
||||
copyInvite()
|
||||
}
|
||||
)
|
||||
GroupInfoMenuItem(
|
||||
icon = Icons.Default.Lock,
|
||||
text = "Encryption key",
|
||||
tintColor = menuIconColor,
|
||||
textColor = menuTextColor,
|
||||
onClick = {
|
||||
showMenu = false
|
||||
openEncryptionKey()
|
||||
}
|
||||
)
|
||||
Divider(color = menuDividerColor)
|
||||
GroupInfoMenuItem(
|
||||
icon = Icons.Default.ExitToApp,
|
||||
text = "Leave group",
|
||||
tintColor = menuDangerColor,
|
||||
textColor = menuDangerColor,
|
||||
onClick = {
|
||||
showMenu = false
|
||||
showLeaveConfirm = true
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1821,6 +1840,39 @@ private fun GroupEncryptionKeyPage(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun GroupInfoMenuItem(
|
||||
icon: ImageVector,
|
||||
text: String,
|
||||
tintColor: Color,
|
||||
textColor: Color,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(48.dp)
|
||||
.clickable(onClick = onClick)
|
||||
.padding(horizontal = 18.dp),
|
||||
contentAlignment = Alignment.CenterStart
|
||||
) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
contentDescription = null,
|
||||
tint = tintColor,
|
||||
modifier = Modifier.size(24.dp)
|
||||
)
|
||||
Spacer(modifier = Modifier.width(19.dp))
|
||||
Text(
|
||||
text = text,
|
||||
color = textColor,
|
||||
fontSize = 16.sp
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun GroupActionButton(
|
||||
modifier: Modifier = Modifier,
|
||||
|
||||
Reference in New Issue
Block a user