add customize onboarding views

make tab bar text color selected text color
This commit is contained in:
Trey t
2022-04-05 23:46:01 -05:00
parent 6fa4e2db26
commit 9bf6190bab
12 changed files with 272 additions and 71 deletions

View File

@@ -0,0 +1,74 @@
//
// OnboardingCustomizeOne.swift
// Feels (iOS)
//
// Created by Trey Tartt on 4/5/22.
//
import SwiftUI
struct OnboardingCustomizeOne: View {
@ObservedObject var onboardingData: OnboardingData
var formatter: DateFormatter {
let dateFormatter = DateFormatter()
dateFormatter.timeStyle = .short
return dateFormatter
}
var body: some View {
ZStack {
GeometryReader { geometry in
VStack {
Spacer()
Image("average", bundle: .main)
.foregroundColor(Color(UIColor.darkText))
.opacity(0.04)
.scaleEffect(1.2, anchor: .trailing)
Spacer()
}
ScrollView {
VStack(alignment: .leading) {
Text(String(localized: "onboarding_title_customize_one_title"))
.font(.title)
.padding()
.fixedSize(horizontal: false, vertical: true)
.foregroundColor(Color(UIColor.white))
Text(String(localized: "onboarding_title_customize_one_section_one_title"))
.font(.title3)
.fixedSize(horizontal: false, vertical: true)
.padding()
.foregroundColor(Color(UIColor.white))
.multilineTextAlignment(.leading)
IconPickerView()
Text(String(localized: "onboarding_title_customize_one_section_two_title"))
.font(.title3)
.padding()
.fixedSize(horizontal: false, vertical: true)
.foregroundColor(Color(UIColor.white))
DayFilterPickerView()
Text(String(localized: "onboarding_title_customize_one_section_two_note"))
.font(.title3)
.padding()
.fixedSize(horizontal: false, vertical: true)
.foregroundColor(Color(UIColor.white))
}
}
.padding()
}
}
.background(Color(hex: "0b84ff"))
}
}
struct OnboardingCustomizeOne_Previews: PreviewProvider {
static var previews: some View {
OnboardingCustomizeOne(onboardingData: OnboardingData())
}
}

View File

@@ -0,0 +1,82 @@
//
// OnboardingCustomizeTwo.swift
// Feels (iOS)
//
// Created by Trey Tartt on 4/5/22.
//
import SwiftUI
struct OnboardingCustomizeTwo: View {
@ObservedObject var onboardingData: OnboardingData
var formatter: DateFormatter {
let dateFormatter = DateFormatter()
dateFormatter.timeStyle = .short
return dateFormatter
}
var body: some View {
ZStack {
GeometryReader { geometry in
VStack {
Spacer()
Image("bad", bundle: .main)
.foregroundColor(Color(UIColor.darkText))
.opacity(0.04)
.scaleEffect(1.2, anchor: .trailing)
Spacer()
}
VStack {
SampleEntryView()
.padding([.top])
ScrollView {
VStack(alignment: .leading) {
Text(String(localized: "onboarding_title_customize_two_title"))
.font(.title)
.padding()
.fixedSize(horizontal: false, vertical: true)
.foregroundColor(Color(UIColor.white))
Text(String(localized: "onboarding_title_customize_two_section_one_title"))
.font(.title3)
.padding()
.fixedSize(horizontal: false, vertical: true)
.foregroundColor(Color(UIColor.white))
ImagePackPickerView()
Text(String(localized: "onboarding_title_customize_two_section_two_title"))
.font(.title3)
.padding()
.fixedSize(horizontal: false, vertical: true)
.foregroundColor(Color(UIColor.white))
TintPickerView()
Text(String(localized: "onboarding_title_customize_two_section_three_title"))
.font(.title3)
.padding()
.fixedSize(horizontal: false, vertical: true)
.foregroundColor(Color(UIColor.white))
TextColorPickerView()
}
}
}
.padding()
}
}
.background(Color(hex: "ff9e0b"))
}
}
struct OnboardingCustomizeTwo_Previews: PreviewProvider {
static var previews: some View {
OnboardingCustomizeTwo(onboardingData: OnboardingData())
}
}

View File

@@ -39,7 +39,7 @@ struct OnboardingDay: View {
GeometryReader { geometry in
VStack {
Spacer()
Image("average", bundle: .main)
Image("good", bundle: .main)
.foregroundColor(Color(UIColor.darkText))
.opacity(0.04)
.scaleEffect(1.2, anchor: .trailing)
@@ -47,12 +47,12 @@ struct OnboardingDay: View {
}
ScrollView {
VStack{
VStack(alignment: .leading) {
Text(String(localized: "onboarding_day_title"))
.font(.title)
.padding()
.fixedSize(horizontal: false, vertical: true)
.foregroundColor(Color(UIColor.white))
.foregroundColor(.black)
Picker(selection: $onboardingData.inputDay,
@@ -62,21 +62,20 @@ struct OnboardingDay: View {
}
}
.padding()
.colorScheme(.dark)
.padding([.trailing, .leading], 55)
.pickerStyle(SegmentedPickerStyle())
Text(previewText)
.font(.body)
.font(.title3)
.padding()
.fixedSize(horizontal: false, vertical: true)
.foregroundColor(Color(UIColor.white))
.foregroundColor(.black)
}
.frame(maxWidth: geometry.size.width)
}
.padding()
}
}
.background(.blue)
.background(Color(hex: "ffd709"))
}
}

