mirror of
https://github.com/BetterAndroid/FlexiUI.git
synced 2025-09-08 11:34:18 +08:00
feat: add LocalRippleColor in Interaction
This commit is contained in:
@@ -27,12 +27,14 @@ import androidx.compose.foundation.Indication
|
|||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.ReadOnlyComposable
|
import androidx.compose.runtime.ReadOnlyComposable
|
||||||
|
import androidx.compose.runtime.compositionLocalOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.semantics.Role
|
import androidx.compose.ui.semantics.Role
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import com.highcapable.flexiui.LocalColors
|
import com.highcapable.flexiui.LocalColors
|
||||||
|
import com.highcapable.flexiui.extension.orElse
|
||||||
import androidx.compose.foundation.clickable as foundationClickable
|
import androidx.compose.foundation.clickable as foundationClickable
|
||||||
import androidx.compose.foundation.selection.selectable as foundationSelectable
|
import androidx.compose.foundation.selection.selectable as foundationSelectable
|
||||||
import androidx.compose.foundation.selection.toggleable as foundationToggleable
|
import androidx.compose.foundation.selection.toggleable as foundationToggleable
|
||||||
@@ -133,9 +135,11 @@ object Interaction {
|
|||||||
val rippleColor: Color
|
val rippleColor: Color
|
||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
get() = defaultInteractionRippleColor()
|
get() = LocalRippleColor.current.orElse() ?: defaultInteractionRippleColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val LocalRippleColor = compositionLocalOf { Color.Unspecified }
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun defaultInteractionRippleColor() = LocalColors.current.themeSecondary
|
private fun defaultInteractionRippleColor() = LocalColors.current.themeSecondary
|
Reference in New Issue
Block a user