feat: add LocalRippleColor in Interaction

This commit is contained in:
2023-12-01 11:07:02 +08:00
parent a6f92bf1fc
commit 0e92f37c9f

View File

@@ -27,12 +27,14 @@ import androidx.compose.foundation.Indication
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.Dp
import com.highcapable.flexiui.LocalColors
import com.highcapable.flexiui.extension.orElse
import androidx.compose.foundation.clickable as foundationClickable
import androidx.compose.foundation.selection.selectable as foundationSelectable
import androidx.compose.foundation.selection.toggleable as foundationToggleable
@@ -133,9 +135,11 @@ object Interaction {
val rippleColor: Color
@Composable
@ReadOnlyComposable
get() = defaultInteractionRippleColor()
get() = LocalRippleColor.current.orElse() ?: defaultInteractionRippleColor()
}
val LocalRippleColor = compositionLocalOf { Color.Unspecified }
@Composable
@ReadOnlyComposable
private fun defaultInteractionRippleColor() = LocalColors.current.themeSecondary