mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
35 lines
937 B
Swift
35 lines
937 B
Swift
/*
|
|
Abstract:
|
|
A view draws a circle in the background of the shortName text
|
|
*/
|
|
|
|
import SwiftUI
|
|
|
|
struct CircleText: View {
|
|
var text: String
|
|
var color: Color
|
|
var circleSize: CGFloat? = 60
|
|
var fontSize: CGFloat? = 20
|
|
var brightness: Double? = 0
|
|
|
|
var body: some View {
|
|
|
|
let font = Font.system(size: fontSize!)
|
|
|
|
ZStack {
|
|
Circle()
|
|
.fill(color)
|
|
.brightness(brightness ?? 0)
|
|
.frame(width: circleSize, height: circleSize)
|
|
Text(text).textCase(.uppercase).font(font).foregroundColor(.white).fixedSize()
|
|
.frame(width: circleSize, height: circleSize, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/).offset(x: 0, y: 0)
|
|
}
|
|
}
|
|
}
|
|
|
|
struct CircleText_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
CircleText(text: "RDDN", color: Color.accentColor)
|
|
.previewLayout(.fixed(width: 300, height: 100))
|
|
}
|
|
}
|