Skip to content

Commit 14339e5

Browse files
committed
chore: remove composed attribute
1 parent 5e3256a commit 14339e5

File tree

1 file changed

+28
-31
lines changed

1 file changed

+28
-31
lines changed

app/src/main/java/to/bitkit/ui/shared/util/Modifiers.kt

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import androidx.compose.ui.graphics.Shape
2828
import androidx.compose.ui.graphics.drawscope.clipPath
2929
import androidx.compose.ui.graphics.graphicsLayer
3030
import androidx.compose.ui.input.pointer.pointerInput
31-
import androidx.compose.ui.platform.LocalDensity
3231
import androidx.compose.ui.unit.Dp
3332
import androidx.compose.ui.unit.dp
3433
import to.bitkit.ui.theme.Colors
@@ -101,41 +100,39 @@ fun Modifier.innerShadow(
101100
color: Color,
102101
blurRadius: Dp = 4.dp,
103102
shape: Shape,
104-
): Modifier = composed {
105-
val density = LocalDensity.current
106-
val blurRadiusPx = with(density) { blurRadius.toPx() }
103+
): Modifier = this.drawWithContent {
104+
// Draw content first (gradient, etc)
105+
drawContent()
107106

108-
this.drawWithContent {
109-
// Draw content first (gradient, etc)
110-
drawContent()
107+
// Convert blur radius to pixels using DrawScope's density
108+
val blurRadiusPx = blurRadius.toPx()
111109

112-
// Get shape outline for clipping
113-
val outline = shape.createOutline(size, layoutDirection, density)
110+
// Get shape outline for clipping
111+
val outline = shape.createOutline(size, layoutDirection, this)
114112

115-
// Convert outline to path
116-
val path = when (outline) {
117-
is Outline.Rectangle -> Path().apply { addRect(outline.rect) }
118-
is Outline.Rounded -> Path().apply { addRoundRect(outline.roundRect) }
119-
is Outline.Generic -> outline.path
120-
}
113+
// Convert outline to path
114+
val path = when (outline) {
115+
is Outline.Rectangle -> Path().apply { addRect(outline.rect) }
116+
is Outline.Rounded -> Path().apply { addRoundRect(outline.roundRect) }
117+
is Outline.Generic -> outline.path
118+
}
121119

122-
// Clip to shape and draw top edge highlight with soft gradient
123-
clipPath(path) {
124-
drawRect(
125-
brush = Brush.verticalGradient(
126-
colors = listOf(
127-
color,
128-
color.copy(alpha = color.alpha * 0.7f),
129-
color.copy(alpha = color.alpha * 0.3f),
130-
Color.Transparent
131-
),
132-
startY = 0f,
133-
endY = blurRadiusPx * 2.5f
120+
// Clip to shape and draw top edge highlight with soft gradient
121+
clipPath(path) {
122+
drawRect(
123+
brush = Brush.verticalGradient(
124+
colors = listOf(
125+
color,
126+
color.copy(alpha = color.alpha * 0.7f),
127+
color.copy(alpha = color.alpha * 0.3f),
128+
Color.Transparent
134129
),
135-
topLeft = Offset(0f, 0f),
136-
size = Size(size.width, blurRadiusPx * 2.5f)
137-
)
138-
}
130+
startY = 0f,
131+
endY = blurRadiusPx * 2.5f
132+
),
133+
topLeft = Offset(0f, 0f),
134+
size = Size(size.width, blurRadiusPx * 2.5f)
135+
)
139136
}
140137
}
141138

0 commit comments

Comments
 (0)