add filter days to cusomize page
This commit is contained in:
@@ -31,12 +31,17 @@ struct CustomizeView: View {
|
||||
|
||||
@State var shapeRefreshToggleThing: Bool = false
|
||||
|
||||
class StupidAssCustomWidgetObservableObject: ObservableObject {
|
||||
@Published var fuckingWrapped: CustomWidgetModel? = nil
|
||||
@Published var showFuckingSheet = false
|
||||
}
|
||||
|
||||
@StateObject private var selectedWidget = StupidAssCustomWidgetObservableObject()
|
||||
|
||||
@StateObject private var daysFilter = DaysFilterClass()
|
||||
|
||||
let weekdays = [("Sun", 1),
|
||||
("mon", 2),
|
||||
("tue", 3),
|
||||
("wed", 4),
|
||||
("thur", 5),
|
||||
("fri", 6),
|
||||
("sat", 7)]
|
||||
|
||||
let iconSets: [(String,String)] = [
|
||||
("AppIconGoodImage", "AppIconGood"),
|
||||
@@ -64,6 +69,8 @@ struct CustomizeView: View {
|
||||
pickTextColor
|
||||
}
|
||||
Divider()
|
||||
dayFilterView
|
||||
Divider()
|
||||
shapePicker
|
||||
Divider()
|
||||
pickPeronsalityPack
|
||||
@@ -513,6 +520,31 @@ struct CustomizeView: View {
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(10, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
}
|
||||
|
||||
private var dayFilterView: some View {
|
||||
ZStack {
|
||||
theme.currentTheme.secondaryBGColor
|
||||
HStack {
|
||||
ForEach(weekdays.indices, id: \.self) { dayIdx in
|
||||
let day = String(weekdays[dayIdx].0)
|
||||
let value = weekdays[dayIdx].1
|
||||
|
||||
Button(day.capitalized, action: {
|
||||
if daysFilter.currentFilters.contains(value) {
|
||||
daysFilter.removeFilter(filter: value)
|
||||
} else {
|
||||
daysFilter.addFilter(newFilter: value)
|
||||
}
|
||||
})
|
||||
.frame(maxWidth: .infinity)
|
||||
.foregroundColor(daysFilter.currentFilters.contains(value) ? .green : .red)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.cornerRadius(10, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
||||
}
|
||||
}
|
||||
|
||||
struct CustomizeView_Previews: PreviewProvider {
|
||||
|
||||
@@ -9,7 +9,6 @@ import SwiftUI
|
||||
import CoreData
|
||||
|
||||
struct YearView: View {
|
||||
let weekdays = [("Sun", 1), ("mon", 2), ("tue", 3), ("wed", 4), ("thur", 5), ("fri", 6), ("sat", 7)]
|
||||
let months = [(0, "J"), (1, "F"), (2,"M"), (3,"A"), (4,"M"), (5, "J"), (6,"J"), (7,"A"), (8,"S"), (9,"O"), (10, "N"), (11,"D")]
|
||||
|
||||
@State private var toggle = true
|
||||
|
||||
Reference in New Issue
Block a user