View File

@@ -19,6 +19,10 @@ struct OnboardingMain: View {
OnboardingDay(onboardingData: onboardingData)
OnboardingCustomizeOne(onboardingData: onboardingData)
OnboardingCustomizeTwo(onboardingData: onboardingData)
// OnboardingTitle(onboardingData: onboardingData)
OnboardingWrapup(onboardingData: onboardingData,

View File

@@ -19,7 +19,7 @@ struct OnboardingTime: View {
var body: some View {
ZStack {
GeometryReader { geometry in
VStack {
VStack(alignment: .leading) {
Spacer()
Image("great", bundle: .main)
.foregroundColor(Color(UIColor.darkText))
@@ -30,35 +30,32 @@ struct OnboardingTime: View {
ScrollView {
VStack {
Text(String(localized: "onboarding_time_title"))
.font(.title)
.padding()
.fixedSize(horizontal: false, vertical: true)
.foregroundColor(Color(UIColor.white))
DatePicker("", selection: $onboardingData.date,
displayedComponents: .hourAndMinute)
.scaleEffect(2)
.labelsHidden()
.frame(minWidth: 0, maxWidth: .infinity)
Text(String(localized: "onboarding_time_title"))
.font(.title)
.padding()
.padding([.top, .bottom], 25)
.colorScheme(.dark)
Text(String(format: String(localized: "onboarding_time_body"),
formatter.string(from: onboardingData.date)))
.font(.body)
.fixedSize(horizontal: false, vertical: true)
.padding()
.foregroundColor(Color(UIColor.white))
}
.frame(maxWidth: geometry.size.width)
DatePicker("", selection: $onboardingData.date,
displayedComponents: .hourAndMinute)
.scaleEffect(2)
.labelsHidden()
.frame(minWidth: 0, maxWidth: .infinity)
.padding()
.padding([.top, .bottom], 25)
.colorScheme(.dark)
Text(String(format: String(localized: "onboarding_time_body"),
formatter.string(from: onboardingData.date)))
.font(.title3)
.fixedSize(horizontal: false, vertical: true)
.padding()
.foregroundColor(Color(UIColor.white))
}
.padding()
}
}
.background(.green)
.background(Color(hex: "31d158"))
}
}

View File

@@ -23,7 +23,7 @@ struct OnboardingWrapup: View {
GeometryReader { geometry in
VStack {
Spacer()
Image("good", bundle: .main)
Image("horrible", bundle: .main)
.foregroundColor(Color(UIColor.darkText))
.opacity(0.04)
.scaleEffect(1.2, anchor: .trailing)
@@ -78,7 +78,7 @@ struct OnboardingWrapup: View {
.frame(maxWidth: geometry.size.width)
}
}
.background(.yellow)
.background(Color(hex: "ff453a"))
}
}

View File

@@ -9,9 +9,8 @@ import SwiftUI
struct CustomizeView: View {
@State private var showSettings = false
@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 {
@@ -22,7 +21,7 @@ struct CustomizeView: View {
IconPickerView()
ThemePickerView()
Divider()
sampleEntryView
SampleEntryView()
ImagePackPickerView()
}
Group {
@@ -62,39 +61,6 @@ struct CustomizeView: View {
}).padding(.trailing)
}
}
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 {

View File

@@ -11,9 +11,12 @@ struct ImagePackPickerView: View {
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
@AppStorage(UserDefaultsStore.Keys.moodImages.rawValue, store: GroupUserDefaults.groupDefaults) private var imagePack: MoodImages = .FontAwesome
@AppStorage(UserDefaultsStore.Keys.customMoodTintUpdateNumber.rawValue, store: GroupUserDefaults.groupDefaults) private var customMoodTintUpdateNumber: Int = 0
var body: some View {
ZStack {
Text(String(customMoodTintUpdateNumber))
.hidden()
theme.currentTheme.secondaryBGColor
VStack {
ForEach(MoodImages.allCases, id: \.rawValue) { images in

View File

@@ -11,6 +11,8 @@ struct MainTabView: View {
@AppStorage(UserDefaultsStore.Keys.needsOnboarding.rawValue, store: GroupUserDefaults.groupDefaults) private var needsOnboarding = true
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = DefaultTextColor.textColor
let onboardingData = OnboardingDataDataManager.shared.savedOnboardingData
@@ -41,7 +43,7 @@ struct MainTabView: View {
Label(String(localized: "content_view_tab_customize"), systemImage: "pencil")
}
}
.accentColor(moodTint.color(forMood: .average))
.accentColor(textColor)
.sheet(isPresented: $needsOnboarding, onDismiss: { }, content: {
OnboardingMain(onboardingData: onboardingData,
updateBoardingDataClosure: { onboardingData in

View File

@@ -0,0 +1,51 @@
//
// SampleEntryView.swift
// Feels (iOS)
//
// Created by Trey Tartt on 4/5/22.
//
import SwiftUI
struct SampleEntryView: 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 {
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 SampleEntryView_Previews: PreviewProvider {
static var previews: some View {
SampleEntryView()
}
}