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 {
|
||||
|
||||
Reference in New Issue
Block a user