bigger header
page will always respond to swipe
This commit is contained in:
@@ -9,6 +9,11 @@ import SwiftUI
|
||||
import CoreData
|
||||
import Charts
|
||||
|
||||
struct ContentViewConstants {
|
||||
static let maxHeaderHeight = 200.0
|
||||
static let minHeaderHeight = 88.0
|
||||
}
|
||||
|
||||
struct ContentView: View {
|
||||
@Environment(\.managedObjectContext) private var viewContext
|
||||
@AppStorage(UserDefaultsStore.Keys.needsOnboarding.rawValue, store: GroupUserDefaults.groupDefaults) private var needsOnboarding = true
|
||||
@@ -18,10 +23,10 @@ struct ContentView: View {
|
||||
@State private var showTodayInput = true
|
||||
@State private var selectedEntry: MoodEntry?
|
||||
@State private var showUpdateEntryAlert = false
|
||||
@State private var headerHeight: CGFloat = 150
|
||||
@State private var headerHeight: CGFloat = ContentViewConstants.maxHeaderHeight
|
||||
|
||||
let minHeaderHeight = 88.0
|
||||
let maxHeaderHeight = 150.0
|
||||
let minHeaderHeight = ContentViewConstants.minHeaderHeight
|
||||
let maxHeaderHeight = ContentViewConstants.maxHeaderHeight
|
||||
@State private var headerOpacity: Double = 1.0
|
||||
|
||||
@ObservedObject var viewModel = ContentModeViewModel()
|
||||
@@ -178,8 +183,9 @@ struct ContentView: View {
|
||||
)
|
||||
.coordinateSpace(name: "scroll")
|
||||
.onPreferenceChange(ViewOffsetKey.self) { value in
|
||||
calculateHeight(minHeight: 88, maxHeight: 180, yOffset: value)
|
||||
calculateHeight(minHeight: ContentViewConstants.minHeaderHeight, maxHeight: ContentViewConstants.maxHeaderHeight, yOffset: value)
|
||||
}
|
||||
.clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous))
|
||||
}
|
||||
|
||||
private func SectionHeaderView(month: Int, year: Int) -> some View {
|
||||
@@ -266,7 +272,11 @@ struct ContentView: View {
|
||||
UIPageControl.appearance().currentPageIndicatorTintColor = UIColor.label
|
||||
UIPageControl.appearance().pageIndicatorTintColor = UIColor.black.withAlphaComponent(0.2)
|
||||
}
|
||||
.padding(.bottom, 12)
|
||||
.background(
|
||||
Color(UIColor.systemBackground)
|
||||
)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous))
|
||||
.padding([.trailing, .leading])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user