add bg color to theme

fix tapping on main view empty space not working
update charts
This commit is contained in:
Trey t
2022-02-23 10:26:49 -06:00
parent d88c4e7a05
commit 7ecd104871
4 changed files with 46 additions and 18 deletions

View File

@@ -6,7 +6,7 @@
"repositoryURL": "https://github.com/akatreyt/ChartsPackage", "repositoryURL": "https://github.com/akatreyt/ChartsPackage",
"state": { "state": {
"branch": "master", "branch": "master",
"revision": "e55fef3e8c294d5c2b25014d6d0734760b3ca6fa", "revision": "ab1aa4f8ade9540e9d2f19f7cb8b8e6ac0c2a8fd",
"version": null "version": null
} }
}, },

View File

@@ -48,12 +48,17 @@ enum Theme: Int, CaseIterable {
protocol Themeable { protocol Themeable {
static var title: String { get } static var title: String { get }
var secondaryBGColor: Color { get } var secondaryBGColor: Color { get }
var bgColor: Color { get }
var bg: AnyView { get } var bg: AnyView { get }
var preview: AnyView { get } var preview: AnyView { get }
var labelColor: Color { get } var labelColor: Color { get }
} }
struct IFeelTheme: Themeable { struct IFeelTheme: Themeable {
var bgColor: Color {
return Color(uiColor: UIColor.systemBackground)
}
var labelColor: Color { var labelColor: Color {
return Color(uiColor: UIColor.label) return Color(uiColor: UIColor.label)
} }
@@ -63,7 +68,7 @@ struct IFeelTheme: Themeable {
} }
var secondaryBGColor: Color { var secondaryBGColor: Color {
return Color(uiColor: UIColor.systemBackground) return Color(uiColor: UIColor.secondarySystemBackground)
} }
var bg: AnyView { var bg: AnyView {
@@ -84,6 +89,10 @@ struct IFeelTheme: Themeable {
} }
struct SystemTheme: Themeable { struct SystemTheme: Themeable {
var bgColor: Color {
return Color(uiColor: UIColor.systemBackground)
}
var labelColor: Color { var labelColor: Color {
return Color(uiColor: UIColor.label) return Color(uiColor: UIColor.label)
} }
@@ -118,6 +127,10 @@ struct SystemTheme: Themeable {
} }
struct AlwaysDark: Themeable { struct AlwaysDark: Themeable {
var bgColor: Color {
return Color(uiColor: UIColor.systemBackground.resolvedColor(with: .init(userInterfaceStyle: .dark)))
}
var labelColor: Color { var labelColor: Color {
return .white return .white
} }
@@ -152,6 +165,10 @@ struct AlwaysDark: Themeable {
} }
struct AlwaysLight: Themeable { struct AlwaysLight: Themeable {
var bgColor: Color {
return Color(uiColor: UIColor.systemBackground)
}
var labelColor: Color { var labelColor: Color {
return .black return .black
} }

View File

@@ -61,31 +61,37 @@ struct CustomizeView: View {
Text(String(localized: "settings_view_change_icon")) Text(String(localized: "settings_view_change_icon"))
.font(.body) .font(.body)
.foregroundColor(theme.currentTheme.labelColor) .foregroundColor(theme.currentTheme.labelColor)
.padding(.top)
HStack { ScrollView(.horizontal) {
Button(action: { HStack {
UIApplication.shared.setAlternateIconName(nil)
}, label: {
Image("FeelsAppIcon", bundle: .main)
.resizable()
.frame(width: 50, height:50)
.cornerRadius(10)
})
ForEach(iconSets, id: \.self.0){ iconSet in
Button(action: { Button(action: {
UIApplication.shared.setAlternateIconName(iconSet.1) { (error) in UIApplication.shared.setAlternateIconName(nil)
// FIXME: Handle error
}
}, label: { }, label: {
Image(iconSet.0, bundle: .main) Image("FeelsAppIcon", bundle: .main)
.resizable() .resizable()
.frame(width: 50, height:50) .frame(width: 50, height:50)
.cornerRadius(10) .cornerRadius(10)
}) })
ForEach(iconSets, id: \.self.0){ iconSet in
Button(action: {
UIApplication.shared.setAlternateIconName(iconSet.1) { (error) in
// FIXME: Handle error
}
}, label: {
Image(iconSet.0, bundle: .main)
.resizable()
.frame(width: 50, height:50)
.cornerRadius(10)
})
}
} }
.padding()
} }
.background(RoundedRectangle(cornerRadius: 10).fill().foregroundColor(theme.currentTheme.bgColor))
.padding() .padding()
.cornerRadius(10)
} }
} }
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
@@ -137,7 +143,7 @@ struct CustomizeView: View {
selectedWidget.fuckingWrapped = CustomWidgetModel.randomWidget selectedWidget.fuckingWrapped = CustomWidgetModel.randomWidget
selectedWidget.showFuckingSheet = true selectedWidget.showFuckingSheet = true
} }
.padding() .padding(.top)
ScrollView(.horizontal) { ScrollView(.horizontal) {
HStack { HStack {
ForEach(UserDefaultsStore.getCustomWidgets(), id: \.uuid) { widget in ForEach(UserDefaultsStore.getCustomWidgets(), id: \.uuid) { widget in
@@ -149,9 +155,13 @@ struct CustomizeView: View {
selectedWidget.showFuckingSheet = true selectedWidget.showFuckingSheet = true
} }
} }
} }
.padding() .padding()
} }
.background(RoundedRectangle(cornerRadius: 10).fill().foregroundColor(theme.currentTheme.bgColor))
.padding()
.cornerRadius(10)
} }
} }
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)

View File

@@ -152,6 +152,7 @@ extension HomeViewTwo {
} }
} }
} }
.contentShape(Rectangle())
.onTapGesture{ .onTapGesture{
let deailView = MonthDetailView(monthInt: month, let deailView = MonthDetailView(monthInt: month,
yearInt: year, yearInt: year,