优化DropdownMenu UI

- 修复聊天页静音的显示文案问题
- 优化DropdownMenu的UI
This commit is contained in:
2025-09-01 15:50:10 +08:00
parent 36d322ef8c
commit 118a6cf986
2 changed files with 22 additions and 9 deletions

View File

@@ -227,7 +227,7 @@ fun ChatScreen(userId: String) {
}, },
menuItems = listOf( menuItems = listOf(
MenuItem( MenuItem(
title = if (viewModel.notificationStrategy == "mute") "" else "", title = if (viewModel.notificationStrategy == "mute") "取消静音" else "静音",
icon = if (viewModel.notificationStrategy == "mute") R.drawable.rider_pro_notice_mute else R.drawable.rider_pro_notice_active, icon = if (viewModel.notificationStrategy == "mute") R.drawable.rider_pro_notice_mute else R.drawable.rider_pro_notice_active,
) { ) {

View File

@@ -1,6 +1,7 @@
package com.aiosman.ravenow.ui.composables package com.aiosman.ravenow.ui.composables
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
@@ -15,6 +16,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@@ -36,6 +39,16 @@ fun DropdownMenu(
) { ) {
val AppColors = LocalAppTheme.current val AppColors = LocalAppTheme.current
MaterialTheme(
colorScheme = MaterialTheme.colorScheme.copy(
surface = AppColors.secondaryBackground,
onSurface = AppColors.text,
outline = AppColors.divider,
),
shapes = MaterialTheme.shapes.copy(
extraSmall = RoundedCornerShape(12.dp),
)
) {
androidx.compose.material3.DropdownMenu( androidx.compose.material3.DropdownMenu(
expanded = expanded, expanded = expanded,
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
@@ -43,7 +56,6 @@ fun DropdownMenu(
.let { .let {
if (width != null) it.width(width.dp) else it if (width != null) it.width(width.dp) else it
} }
.background(color = AppColors.background),
) { ) {
for (item in menuItems) { for (item in menuItems) {
Box( Box(
@@ -76,4 +88,5 @@ fun DropdownMenu(
} }
} }
} }
}
} }