add shape picker for backgrounds

This commit is contained in:
Trey t
2022-03-20 02:45:51 -05:00
parent d064cdb3d9
commit 36a688084c
14 changed files with 247 additions and 91 deletions

View File

@@ -17,6 +17,8 @@ struct HeaderPercView: View {
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
@AppStorage(UserDefaultsStore.Keys.shape.rawValue, store: GroupUserDefaults.groupDefaults) private var shape: BGShape = .circle
@State private var entries = [MoodMetrics]()
let backDays: Int
let type: PercViewType
@@ -75,23 +77,19 @@ struct HeaderPercView: View {
Spacer()
HStack {
ForEach(entries.prefix(3), id: \.id) { model in
Text("\(model.percent, specifier: "%.0f")%")
.font(.title2)
.fontWeight(.bold)
.padding()
.background(Circle().fill(moodTint.color(forMood: model.mood)))
.frame(maxWidth: .infinity)
shape.view(withText: Text("\(model.percent, specifier: "%.0f")%"),
bgColor: moodTint.color(forMood: model.mood),
textColor: textColor)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
Spacer()
HStack {
ForEach(entries.suffix(2), id: \.id) { model in
Text("\(model.percent, specifier: "%.0f")%")
.font(.title2)
.fontWeight(.bold)
.padding()
.background(Circle().fill(moodTint.color(forMood: model.mood)))
.frame(maxWidth: .infinity)
shape.view(withText: Text("\(model.percent, specifier: "%.0f")%"),
bgColor: moodTint.color(forMood: model.mood),
textColor: textColor)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
Spacer()