Slightly tweak Preference.PreferenceItem.CustomPreference

This commit is contained in:
AntsyLich 2024-11-17 05:27:42 +06:00
parent 9aef08c333
commit 81effea01c
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View file

@ -162,12 +162,12 @@ sealed class Preference {
data class CustomPreference(
override val title: String,
val content: @Composable (PreferenceItem<String>) -> Unit,
) : PreferenceItem<String>() {
val content: @Composable () -> Unit,
) : PreferenceItem<Unit>() {
override val enabled: Boolean = true
override val subtitle: String? = null
override val icon: ImageVector? = null
override val onValueChanged: suspend (newValue: String) -> Boolean = { true }
override val onValueChanged: suspend (newValue: Unit) -> Boolean = { true }
}
}

View file

@ -167,7 +167,7 @@ internal fun PreferenceItem(
InfoWidget(text = item.title)
}
is Preference.PreferenceItem.CustomPreference -> {
item.content(item)
item.content()
}
}
}