Skip to content

Commit 3ecfa56

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feat/on-chain-messaging
* origin/develop: feat: improve bill rendering (images)
2 parents 76f58af + f3ad072 commit 3ecfa56

7 files changed

Lines changed: 162 additions & 118 deletions

File tree

app/src/main/java/com/getcode/ui/utils/Modifier.kt

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ import androidx.compose.ui.ExperimentalComposeUiApi
1414
import androidx.compose.ui.Modifier
1515
import androidx.compose.ui.composed
1616
import androidx.compose.ui.draw.drawBehind
17+
import androidx.compose.ui.draw.drawWithContent
1718
import androidx.compose.ui.geometry.Offset
19+
import androidx.compose.ui.graphics.BlendMode
1820
import androidx.compose.ui.graphics.Color
1921
import androidx.compose.ui.graphics.RectangleShape
2022
import androidx.compose.ui.graphics.Shape
@@ -58,7 +60,8 @@ fun Modifier.unboundedClickable(
5860
}
5961

6062

61-
fun Modifier.debugBounds(color: Color = Color.Magenta, shape: Shape = RectangleShape) = this.border(1.dp, color, shape)
63+
fun Modifier.debugBounds(color: Color = Color.Magenta, shape: Shape = RectangleShape) =
64+
this.border(1.dp, color, shape)
6265

6366
fun Modifier.rememberedClickable(
6467
enabled: Boolean = true,
@@ -155,9 +158,30 @@ fun Modifier.circleBackground(color: Color, padding: Dp): Modifier {
155158
// Assign the dimension and the center position
156159
layout(newDiameter, newDiameter) {
157160
// Place the composable at the calculated position
158-
placeable.placeRelative((newDiameter - currentWidth) / 2, (newDiameter - currentHeight) / 2)
161+
placeable.placeRelative(
162+
(newDiameter - currentWidth) / 2,
163+
(newDiameter - currentHeight) / 2
164+
)
159165
}
160166
}
161167

162168
return this then backgroundModifier then layoutModifier
169+
}
170+
171+
fun Modifier.punchRectangle(color: Color) = this.drawWithContent {
172+
drawRect(
173+
color,
174+
blendMode = BlendMode.Src
175+
)
176+
177+
drawContent()
178+
}
179+
180+
fun Modifier.punchCircle(color: Color) = this.drawWithContent {
181+
drawCircle(
182+
color,
183+
blendMode = BlendMode.Src
184+
)
185+
186+
drawContent()
163187
}

0 commit comments

Comments
 (0)