PreferenceList

fun <T> PreferenceScope.PreferenceList(style: PreferenceList.Style = PreferenceList.Style.Dialog(), value: MutableState<T>, items: List<T>, itemTextProvider: @Composable (item: T) -> String = { it.toString() }, itemIconProvider: @Composable (item: T) -> Unit? = null, filter: (filter: String, item: T) -> Boolean? = null, title: String, enabled: Dependency = Dependency.Enabled, visible: Dependency = Dependency.Enabled, subtitle: String? = null, icon: @Composable () -> Unit? = null, itemStyle: PreferenceItemStyle = LocalPreferenceSettings.current.style.defaultItemStyle, itemSetup: PreferenceItemSetup = PreferenceListDefaults.itemSetup(style), titleRenderer: @Composable (text: AnnotatedString) -> Unit = { Text(it) }, subtitleRenderer: @Composable (text: AnnotatedString) -> Unit = { Text(it) }, filterTags: List<String> = emptyList(), dialog: @Composable (state: DialogState) -> Unit = { dialogState -> PreferenceListDefaults.dialog( style, dialogState, value.value, { value.value = it }, items, itemTextProvider, itemIconProvider, title, icon, filter?.let { DialogList.Filter( filter = it, keepSelectionForInvisibleItems = false ) } ) })

A list preference item - this item provides a list dialog or a dropdown to change this preference

 

Basic Parameters: all params not described here are derived from com.michaelflisar.composepreferences.core.composables.BasePreference, check it out for more details

Parameters

value

the MutableState of this item

items

the list of items that this preference can select from

itemTextProvider

a converter to get the text of an item

itemIconProvider

a converter to provide an icon for an item

filter

a lambda for filtering the list - if it is null, filtering is disabled (works with PreferenceList.Style.Dialog only!)


fun <T> PreferenceScope.PreferenceList(style: PreferenceList.Style = PreferenceList.Style.Dialog(), value: T, onValueChange: (value: T) -> Unit, items: List<T>, itemTextProvider: @Composable (item: T) -> String = { it.toString() }, itemIconProvider: @Composable (item: T) -> Unit? = null, title: String, enabled: Dependency = Dependency.Enabled, visible: Dependency = Dependency.Enabled, subtitle: String? = null, icon: @Composable () -> Unit? = null, itemStyle: PreferenceItemStyle = LocalPreferenceSettings.current.style.defaultItemStyle, itemSetup: PreferenceItemSetup = PreferenceListDefaults.itemSetup(style), titleRenderer: @Composable (text: AnnotatedString) -> Unit = { Text(it) }, subtitleRenderer: @Composable (text: AnnotatedString) -> Unit = { Text(it) }, filterTags: List<String> = emptyList(), dialog: @Composable (state: DialogState) -> Unit = { dialogState -> PreferenceListDefaults.dialog( style, dialogState, value, onValueChange, items, itemTextProvider, itemIconProvider, title, icon ) })

A list preference item - this item provides a list dialog or a dropdown to change this preference

 

Basic Parameters: all params not described here are derived from com.michaelflisar.composepreferences.core.composables.BasePreference, check it out for more details

Parameters

value

the value of this item

onValueChange

the value changed callback of this item

items

the list of items that this preference can select from

itemTextProvider

a converter to get the text of an item

itemIconProvider

a converter to provide an icon for an item