@momo-kits/native-kits 0.153.1-beta.3 → 0.153.1-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/Badge/BadgeRibbon.swift +77 -9
- package/local.properties +8 -0
- package/package.json +1 -1
|
@@ -1,5 +1,74 @@
|
|
|
1
1
|
import SwiftUI
|
|
2
2
|
|
|
3
|
+
// MARK: - Custom Shape for Rounded Corners
|
|
4
|
+
struct RoundedCorners: Shape {
|
|
5
|
+
var topLeft: CGFloat = 0.0
|
|
6
|
+
var topRight: CGFloat = 0.0
|
|
7
|
+
var bottomLeft: CGFloat = 0.0
|
|
8
|
+
var bottomRight: CGFloat = 0.0
|
|
9
|
+
|
|
10
|
+
func path(in rect: CGRect) -> Path {
|
|
11
|
+
var path = Path()
|
|
12
|
+
|
|
13
|
+
let width = rect.size.width
|
|
14
|
+
let height = rect.size.height
|
|
15
|
+
|
|
16
|
+
// Start from top left
|
|
17
|
+
path.move(to: CGPoint(x: topLeft, y: 0))
|
|
18
|
+
|
|
19
|
+
// Top edge and top right corner
|
|
20
|
+
path.addLine(to: CGPoint(x: width - topRight, y: 0))
|
|
21
|
+
if topRight > 0 {
|
|
22
|
+
path.addArc(
|
|
23
|
+
center: CGPoint(x: width - topRight, y: topRight),
|
|
24
|
+
radius: topRight,
|
|
25
|
+
startAngle: Angle(degrees: -90),
|
|
26
|
+
endAngle: Angle(degrees: 0),
|
|
27
|
+
clockwise: false
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Right edge and bottom right corner
|
|
32
|
+
path.addLine(to: CGPoint(x: width, y: height - bottomRight))
|
|
33
|
+
if bottomRight > 0 {
|
|
34
|
+
path.addArc(
|
|
35
|
+
center: CGPoint(x: width - bottomRight, y: height - bottomRight),
|
|
36
|
+
radius: bottomRight,
|
|
37
|
+
startAngle: Angle(degrees: 0),
|
|
38
|
+
endAngle: Angle(degrees: 90),
|
|
39
|
+
clockwise: false
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Bottom edge and bottom left corner
|
|
44
|
+
path.addLine(to: CGPoint(x: bottomLeft, y: height))
|
|
45
|
+
if bottomLeft > 0 {
|
|
46
|
+
path.addArc(
|
|
47
|
+
center: CGPoint(x: bottomLeft, y: height - bottomLeft),
|
|
48
|
+
radius: bottomLeft,
|
|
49
|
+
startAngle: Angle(degrees: 90),
|
|
50
|
+
endAngle: Angle(degrees: 180),
|
|
51
|
+
clockwise: false
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Left edge and top left corner
|
|
56
|
+
path.addLine(to: CGPoint(x: 0, y: topLeft))
|
|
57
|
+
if topLeft > 0 {
|
|
58
|
+
path.addArc(
|
|
59
|
+
center: CGPoint(x: topLeft, y: topLeft),
|
|
60
|
+
radius: topLeft,
|
|
61
|
+
startAngle: Angle(degrees: 180),
|
|
62
|
+
endAngle: Angle(degrees: 270),
|
|
63
|
+
clockwise: false
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
path.closeSubpath()
|
|
68
|
+
return path
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
3
72
|
public enum RibbonPosition {
|
|
4
73
|
case topLeft
|
|
5
74
|
case topRight
|
|
@@ -76,14 +145,13 @@ public struct BadgeRibbon: View {
|
|
|
76
145
|
.frame(height: RibbonConstants.roundHeight)
|
|
77
146
|
.padding(.trailing, RibbonConstants.roundPaddingEnd)
|
|
78
147
|
.background(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
)
|
|
148
|
+
RoundedCorners(
|
|
149
|
+
topLeft: 0,
|
|
150
|
+
topRight: RibbonConstants.roundRightRadius,
|
|
151
|
+
bottomLeft: 0,
|
|
152
|
+
bottomRight: RibbonConstants.roundRightRadius
|
|
153
|
+
)
|
|
154
|
+
.fill(backgroundColor)
|
|
87
155
|
)
|
|
88
156
|
}
|
|
89
157
|
|
|
@@ -139,7 +207,7 @@ private struct RibbonConstants {
|
|
|
139
207
|
static let ribbonHeight: CGFloat = 20
|
|
140
208
|
static let roundHeight: CGFloat = 16
|
|
141
209
|
static let skewBodyHeight: CGFloat = 16
|
|
142
|
-
static let roundRightRadius: CGFloat =
|
|
210
|
+
static let roundRightRadius: CGFloat = 8
|
|
143
211
|
static let roundPaddingEnd: CGFloat = 6
|
|
144
212
|
static let skewTailWidth: CGFloat = 8
|
|
145
213
|
static let skewTailHeight: CGFloat = 16
|
package/local.properties
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## This file must *NOT* be checked into Version Control Systems,
|
|
2
|
+
# as it contains information specific to your local configuration.
|
|
3
|
+
#
|
|
4
|
+
# Location of the SDK. This is only used by Gradle.
|
|
5
|
+
# For customization when using a Version Control System, please read the
|
|
6
|
+
# header note.
|
|
7
|
+
#Thu Jan 09 10:43:10 ICT 2025
|
|
8
|
+
sdk.dir=/Users/sophia/Library/Android/sdk
|