2021-09-14 21:38:12 -07:00
|
|
|
/*
|
|
|
|
|
Abstract:
|
2021-09-18 15:33:35 -07:00
|
|
|
A view draws a circle in the background of the shortName text
|
2021-09-14 21:38:12 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import SwiftUI
|
2025-04-01 23:57:37 -07:00
|
|
|
import CoreData
|
2021-09-14 21:38:12 -07:00
|
|
|
|
|
|
|
|
struct CircleText: View {
|
2025-04-01 23:57:37 -07:00
|
|
|
var text: String
|
|
|
|
|
var color: Color
|
2023-09-02 09:23:20 -07:00
|
|
|
var circleSize: CGFloat = 45
|
2025-04-27 14:04:47 -07:00
|
|
|
|
2025-04-01 23:57:37 -07:00
|
|
|
var body: some View {
|
2025-09-13 20:40:02 -07:00
|
|
|
circleContent
|
2025-04-01 23:57:37 -07:00
|
|
|
}
|
2024-05-29 16:40:07 -05:00
|
|
|
|
2025-04-01 23:57:37 -07:00
|
|
|
var circleContent: some View {
|
|
|
|
|
ZStack {
|
|
|
|
|
Circle()
|
|
|
|
|
.fill(color)
|
|
|
|
|
.frame(width: circleSize, height: circleSize)
|
|
|
|
|
Text(text)
|
2024-05-31 20:25:37 -07:00
|
|
|
.frame(width: circleSize * 0.9, height: circleSize * 0.9, alignment: .center)
|
2023-09-02 18:02:51 -07:00
|
|
|
.foregroundColor(color.isLight() ? .black : .white)
|
2024-05-28 13:27:25 -07:00
|
|
|
.minimumScaleFactor(0.001)
|
2024-05-31 20:39:45 -07:00
|
|
|
.font(.system(size: 1300))
|
2025-04-01 23:57:37 -07:00
|
|
|
}
|
|
|
|
|
}
|
2021-09-14 21:38:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct CircleText_Previews: PreviewProvider {
|
2025-04-01 23:57:37 -07:00
|
|
|
static var previews: some View {
|
2024-04-26 08:18:49 -07:00
|
|
|
VStack {
|
|
|
|
|
HStack {
|
2023-10-21 15:33:00 -07:00
|
|
|
CircleText(text: "N1", color: Color.yellow, circleSize: 80)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
|
|
|
|
CircleText(text: "8", color: Color.purple, circleSize: 80)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
|
|
|
|
CircleText(text: "😝", color: Color.red, circleSize: 80)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
|
|
|
|
CircleText(text: "🍔", color: Color.brown, circleSize: 80)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
2024-04-26 08:18:49 -07:00
|
|
|
}
|
|
|
|
|
HStack {
|
2023-10-21 15:33:00 -07:00
|
|
|
CircleText(text: "👻", color: Color.orange, circleSize: 80)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
|
|
|
|
CircleText(text: "🤙", color: Color.orange, circleSize: 80)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
|
|
|
|
CircleText(text: "69", color: Color.green, circleSize: 80)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
|
|
|
|
CircleText(text: "WWWW", color: Color.cyan, circleSize: 80)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
2024-04-26 08:18:49 -07:00
|
|
|
}
|
|
|
|
|
HStack {
|
2024-05-29 16:40:07 -05:00
|
|
|
|
2023-10-21 15:33:00 -07:00
|
|
|
CircleText(text: "CW-A", color: Color.secondary)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
|
|
|
|
CircleText(text: "CW-A", color: Color.secondary, circleSize: 80)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
|
|
|
|
CircleText(text: "MOMO", color: Color.mint, circleSize: 80)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
|
|
|
|
CircleText(text: "IIII", color: Color.accentColor, circleSize: 80)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
2024-04-26 08:18:49 -07:00
|
|
|
}
|
|
|
|
|
HStack {
|
2024-05-29 16:40:07 -05:00
|
|
|
|
2024-04-26 08:18:49 -07:00
|
|
|
CircleText(text: "🚗", color: Color.orange)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
|
|
|
|
CircleText(text: "🔋", color: Color.indigo, circleSize: 80)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
|
|
|
|
CircleText(text: "🛢️", color: Color.orange, circleSize: 80)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
|
|
|
|
CircleText(text: "LCP", color: Color.indigo, circleSize: 80)
|
|
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
|
|
|
|
}
|
|
|
|
|
HStack {
|
|
|
|
|
CircleText(text: "🤡", color: Color.red, circleSize: 80)
|
2023-10-21 15:33:00 -07:00
|
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
|
|
|
|
}
|
2023-09-02 18:02:51 -07:00
|
|
|
}
|
2025-04-01 23:57:37 -07:00
|
|
|
}
|
2021-09-14 21:38:12 -07:00
|
|
|
}
|