This commit is contained in:
Trey t
2025-12-09 23:37:04 -06:00
parent 3a10b4b8d6
commit f2565678be
1587 changed files with 7747 additions and 647 deletions

View File

@@ -0,0 +1,95 @@
//
// Shapes.swift
// Feels
//
// Created by Trey Tartt on 3/20/22.
//
import SwiftUI
enum BGShape: Int, CaseIterable {
case circle
case diamond
case rectangle
case roundedRectangle
func view(withText text: Text, bgColor: Color, textColor: Color) -> some View{
return AnyView(
ZStack {
switch self {
case .circle:
Circle()
.fill(bgColor)
.frame(minWidth: 5,
maxWidth: 500,
minHeight: 5,
maxHeight: 500,
alignment: .center)
.overlay(
text
.font(.title2)
.fontWeight(.bold)
.lineLimit(1)
.foregroundColor(textColor)
.minimumScaleFactor(0.2)
.padding(10)
.frame(maxWidth: .infinity, alignment: .center)
)
case .diamond:
Diamond()
.fill(bgColor)
.frame(minWidth: 5,
maxWidth: 500,
minHeight: 5,
maxHeight: 500)
.aspectRatio(contentMode: .fit)
.overlay(
text
.font(.title2)
.fontWeight(.bold)
.lineLimit(1)
.foregroundColor(textColor)
.minimumScaleFactor(0.2)
.padding(10)
.frame(maxWidth: .infinity, alignment: .center)
)
case .rectangle:
Rectangle()
.fill(bgColor)
.frame(minWidth: 5,
maxWidth: 500,
minHeight: 5,
maxHeight: 500,
alignment: .center)
.overlay(
text
.font(.title2)
.fontWeight(.bold)
.lineLimit(1)
.foregroundColor(textColor)
.minimumScaleFactor(0.2)
.padding(10)
.frame(maxWidth: .infinity, alignment: .center)
)
case .roundedRectangle:
RoundedRectangle(cornerRadius: 8, style: .continuous)
.fill(bgColor)
.frame(minWidth: 5,
maxWidth: 500,
minHeight: 5,
maxHeight: 500,
alignment: .center)
.overlay(
text
.font(.title2)
.fontWeight(.bold)
.lineLimit(1)
.foregroundColor(textColor)
.minimumScaleFactor(0.2)
.padding(10)
.frame(maxWidth: .infinity, alignment: .center)
)
}
})
}
}