Updated on 2026-08-14
This commit is contained in:
parent
d42cb2a79e
commit
00c5775f03
7 changed files with 70 additions and 29 deletions
|
|
@ -14,7 +14,7 @@ import dev.chrisbanes.haze.materials.ExperimentalHazeMaterialsApi
|
|||
|
||||
@OptIn(ExperimentalHazeMaterialsApi::class)
|
||||
@Composable
|
||||
internal fun ProvideHaze(content: @Composable () -> Unit) {
|
||||
fun ProvideHaze(content: @Composable () -> Unit) {
|
||||
val hazeState = rememberHazeState()
|
||||
CompositionLocalProvider(
|
||||
LocalHazeState provides hazeState,
|
||||
|
|
@ -47,7 +47,7 @@ fun isHazeBlurEffectivelyEnabled(state: HazeState = LocalHazeState.current): Boo
|
|||
@Composable
|
||||
fun Modifier.hazeEffectTangem(
|
||||
state: HazeState = LocalHazeState.current,
|
||||
style: HazeStyle = HazeStyle.Unspecified,
|
||||
style: HazeStyle = CupertinoMaterials.ultraThin(),
|
||||
configure: HazeEffectScope.() -> Unit = {},
|
||||
): Modifier {
|
||||
val isGlobalBlurEnabled = isHazeBlurEffectivelyEnabled(state)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
|||
* @param modifier Modifier to be applied to the button.
|
||||
*/
|
||||
@Composable
|
||||
fun SecondaryTangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier) {
|
||||
fun SecondaryTangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifier, withHazeEffect: Boolean = true) {
|
||||
SecondaryTangemButton(
|
||||
onClick = buttonUM.onClick,
|
||||
modifier = modifier,
|
||||
|
|
@ -40,6 +40,7 @@ fun SecondaryTangemButton(buttonUM: TangemButtonUM, modifier: Modifier = Modifie
|
|||
size = buttonUM.size,
|
||||
shape = buttonUM.shape,
|
||||
onLongClick = buttonUM.onLongClick,
|
||||
withHazeEffect = withHazeEffect,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -70,6 +71,7 @@ fun SecondaryTangemButton(
|
|||
size: TangemButtonSize = TangemButtonSize.X15,
|
||||
shape: TangemButtonShape = TangemButtonShape.Default,
|
||||
onLongClick: (() -> Unit)? = null,
|
||||
withHazeEffect: Boolean = true,
|
||||
) {
|
||||
val backgroundModifier = if (isEnabled) {
|
||||
Modifier.background(TangemTheme.colors2.button.backgroundSecondary)
|
||||
|
|
@ -86,7 +88,7 @@ fun SecondaryTangemButton(
|
|||
onClick = onClick,
|
||||
modifier = modifier
|
||||
.clip(shape.toShape(size))
|
||||
.hazeEffectTangem()
|
||||
.then(if (withHazeEffect) Modifier.hazeEffectTangem() else Modifier)
|
||||
.then(backgroundModifier),
|
||||
text = text,
|
||||
contentColor = contentColor,
|
||||
|
|
|
|||
|
|
@ -2,14 +2,11 @@
|
|||
|
||||
package com.tangem.core.ui.res
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.text.selection.LocalTextSelectionColors
|
||||
import androidx.compose.foundation.text.selection.TextSelectionColors
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import com.tangem.core.ui.components.haze.ProvideHaze
|
||||
import com.tangem.core.ui.components.haze.hazeSourceTangem
|
||||
import com.tangem.core.ui.res.generated.TangemDimens3
|
||||
import com.tangem.core.ui.res.generated.TangemTypography3
|
||||
import com.tangem.core.ui.res.generated.darkColors3
|
||||
|
|
@ -55,9 +52,7 @@ fun TangemThemeRedesign(content: @Composable () -> Unit) {
|
|||
LocalTextSelectionColors provides TangemTextSelectionColors2,
|
||||
) {
|
||||
ProvideHaze {
|
||||
Box(Modifier.hazeSourceTangem(zIndex = 1f)) {
|
||||
content()
|
||||
}
|
||||
content()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue