Merge pull request #1546 from fansangg/fix/menu-style-update
fix:样式更新后,菜单内列未更新的问题
This commit is contained in:
2 files changed
+19
-10
No files matched your search
@@ -114,6 +114,7 @@ fun BgTextConfigSheet(
|
|||||||
title = stringResource(R.string.delete),
|
title = stringResource(R.string.delete),
|
||||||
imageVector = Icons.Default.Delete,
|
imageVector = Icons.Default.Delete,
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
|
enabled = styleConfig.styleSelect >= 5,
|
||||||
onClick = { onIntent(ReadBookIntent.DeleteCurrentReadStyleConfig) },
|
onClick = { onIntent(ReadBookIntent.DeleteCurrentReadStyleConfig) },
|
||||||
)
|
)
|
||||||
ActionCard(
|
ActionCard(
|
||||||
@@ -306,12 +307,14 @@ private fun ActionCard(
|
|||||||
title: String,
|
title: String,
|
||||||
imageVector: ImageVector,
|
imageVector: ImageVector,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
|
enabled: Boolean = true,
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
|
val contentAlpha = if (enabled) 1f else 0.38f
|
||||||
NormalCard(
|
NormalCard(
|
||||||
onClick = onClick,
|
onClick = if (enabled) onClick else null,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
containerColor = LegadoTheme.colorScheme.surfaceContainerLow,
|
containerColor = if (enabled) LegadoTheme.colorScheme.surfaceContainerLow else LegadoTheme.colorScheme.surfaceContainerLow.copy(alpha = 0.5f),
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
@@ -323,14 +326,14 @@ private fun ActionCard(
|
|||||||
Icon(
|
Icon(
|
||||||
imageVector = imageVector,
|
imageVector = imageVector,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = LegadoTheme.colorScheme.onSurfaceVariant,
|
tint = LegadoTheme.colorScheme.onSurfaceVariant.copy(alpha = contentAlpha),
|
||||||
modifier = Modifier.size(20.dp),
|
modifier = Modifier.size(20.dp),
|
||||||
)
|
)
|
||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
Text(
|
Text(
|
||||||
text = title,
|
text = title,
|
||||||
style = LegadoTheme.typography.labelSmall,
|
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 pageAnim = styleConfig.pageAnim
|
||||||
val styleSelect = styleConfig.styleSelect
|
val styleSelect = styleConfig.styleSelect
|
||||||
val shareLayout = styleConfig.shareLayout
|
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)
|
val configList = remember(
|
||||||
LaunchedEffect(styleConfig.configCount) {
|
styleConfig.configCount,
|
||||||
configList = ReadBookConfig.configList.toList()
|
styleConfig.styleName,
|
||||||
|
styleConfig.bgAlpha,
|
||||||
|
styleConfig.bgType,
|
||||||
|
styleConfig.bgStr,
|
||||||
|
styleConfig.textColor,
|
||||||
|
styleConfig.bgTypeNight,
|
||||||
|
styleConfig.bgStrNight,
|
||||||
|
styleConfig.textColorNight,
|
||||||
|
) {
|
||||||
|
ReadBookConfig.configList.map { it.copy() }
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
|
|||||||
Reference in new issue
Block a user