Slightly tweak Preference.PreferenceItem.CustomPreference

(cherry picked from commit 81effea01c33d4b47f6802a3d5e31fa39609a6fb)
This commit is contained in:
AntsyLich 2024-11-17 05:27:42 +06:00 committed by Jobobby04
parent ce96b53f10
commit 850d81600e
3 changed files with 5 additions and 5 deletions

View File

@ -165,12 +165,12 @@ sealed class Preference {
data class CustomPreference( data class CustomPreference(
override val title: String, override val title: String,
val content: @Composable (PreferenceItem<String>) -> Unit, val content: @Composable () -> Unit,
) : PreferenceItem<String>() { ) : PreferenceItem<Unit>() {
override val enabled: Boolean = true override val enabled: Boolean = true
override val subtitle: String? = null override val subtitle: String? = null
override val icon: ImageVector? = 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) InfoWidget(text = item.title)
} }
is Preference.PreferenceItem.CustomPreference -> { is Preference.PreferenceItem.CustomPreference -> {
item.content(item) item.content()
} }
} }
} }

View File

@ -139,7 +139,7 @@ object SettingsMangadexScreen : SearchableSettings {
title = mdex.name + " Login", title = mdex.name + " Login",
content = { content = {
BasePreferenceWidget( BasePreferenceWidget(
title = it.title, title = mdex.name + " Login",
widget = { widget = {
Icon( Icon(
imageVector = Icons.Outlined.PeopleAlt, imageVector = Icons.Outlined.PeopleAlt,