mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Remove another circletext parameter
This commit is contained in:
parent
b6cfd07000
commit
06f39d40f2
7 changed files with 27 additions and 16 deletions
|
|
@ -49,7 +49,7 @@ struct Connect: View {
|
|||
if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.state == .connected {
|
||||
HStack {
|
||||
VStack(alignment: .center) {
|
||||
CircleText(text: node?.user?.shortName ?? "?", color: Color(UIColor(hex: UInt32(node?.num ?? 0))), circleSize: 90, textColor: UIColor(hex: UInt32(node?.num ?? 0)).isLight() ? .black : .white )
|
||||
CircleText(text: node?.user?.shortName ?? "?", color: Color(UIColor(hex: UInt32(node?.num ?? 0))), circleSize: 90)
|
||||
}
|
||||
.padding(.trailing)
|
||||
VStack(alignment: .leading) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ struct CircleText: View {
|
|||
var text: String
|
||||
var color: Color
|
||||
var circleSize: CGFloat = 45
|
||||
var textColor: Color? = .white
|
||||
|
||||
var body: some View {
|
||||
|
||||
|
|
@ -19,21 +18,33 @@ struct CircleText: View {
|
|||
.frame(width: circleSize, height: circleSize)
|
||||
Text(text)
|
||||
.textCase(.uppercase)
|
||||
.foregroundColor(textColor)
|
||||
.foregroundColor(color.isLight() ? .black : .white)
|
||||
.font(.system(size: 500))
|
||||
.minimumScaleFactor(0.001)
|
||||
.frame(width: circleSize * 0.90,
|
||||
height: circleSize * 0.90, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
|
||||
.frame(width: circleSize * 0.94, height: circleSize * 0.94, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct CircleText_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
CircleText(text: "MOMO", color: Color.accentColor, circleSize: 80)
|
||||
CircleText(text: "WWWW", color: Color.accentColor, circleSize: 80)
|
||||
CircleText(text: "LCP", color: Color.accentColor, circleSize: 80)
|
||||
CircleText(text: "8", color: Color.accentColor, circleSize: 80)
|
||||
.previewLayout(.fixed(width: 300, height: 100))
|
||||
VStack {
|
||||
CircleText(text: "MOMO", color: Color.secondary, circleSize: 80)
|
||||
.previewLayout(.fixed(width: 300, height: 100))
|
||||
CircleText(text: "WWWW", color: Color.accentColor, circleSize: 80)
|
||||
.previewLayout(.fixed(width: 300, height: 100))
|
||||
CircleText(text: "LCP", color: Color.primary, circleSize: 80)
|
||||
.previewLayout(.fixed(width: 300, height: 100))
|
||||
CircleText(text: "69", color: Color.green, circleSize: 80)
|
||||
.previewLayout(.fixed(width: 300, height: 100))
|
||||
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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ struct NodeInfoView: View {
|
|||
if UIDevice.current.userInterfaceIdiom == .pad || UIDevice.current.userInterfaceIdiom == .mac {
|
||||
HStack {
|
||||
VStack(alignment: .center) {
|
||||
CircleText(text: node.user?.shortName ?? "?", color: Color(UIColor(hex: UInt32(node.num))), circleSize: 150, textColor: UIColor(hex: UInt32(node.num)).isLight() ? .black : .white)
|
||||
CircleText(text: node.user?.shortName ?? "?", color: Color(UIColor(hex: UInt32(node.num))), circleSize: 150)
|
||||
}
|
||||
Divider()
|
||||
VStack {
|
||||
|
|
@ -123,7 +123,7 @@ struct NodeInfoView: View {
|
|||
HStack {
|
||||
|
||||
VStack(alignment: .center) {
|
||||
CircleText(text: node.user?.shortName ?? "?", color: Color(UIColor(hex: UInt32(node.num))), circleSize: 65, textColor: UIColor(hex: UInt32(node.num)).isLight() ? .black : .white )
|
||||
CircleText(text: node.user?.shortName ?? "?", color: Color(UIColor(hex: UInt32(node.num))), circleSize: 65)
|
||||
}
|
||||
if node.user != nil {
|
||||
Divider()
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ struct ChannelMessageList: View {
|
|||
HStack(alignment: .top) {
|
||||
if currentUser { Spacer(minLength: 50) }
|
||||
if !currentUser {
|
||||
CircleText(text: message.fromUser?.shortName ?? "?", color: Color(UIColor(hex: UInt32(message.fromUser?.num ?? 0))), circleSize: 44, textColor: UIColor(hex: UInt32(message.fromUser?.num ?? 0)).isLight() ? .black : .white)
|
||||
CircleText(text: message.fromUser?.shortName ?? "?", color: Color(UIColor(hex: UInt32(message.fromUser?.num ?? 0))), circleSize: 44)
|
||||
.padding(.all, 5)
|
||||
.offset(y: -5)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ struct UserList: View {
|
|||
.brightness(0.2)
|
||||
}
|
||||
|
||||
CircleText(text: user.shortName ?? "?", color: Color(UIColor(hex: UInt32(user.num))), textColor: UIColor(hex: UInt32(user.num)).isLight() ? .black : .white)
|
||||
CircleText(text: user.shortName ?? "?", color: Color(UIColor(hex: UInt32(user.num))))
|
||||
|
||||
VStack(alignment: .leading){
|
||||
HStack{
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ struct UserMessageList: View {
|
|||
.toolbar {
|
||||
ToolbarItem(placement: .principal) {
|
||||
HStack {
|
||||
CircleText(text: user.shortName ?? "?", color: Color(UIColor(hex: UInt32(user.num))), circleSize: 44, textColor: UIColor(hex: UInt32(user.num)).isLight() ? .black : .white)
|
||||
CircleText(text: user.shortName ?? "?", color: Color(UIColor(hex: UInt32(user.num))), circleSize: 44)
|
||||
}
|
||||
}
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ struct NodeList: View {
|
|||
LazyVStack(alignment: .leading) {
|
||||
HStack {
|
||||
VStack(alignment: .leading) {
|
||||
CircleText(text: node.user?.shortName ?? "?", color: Color(UIColor(hex: UInt32(node.num))), circleSize: 65, textColor: UIColor(hex: UInt32(node.num)).isLight() ? .black : .white)
|
||||
CircleText(text: node.user?.shortName ?? "?", color: Color(UIColor(hex: UInt32(node.num))), circleSize: 65)
|
||||
.padding(.trailing, 5)
|
||||
let deviceMetrics = node.telemetries?.filtered(using: NSPredicate(format: "metricsType == 0"))
|
||||
if deviceMetrics?.count ?? 0 >= 1 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue