Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ interface BlurStyle {
*/
val tint: Color

/**
* Кисть размытия. Если не null, то приоритетнее [tint]
*/
val tintBrush: Brush?

/**
* Интенсивность шума для имитации матового эффекта
*/
Expand All @@ -86,19 +91,23 @@ interface BlurStyle {
* @param tint цветовой оттенок, накладываемый поверх блюра
* @param noiseFactor интенсивность шума для имитации матового эффекта
* @param fallbackBackground фон, используемый при отсутствии blur
* @param tintBrush кисть для цветового оттенка, накладываемый поверх блюра.
* Если не null, то приоритетнее [tint]
*/
fun create(
shape: Shape = RectangleShape,
blurRadius: Dp = 20.dp,
tint: Color = Color.Unspecified,
noiseFactor: Float = 0f,
fallbackBackground: Brush = FallbackBackground,
tintBrush: Brush? = null,
): BlurStyle = BlurStyleImpl(
shape = shape,
blurRadius = blurRadius,
tint = tint,
noiseFactor = noiseFactor,
fallbackBackground = fallbackBackground,
tintBrush = tintBrush,
)
}
}
Expand All @@ -121,13 +130,16 @@ fun rememberBlurState(): BlurState {
* @param blurRadius радиус размытия
* @param tint цветовой оттенок, накладываемый поверх блюра
* @param fallbackBackground фон, используемый при отсутствии blur
* @param tintBrush кисть для цветового оттенка, накладываемый поверх блюра.
* Если не null, то приоритетнее [tint]
*/
@Composable
fun rememberBlurStyle(
shape: Shape = RectangleShape,
blurRadius: Dp = 20.dp,
tint: Color = Color.Unspecified,
fallbackBackground: Brush = FallbackBackground,
tintBrush: Brush? = null,
): BlurStyle {
return remember(
shape,
Expand All @@ -140,6 +152,7 @@ fun rememberBlurStyle(
blurRadius = blurRadius,
tint = tint,
fallbackBackground = fallbackBackground,
tintBrush = tintBrush,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ internal data class BlurStyleImpl(
override val tint: Color = Color.Unspecified,
override val noiseFactor: Float = 0f,
override val fallbackBackground: Brush = FallbackBackground,
override val tintBrush: Brush? = null,
) : BlurStyle

internal class HazeBlurState(val hazeState: HazeState) : BlurState
Expand Down Expand Up @@ -81,7 +82,9 @@ internal fun Modifier.applyBackgroundBlur(

private fun BlurStyle.toHazeStyle(): HazeBlurStyle =
HazeBlurStyle(
colorEffect = HazeColorEffect.tint(tint),
colorEffect = tintBrush?.let {
HazeColorEffect.tint(it)
} ?: HazeColorEffect.tint(tint),
blurRadius = blurRadius,
noiseFactor = noiseFactor,
fallbackColorEffect = HazeColorEffect.tint(fallbackBackground),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.draw.BlurredEdgeTreatment
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.geometry.isUnspecified
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Outline
Expand Down Expand Up @@ -80,7 +81,7 @@ public class BlurVisualEffect : VisualEffect {

private fun VisualEffectContext.createClipPathIfNeeded(): Path? {
val clipShape = shape
if (clipShape === RectangleShape) return null
if (clipShape === RectangleShape || size.isUnspecified) return null

val outline = clipShape.createOutline(
size = size,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public val Cell.S: WrapperCellS
.titleStyle(PlasmaHomeDsTheme.typography.bodySNormal)
.subtitleStyle(PlasmaHomeDsTheme.typography.bodyXsNormal)
.disclosureTextStyle(PlasmaHomeDsTheme.typography.bodyXsNormal)
.disclosureIcon(com.sdds.icons.R.drawable.ic_disclosure_right_outline_16)
.disclosureIcon(com.sdds.icons.R.drawable.ic_disclosure_right_outline_24)
.dimensions {
contentPaddingStart(6.0.dp)
contentPaddingEnd(6.0.dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ public object DarkColorTokens {
/**
* Основной прозрачный фон поверхности/контрола
*/
public val SurfaceDefaultTransparentPrimary: Color = Color(0x0FFFFFFF)
public val SurfaceDefaultTransparentPrimary: Color = Color(0x0FF9F9F9)

/**
* Основной прозрачный фон поверхности/контрола
Expand Down
Loading