fix:样式更新后,菜单内列未更新的问题

This commit is contained in:
fansan
2026-06-22 22:09:42 +08:00
parent bea1095b0a
commit 1560c75798
2 changed files with 19 additions and 10 deletions
@@ -111,6 +111,7 @@ fun BgTextConfigSheet(
title = stringResource(R.string.delete),
imageVector = Icons.Default.Delete,
modifier = Modifier.weight(1f),
enabled = styleConfig.styleSelect >= 5,
onClick = { onIntent(ReadBookIntent.DeleteCurrentReadStyleConfig) },
)
ActionCard(
@@ -303,12 +304,14 @@ private fun ActionCard(
title: String,
imageVector: ImageVector,
modifier: Modifier = Modifier,
enabled: Boolean = true,
onClick: () -> Unit,
) {
val contentAlpha = if (enabled) 1f else 0.38f
NormalCard(
onClick = onClick,
onClick = if (enabled) onClick else null,
modifier = modifier,
containerColor = LegadoTheme.colorScheme.surfaceContainerLow,
containerColor = if (enabled) LegadoTheme.colorScheme.surfaceContainerLow else LegadoTheme.colorScheme.surfaceContainerLow.copy(alpha = 0.5f),
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
@@ -320,14 +323,14 @@ private fun ActionCard(
Icon(
imageVector = imageVector,
contentDescription = null,
tint = LegadoTheme.colorScheme.onSurfaceVariant,
tint = LegadoTheme.colorScheme.onSurfaceVariant.copy(alpha = contentAlpha),
modifier = Modifier.size(20.dp),
)
Spacer(Modifier.height(4.dp))
Text(
text = title,
style = LegadoTheme.typography.labelSmall,
color = LegadoTheme.colorScheme.onSurfaceVariant,
color = LegadoTheme.colorScheme.onSurfaceVariant.copy(alpha = contentAlpha),
)
}
}
@@ -86,13 +86,19 @@ fun GlobalThemePage(
val pageAnim = styleConfig.pageAnim
val styleSelect = styleConfig.styleSelect
val shareLayout = styleConfig.shareLayout
// configList needs to be read from ReadBookConfig since it's a list of Config objects
// We use styleConfig.configCount to detect when the list changes
var configList by remember { mutableStateOf(ReadBookConfig.configList.toList()) }
// Re-read configList when configCount changes (indicates list was modified)
LaunchedEffect(styleConfig.configCount) {
configList = ReadBookConfig.configList.toList()
val configList = remember(
styleConfig.configCount,
styleConfig.styleName,
styleConfig.bgAlpha,
styleConfig.bgType,
styleConfig.bgStr,
styleConfig.textColor,
styleConfig.bgTypeNight,
styleConfig.bgStrNight,
styleConfig.textColorNight,
) {
ReadBookConfig.configList.map { it.copy() }
}
Column(