Meshtastic-Apple/MeshtasticApple/Views/Helpers/CircleText.swift
Garth Vander Houwen 9396383ade Update protos
2022-06-15 16:49:51 -07:00

33 lines
875 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 body: some View {
let font = Font.system(size: fontSize!)
ZStack {
Circle()
.fill(color)
.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))
}
}