Apply ParallaxHeaderScrollView to EpisodeItem
Fix layout of EpisodeItemView, MovieitemView
This commit is contained in:
parent
a16d51ae09
commit
8bc24d1db8
|
@ -202,12 +202,7 @@ struct EpisodeItemView: View {
|
|||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
LoadingView(isShowing: $isLoading) {
|
||||
VStack(alignment: .leading) {
|
||||
if !isLoading {
|
||||
if orientationInfo.orientation == .portrait {
|
||||
GeometryReader { geometry in
|
||||
var portraitHeaderView: some View {
|
||||
VStack {
|
||||
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.ParentBackdropItemId)/Images/Backdrop?maxWidth=550&quality=90&tag=\(fullItem.Backdrop)")!)
|
||||
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
|
||||
|
@ -217,23 +212,17 @@ struct EpisodeItemView: View {
|
|||
.BackdropBlurHash,
|
||||
size: CGSize(width: 32, height: 32))!)
|
||||
.resizable()
|
||||
.frame(width: geometry.size.width + geometry.safeAreaInsets.leading + geometry.safeAreaInsets
|
||||
.trailing,
|
||||
height: UIDevice.current
|
||||
.userInterfaceIdiom == .pad ? 350 :
|
||||
(geometry.size.width + geometry.safeAreaInsets.leading + geometry.safeAreaInsets
|
||||
.trailing) * 0.5625)
|
||||
}
|
||||
|
||||
.opacity(0.3)
|
||||
.aspectRatio(contentMode: .fill)
|
||||
.frame(width: geometry.size.width + geometry.safeAreaInsets.leading + geometry.safeAreaInsets.trailing,
|
||||
height: UIDevice.current
|
||||
.userInterfaceIdiom == .pad ? 350 :
|
||||
(geometry.size.width + geometry.safeAreaInsets.leading + geometry.safeAreaInsets.trailing) *
|
||||
0.5625)
|
||||
.shadow(radius: 5)
|
||||
.overlay(HStack {
|
||||
}
|
||||
}
|
||||
|
||||
var portraitHeaderOverlayView: some View {
|
||||
VStack(alignment: .leading) {
|
||||
HStack(alignment: .bottom, spacing: 12) {
|
||||
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.SeriesId ?? "")/Images/Primary?maxWidth=250&quality=90&tag=\(fullItem.Poster)")!)
|
||||
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
|
||||
.placeholder {
|
||||
|
@ -272,6 +261,7 @@ struct EpisodeItemView: View {
|
|||
.overlay(RoundedRectangle(cornerRadius: 2)
|
||||
.stroke(Color.secondary, lineWidth: 1))
|
||||
}
|
||||
}.frame(maxWidth: .infinity, alignment: .leading)
|
||||
if fullItem.CommunityRating != "0" {
|
||||
HStack {
|
||||
Image(systemName: "star").foregroundColor(.secondary)
|
||||
|
@ -283,12 +273,8 @@ struct EpisodeItemView: View {
|
|||
}
|
||||
}
|
||||
}.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.offset(x: 0, y: UIDevice.current.userInterfaceIdiom == .pad ? -98 : -46)
|
||||
.padding(.trailing, 16)
|
||||
}.offset(x: 16, y: UIDevice.current.userInterfaceIdiom == .pad ? 135 : 40),
|
||||
alignment: .bottomLeading)
|
||||
VStack(alignment: .leading) {
|
||||
.padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? 98 : 26)
|
||||
}
|
||||
HStack {
|
||||
// Play button
|
||||
Button {
|
||||
|
@ -329,9 +315,27 @@ struct EpisodeItemView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
}.padding(.leading, 16).padding(.trailing, 16)
|
||||
ScrollView {
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? -189 : -64)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
LoadingView(isShowing: $isLoading) {
|
||||
VStack(alignment: .leading) {
|
||||
if !isLoading {
|
||||
if orientationInfo.orientation == .portrait {
|
||||
ParallaxHeaderScrollView(header: portraitHeaderView,
|
||||
staticOverlayView: portraitHeaderOverlayView,
|
||||
overlayAlignment: .bottomLeading,
|
||||
headerHeight: UIDevice.current
|
||||
.userInterfaceIdiom == .pad ? 350 :
|
||||
UIScreen.main.bounds.width * 0.5625) {
|
||||
VStack(alignment: .leading) {
|
||||
Spacer()
|
||||
.frame(height: UIDevice.current.userInterfaceIdiom == .pad ? 135 : 40)
|
||||
.padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? 54 : 24)
|
||||
if fullItem.Tagline != "" {
|
||||
Text(fullItem.Tagline).font(.body).italic().padding(.top, 7)
|
||||
.fixedSize(horizontal: false, vertical: true).padding(.leading, 16)
|
||||
|
@ -427,14 +431,9 @@ struct EpisodeItemView: View {
|
|||
Spacer().frame(height: 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(EdgeInsets(top: UIDevice.current.userInterfaceIdiom == .pad ? 54 : 24, leading: 0, bottom: 0,
|
||||
trailing: 0))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GeometryReader { geometry in
|
||||
ZStack() {
|
||||
ZStack {
|
||||
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.ParentBackdropItemId)/Images/Backdrop?maxWidth=\(String(Int(geometry.size.width + geometry.safeAreaInsets.leading + geometry.safeAreaInsets.trailing)))&quality=80&tag=\(fullItem.Backdrop)")!)
|
||||
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
|
||||
.placeholder {
|
||||
|
@ -454,9 +453,9 @@ struct EpisodeItemView: View {
|
|||
.frame(width: geometry.size.width + geometry.safeAreaInsets.leading + geometry.safeAreaInsets.trailing,
|
||||
height: geometry.size.height + geometry.safeAreaInsets.top + geometry.safeAreaInsets.bottom)
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
.blur(radius:2)
|
||||
HStack() {
|
||||
VStack() {
|
||||
.blur(radius: 2)
|
||||
HStack {
|
||||
VStack {
|
||||
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.SeriesId ?? "")/Images/Primary?maxWidth=250&quality=90&tag=\(fullItem.Poster)")!)
|
||||
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
|
||||
.placeholder {
|
||||
|
|
|
@ -349,6 +349,7 @@ struct MovieItemView: View {
|
|||
.overlay(RoundedRectangle(cornerRadius: 2)
|
||||
.stroke(Color.secondary, lineWidth: 1))
|
||||
}
|
||||
}.frame(maxWidth: .infinity, alignment: .leading)
|
||||
if fullItem.CommunityRating != "0" {
|
||||
HStack {
|
||||
Image(systemName: "star").foregroundColor(.secondary)
|
||||
|
@ -359,7 +360,6 @@ struct MovieItemView: View {
|
|||
.offset(x: -7, y: 0.7)
|
||||
}
|
||||
}
|
||||
}.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
.padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? 98 : 26)
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ struct MovieItemView: View {
|
|||
}
|
||||
}
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? -135 : -60)
|
||||
.padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? -189 : -64)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
|
@ -422,8 +422,8 @@ struct MovieItemView: View {
|
|||
UIScreen.main.bounds.width * 0.5625) {
|
||||
VStack(alignment: .leading) {
|
||||
Spacer()
|
||||
.frame(height: UIDevice.current.userInterfaceIdiom == .pad ? 135 : 60)
|
||||
.padding(.bottom, 8)
|
||||
.frame(height: UIDevice.current.userInterfaceIdiom == .pad ? 135 : 40)
|
||||
.padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? 54 : 24)
|
||||
if fullItem.Tagline != "" {
|
||||
Text(fullItem.Tagline).font(.body).italic().padding(.top, 7)
|
||||
.fixedSize(horizontal: false, vertical: true).padding(.leading, 16)
|
||||
|
|
Loading…
Reference in New Issue