Files
Reflect/Shared/views/CustomizeView/CustomizeView.swift
Trey t 682f62fa4a separate all customize views into their own files
make corner radius a constant
create the views in the main app file and pass through so they dont get re-drawn when changing UI things
2022-04-02 10:53:04 -05:00

92 lines
2.8 KiB
Swift

//
// CustomizeView.swift
// Feels (iOS)
//
// Created by Trey Tartt on 2/19/22.
//
import SwiftUI
struct CustomizeView: View {
@State private var sampleListEntry = PersistenceController.shared.randomEntries(count: 1).first!
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = DefaultTextColor.textColor
var body: some View {
ScrollView {
VStack {
Group {
CustomWigetView()
IconPickerView()
ThemePickerView()
Divider()
sampleEntryView
ImagePackPickerView()
}
Group {
TintPickerView()
TextColorPickerView()
}
Divider()
DayFilterPickerView()
Divider()
ShapePickerView()
Divider()
PersonalityPackPickerView()
}
}
.onAppear(perform: {
EventLogger.log(event: "show_customize_view")
})
.padding()
.background(
theme.currentTheme.bg
.edgesIgnoringSafeArea(.all)
)
}
private var sampleEntryView: some View {
ZStack {
theme.currentTheme.secondaryBGColor
VStack {
HStack {
Spacer()
Image(systemName: "arrow.triangle.2.circlepath.circle")
.resizable()
.frame(width: 20, height: 20, alignment: .trailing)
.foregroundColor(Color(UIColor.systemGray))
.onTapGesture {
sampleListEntry = PersistenceController.shared.randomEntries(count: 1).first!
}
}
Spacer()
}.padding()
VStack(alignment:.leading) {
Text(String(localized: "customize_view_view_example_row"))
.padding([.leading, .top])
.foregroundColor(textColor)
Divider()
EntryListView(entry: sampleListEntry)
.padding()
}
}
.fixedSize(horizontal: false, vertical: true)
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
}
}
struct CustomizeView_Previews: PreviewProvider {
static var previews: some View {
Group {
CustomizeView()
CustomizeView()
.preferredColorScheme(.dark)
}
}
}