Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions sample/src/commonMain/kotlin/SampleApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import me.zhanghai.compose.preference.footerPreference
import me.zhanghai.compose.preference.listPreference
import me.zhanghai.compose.preference.multiSelectListPreference
import me.zhanghai.compose.preference.preference
import me.zhanghai.compose.preference.preferenceCategory
import me.zhanghai.compose.preference.radioButtonPreference
import me.zhanghai.compose.preference.sliderPreference
import me.zhanghai.compose.preference.switchPreference
Expand Down Expand Up @@ -76,9 +77,21 @@ fun SampleScreen() {
contentWindowInsets = windowInsets,
) { contentPadding ->
LazyColumn(modifier = Modifier.fillMaxSize(), contentPadding = contentPadding) {
preferenceCategory(
key = "basic_category",
title = { Text(text = "Basic") },
)
preference(
key = "preference",
title = { Text(text = "Preference") },
icon = {
Icon(imageVector = Icons.Outlined.Settings, contentDescription = null)
},
summary = { Text(text = "Summary") },
) {}
preference(
key = "preference_without_icon",
title = { Text(text = "Preference without icon") },
summary = { Text(text = "Summary") },
) {}
checkboxPreference(
Expand All @@ -87,6 +100,13 @@ fun SampleScreen() {
title = { Text(text = "Checkbox preference") },
summary = { Text(text = if (it) "On" else "Off") },
)
checkboxPreference(
key = "disabled_checkbox_preference",
defaultValue = true,
title = { Text(text = "Disabled checkbox preference") },
enabled = { false },
summary = { Text(text = if (it) "On" else "Off") },
)
switchPreference(
key = "switch_preference",
defaultValue = false,
Expand All @@ -108,6 +128,10 @@ fun SampleScreen() {
Icon(imageVector = Icons.Outlined.Settings, contentDescription = "Settings")
},
) {}
preferenceCategory(
key = "advanced_category",
title = { Text(text = "Advanced") },
)
sliderPreference(
key = "slider_preference",
defaultValue = 0f,
Expand Down