[优化] 优化书架的性能与稳定性

This commit is contained in:
HapeLee committed 2026-03-22 03:26:53 +08:00
1 parent 5cd55758a1
commit 1e41ce5ded
1 file changed
+14 -1
@@ -2,6 +2,7 @@ package io.legado.app.ui.widget.components.card
import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material3.Card import androidx.compose.material3.Card
import androidx.compose.material3.CardColors import androidx.compose.material3.CardColors
import androidx.compose.material3.CardDefaults import androidx.compose.material3.CardDefaults
@@ -12,6 +13,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Shape import androidx.compose.ui.graphics.Shape
import io.legado.app.ui.config.themeConfig.ThemeConfig import io.legado.app.ui.config.themeConfig.ThemeConfig
@OptIn(ExperimentalMaterialApi::class)
@Composable @Composable
fun GlassCard( fun GlassCard(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
@@ -29,8 +31,9 @@ fun GlassCard(
contentColor = MaterialTheme.colorScheme.onSecondaryContainer contentColor = MaterialTheme.colorScheme.onSecondaryContainer
) )
if (onClick != null) {
Card( Card(
onClick = onClick ?: {}, onClick = onClick,
modifier = modifier, modifier = modifier,
shape = shape, shape = shape,
colors = finalColors, colors = finalColors,
@@ -38,4 +41,14 @@ fun GlassCard(
border = border, border = border,
content = content content = content
) )
} else {
Card(
modifier = modifier,
shape = shape,
colors = finalColors,
elevation = elevation,
border = border,
content = content
)
}
} }