优化布局

This commit is contained in:
zzh 2025-11-29 14:08:15 +08:00
parent fb20e2e64b
commit 9cc3f08291
2 changed files with 51 additions and 27 deletions

View File

@ -371,15 +371,24 @@ fun RoomTab(
selected: Boolean,
onClick: () -> Unit
) {
val base = Modifier.clip(RoundedCornerShape(20.dp))
val mod = if (selected) {
base.background(brush = Brush.linearGradient(listOf(Color(0xFFA9F0FF), Color(0xFFB89CFF))))
} else {
base.background(color = Color(0x50121212))
}
val shape = RoundedCornerShape(20.dp)
Box(
modifier = mod
modifier = Modifier
.clip(shape)
.then(
if (selected) {
Modifier.background(brush = Brush.linearGradient(listOf(Color(0xFFA9F0FF), Color(0xFFB89CFF))))
} else {
Modifier
.background(Color(0xFF1E2530).copy(alpha = 0.8f))
.border(
width = 1.dp,
color = Color.White.copy(alpha = 0.15f),
shape = shape
)
}
)
.clickable { onClick() }
.padding(horizontal = 14.dp, vertical = 10.dp)
) {
@ -417,7 +426,12 @@ fun DeviceCard(d: Device, roomName: String = "") {
modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(16.dp))
.background(Color(0x40121212))
.background(Color(0xFF1E2530).copy(alpha = 0.85f))
.border(
width = 1.dp,
color = Color.White.copy(alpha = 0.15f),
shape = RoundedCornerShape(16.dp)
)
.padding(12.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(12.dp)
@ -1239,13 +1253,11 @@ fun UsageStatusChart(modifier: Modifier = Modifier, roomName: String = "房间")
modifier = modifier
.height(260.dp)
.clip(RoundedCornerShape(24.dp))
.background(
Brush.verticalGradient(
colors = listOf(
accentColor.copy(alpha = 0.15f),
Color(0xFF1A1A2E).copy(alpha = 0.9f)
)
)
.background(Color(0xFF1E2530).copy(alpha = 0.85f))
.border(
width = 1.dp,
color = Color.White.copy(alpha = 0.15f),
shape = RoundedCornerShape(24.dp)
)
.padding(16.dp)
) {
@ -1530,16 +1542,11 @@ fun AirConditionerCard(modifier: Modifier = Modifier, roomName: String = "房间
modifier = modifier
.height(260.dp)
.clip(RoundedCornerShape(24.dp))
.background(
Brush.verticalGradient(
colors = if (isOn) listOf(
accentColor.copy(alpha = 0.3f),
Color(0xFF1A1A2E).copy(alpha = 0.9f)
) else listOf(
Color(0xFF2A2A3E).copy(alpha = 0.6f),
Color(0xFF1A1A2E).copy(alpha = 0.9f)
)
)
.background(Color(0xFF1E2530).copy(alpha = 0.85f))
.border(
width = 1.dp,
color = Color.White.copy(alpha = 0.15f),
shape = RoundedCornerShape(24.dp)
)
.padding(16.dp)
) {
@ -2009,7 +2016,13 @@ fun ModeButton(
shape = shape
)
} else {
Modifier.background(Color(0x50121212))
Modifier
.background(Color(0xFF1E2530).copy(alpha = 0.85f))
.border(
width = 1.dp,
color = Color.White.copy(alpha = 0.15f),
shape = shape
)
}
)
.clickable(indication = null, interactionSource = interaction) {
@ -2131,7 +2144,18 @@ fun LightRow(modifier: Modifier = Modifier, roomName: String = "房间") {
fun LightCard(name: String, percent: Float, modifier: Modifier = Modifier) {
var brightness by remember { mutableStateOf(percent) }
Box(modifier = modifier.height(72.dp).clip(RoundedCornerShape(16.dp)).background(Color(0x50121212)).padding(horizontal = 12.dp, vertical = 8.dp)) {
Box(
modifier = modifier
.height(72.dp)
.clip(RoundedCornerShape(16.dp))
.background(Color(0xFF1E2530).copy(alpha = 0.85f))
.border(
width = 1.dp,
color = Color.White.copy(alpha = 0.15f),
shape = RoundedCornerShape(16.dp)
)
.padding(horizontal = 12.dp, vertical = 8.dp)
) {
Row(horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) {
Row(horizontalArrangement = Arrangement.spacedBy(12.dp), verticalAlignment = Alignment.CenterVertically) {
// 灯光图标 - 带发光效果

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB