Fix SliderPref enable status

This commit is contained in:
tarsin committed 2023-06-05 00:10:30 +08:00
1 parent 6490598fc3
commit a29fc4ce94
4 files changed
+1 -48

No files matched your search

@@ -7,7 +7,4 @@ object PreferenceTokens {
val PreferenceIconSize = 24.dp
val PreferenceIconPadding = 16.dp
val PreferenceTextPadding = 8.dp
val PreferenceMinHeight = 56.dp
val PreferencePadding = 16.dp
}
@@ -19,22 +19,6 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.jamal.composeprefs3.ui.roundToDP
/**
* Preference which shows a slider just below the [title]
*
* @param key Key used to identify this Pref in the DataStore
* @param title Main text which describes the Pref
* @param modifier Modifier applied to the Text aspect of this Pref
* @param defaultValue Default value of the slider. Used if this key is not found in the DataStore
* @param onValueChangeFinished Same as onValueChangeFinished parameter in [Slider]
* @param valueRange Same as valueRange parameter in [Slider]
* @param showValue If the current slider value should be shown on the side of the slider.
* @param enabled If false, this slider cannot be interacted with.
* @param steps Same as steps parameter in [Slider]
* @param textColor Text colour of the [title] and shown value if [showValue] is true.
* @param enabled If [enabled] is not true, this Pref cannot be checked/unchecked
* @param leadingIcon Icon which is positioned at the start of the Pref
*/
@Composable
fun SliderPref(
title: String,
@@ -58,6 +42,7 @@ fun SliderPref(
textColor = textColor,
minimalHeight = true,
leadingIcon = leadingIcon,
enabled = enabled,
)
Row(
modifier = Modifier.fillMaxWidth(),
@@ -6,19 +6,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
/**
* Simple preference with a trailing [Switch]
*
* @param key Key used to identify this Pref in the DataStore
* @param title Main text which describes the Pref
* @param modifier Modifier applied to the Text aspect of this Pref
* @param summary Used to give some more information about what this Pref is for
* @param defaultChecked If the switch should be checked by default. Only used if a value for this [key] doesn't already exist in the DataStore
* @param onCheckedChange Will be called with the new state when the state changes
* @param textColor Text colour of the [title] and [summary]
* @param enabled If false, this Pref cannot be checked/unchecked
* @param leadingIcon Icon which is positioned at the start of the Pref
*/
@Composable
fun SwitchPref(
checked: Boolean,
@@ -10,22 +10,6 @@ import androidx.compose.ui.text.AnnotatedString
import com.jamal.composeprefs3.ui.PrefsListItem
import com.jamal.composeprefs3.ui.ifNotNullThen
/**
* Simple Text with title and summary.
* Used to show some information to the user and is the basis of all other preferences.
*
* @param title Main text which describes the Pref
* @param modifier Modifier applied to the Text aspect of this Pref
* @param summary Used to give some more information about what this Pref is for
* @param darkenOnDisable If true, text colors have lower opacity when the Pref is not [enabled]
* @param minimalHeight If true, the height of the pref is reduced, such that other content can be more easily included in the pref.
* Mostly for internal use with custom Prefs
* @param onClick Callback for when this Pref is clicked. Will not be called if Pref is not [enabled]
* @param textColor Text colour of the [title] and [summary]
* @param enabled If false, this Pref cannot be checked/unchecked
* @param leadingIcon Icon which is positioned at the start of the Pref
* @param trailingContent Composable content which is positioned at the end of the Pref
*/
@Composable
fun TextPref(
title: String,