Apply ParallaxHeaderScrollView to MovieItemView, SeasonItemView

This commit is contained in:
PangMo5 2021-05-30 18:35:49 +09:00
parent e66d0ce742
commit a16d51ae09
2 changed files with 261 additions and 266 deletions

View File

@ -292,239 +292,237 @@ struct MovieItemView: View {
} }
} }
var portraitHeaderView: some View {
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.Id)/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
.placeholder {
Image(uiImage: UIImage(blurHash: fullItem
.BackdropBlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : fullItem
.BackdropBlurHash,
size: CGSize(width: 32, height: 32))!)
.resizable()
}
.opacity(0.3)
.aspectRatio(contentMode: .fill)
.shadow(radius: 5)
}
var portraitHeaderOverlayView: some View {
VStack(alignment: .leading) {
HStack(alignment: .bottom, spacing: 12) {
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.Id)/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 {
Image(uiImage: UIImage(blurHash: fullItem
.PosterBlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" :
fullItem.PosterBlurHash,
size: CGSize(width: 32, height: 32))!)
.resizable()
.frame(width: 120, height: 180)
.cornerRadius(10)
}.aspectRatio(contentMode: .fill)
.frame(width: 120, height: 180)
.cornerRadius(10)
VStack(alignment: .leading) {
Spacer()
Text(fullItem.Name).font(.headline)
.fontWeight(.semibold)
.foregroundColor(.primary)
.fixedSize(horizontal: false, vertical: true)
.offset(y: -4)
HStack {
Text(String(fullItem.ProductionYear)).font(.subheadline)
.fontWeight(.medium)
.foregroundColor(.secondary)
.lineLimit(1)
Text(fullItem.Runtime).font(.subheadline)
.fontWeight(.medium)
.foregroundColor(.secondary)
.lineLimit(1)
if fullItem.OfficialRating != "" {
Text(fullItem.OfficialRating).font(.subheadline)
.fontWeight(.semibold)
.foregroundColor(.secondary)
.lineLimit(1)
.padding(EdgeInsets(top: 1, leading: 4, bottom: 1, trailing: 4))
.overlay(RoundedRectangle(cornerRadius: 2)
.stroke(Color.secondary, lineWidth: 1))
}
if fullItem.CommunityRating != "0" {
HStack {
Image(systemName: "star").foregroundColor(.secondary)
Text(fullItem.CommunityRating).font(.subheadline)
.fontWeight(.semibold)
.foregroundColor(.secondary)
.lineLimit(1)
.offset(x: -7, y: 0.7)
}
}
}.frame(maxWidth: .infinity, alignment: .leading)
}
.padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? 98 : 26)
}
HStack {
// Play button
Button {
self.playbackInfo.itemToPlay = fullItem
self.playbackInfo.shouldPlay = true
} label: {
HStack {
Text(fullItem.Progress == 0 ? "Play" : "\(progressString) left")
.foregroundColor(Color.white).font(.callout).fontWeight(.semibold)
Image(systemName: "play.fill").foregroundColor(Color.white).font(.system(size: 20))
}
.frame(width: 120, height: 35)
.background(Color(red: 172 / 255, green: 92 / 255, blue: 195 / 255))
.cornerRadius(10)
}.buttonStyle(PlainButtonStyle())
.frame(width: 120, height: 35)
Spacer()
HStack {
Button {
favorite.toggle()
} label: {
if !favorite {
Image(systemName: "heart").foregroundColor(Color.primary).font(.system(size: 20))
} else {
Image(systemName: "heart.fill").foregroundColor(Color(UIColor.systemRed))
.font(.system(size: 20))
}
}
Button {
watched.toggle()
} label: {
if watched {
Image(systemName: "checkmark.rectangle.fill").foregroundColor(Color.primary)
.font(.system(size: 20))
} else {
Image(systemName: "xmark.rectangle").foregroundColor(Color.primary)
.font(.system(size: 20))
}
}
}
}
}
.padding(.horizontal, 16)
.padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? -135 : -60)
}
var body: some View { var body: some View {
LoadingView(isShowing: $isLoading) { LoadingView(isShowing: $isLoading) {
VStack(alignment: .leading) { VStack(alignment: .leading) {
if !isLoading { if !isLoading {
if orientationInfo.orientation == .portrait { if orientationInfo.orientation == .portrait {
GeometryReader { geometry in ParallaxHeaderScrollView(header: portraitHeaderView,
VStack { staticOverlayView: portraitHeaderOverlayView,
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.Id)/Images/Backdrop?maxWidth=550&quality=90&tag=\(fullItem.Backdrop)")!) overlayAlignment: .bottomLeading,
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size headerHeight: UIDevice.current
.placeholder { .userInterfaceIdiom == .pad ? 350 :
Image(uiImage: UIImage(blurHash: fullItem UIScreen.main.bounds.width * 0.5625) {
.BackdropBlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : fullItem VStack(alignment: .leading) {
.BackdropBlurHash, Spacer()
size: CGSize(width: 32, height: 32))!) .frame(height: UIDevice.current.userInterfaceIdiom == .pad ? 135 : 60)
.resizable() .padding(.bottom, 8)
.frame(width: geometry.size.width + geometry.safeAreaInsets.leading + geometry.safeAreaInsets if fullItem.Tagline != "" {
.trailing, Text(fullItem.Tagline).font(.body).italic().padding(.top, 7)
height: UIDevice.current .fixedSize(horizontal: false, vertical: true).padding(.leading, 16)
.userInterfaceIdiom == .pad ? 350 : .padding(.trailing, 16)
(geometry.size.width + geometry.safeAreaInsets.leading + geometry.safeAreaInsets }
.trailing) * 0.5625) Text(fullItem.Overview).font(.footnote).padding(.top, 3)
} .fixedSize(horizontal: false, vertical: true).padding(.bottom, 3).padding(.leading, 16)
.padding(.trailing, 16)
.opacity(0.3) if !fullItem.Genres.isEmpty {
.aspectRatio(contentMode: .fill) ScrollView(.horizontal, showsIndicators: false) {
.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 {
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.Id)/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 {
Image(uiImage: UIImage(blurHash: fullItem
.PosterBlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" :
fullItem.PosterBlurHash,
size: CGSize(width: 32, height: 32))!)
.resizable()
.frame(width: 120, height: 180)
.cornerRadius(10)
}.aspectRatio(contentMode: .fill)
.frame(width: 120, height: 180)
.cornerRadius(10)
VStack(alignment: .leading) {
Spacer()
Text(fullItem.Name).font(.headline)
.fontWeight(.semibold)
.foregroundColor(.primary)
.fixedSize(horizontal: false, vertical: true)
.offset(y: -4)
HStack {
Text(String(fullItem.ProductionYear)).font(.subheadline)
.fontWeight(.medium)
.foregroundColor(.secondary)
.lineLimit(1)
Text(fullItem.Runtime).font(.subheadline)
.fontWeight(.medium)
.foregroundColor(.secondary)
.lineLimit(1)
if fullItem.OfficialRating != "" {
Text(fullItem.OfficialRating).font(.subheadline)
.fontWeight(.semibold)
.foregroundColor(.secondary)
.lineLimit(1)
.padding(EdgeInsets(top: 1, leading: 4, bottom: 1, trailing: 4))
.overlay(RoundedRectangle(cornerRadius: 2)
.stroke(Color.secondary, lineWidth: 1))
}
if fullItem.CommunityRating != "0" {
HStack {
Image(systemName: "star").foregroundColor(.secondary)
Text(fullItem.CommunityRating).font(.subheadline)
.fontWeight(.semibold)
.foregroundColor(.secondary)
.lineLimit(1)
.offset(x: -7, y: 0.7)
}
}
}.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) {
HStack {
// Play button
Button {
self.playbackInfo.itemToPlay = fullItem
self.playbackInfo.shouldPlay = true
} label: {
HStack {
Text(fullItem.Progress == 0 ? "Play" : "\(progressString) left")
.foregroundColor(Color.white).font(.callout).fontWeight(.semibold)
Image(systemName: "play.fill").foregroundColor(Color.white).font(.system(size: 20))
}
.frame(width: 120, height: 35)
.background(Color(red: 172 / 255, green: 92 / 255, blue: 195 / 255))
.cornerRadius(10)
}.buttonStyle(PlainButtonStyle())
.frame(width: 120, height: 35)
Spacer()
HStack { HStack {
Button { Text("Genres:").font(.callout).fontWeight(.semibold)
favorite.toggle() ForEach(fullItem.Genres, id: \.Id) { genre in
} label: { NavigationLink(destination: LazyView {
if !favorite { LibraryView(viewModel: .init(filter: Filter(genres: [
Image(systemName: "heart").foregroundColor(Color.primary).font(.system(size: 20)) genre
} else { .Name,
Image(systemName: "heart.fill").foregroundColor(Color(UIColor.systemRed)) ])),
.font(.system(size: 20)) title: genre.Name)
}) {
Text(genre.Name).font(.footnote)
} }
} }
Button { }.padding(.leading, 16).padding(.trailing, 16)
watched.toggle()
} label: {
if watched {
Image(systemName: "checkmark.rectangle.fill").foregroundColor(Color.primary)
.font(.system(size: 20))
} else {
Image(systemName: "xmark.rectangle").foregroundColor(Color.primary)
.font(.system(size: 20))
}
}
}
}.padding(.leading, 16).padding(.trailing, 16)
ScrollView {
VStack(alignment: .leading) {
if fullItem.Tagline != "" {
Text(fullItem.Tagline).font(.body).italic().padding(.top, 7)
.fixedSize(horizontal: false, vertical: true).padding(.leading, 16)
.padding(.trailing, 16)
}
Text(fullItem.Overview).font(.footnote).padding(.top, 3)
.fixedSize(horizontal: false, vertical: true).padding(.bottom, 3).padding(.leading, 16)
.padding(.trailing, 16)
if !fullItem.Genres.isEmpty {
ScrollView(.horizontal, showsIndicators: false) {
HStack {
Text("Genres:").font(.callout).fontWeight(.semibold)
ForEach(fullItem.Genres, id: \.Id) { genre in
NavigationLink(destination: LazyView {
LibraryView(viewModel: .init(filter: Filter(genres: [
genre
.Name,
])),
title: genre.Name)
}) {
Text(genre.Name).font(.footnote)
}
}
}.padding(.leading, 16).padding(.trailing, 16)
}
}
if !fullItem.Cast.isEmpty {
ScrollView(.horizontal, showsIndicators: false) {
VStack {
Spacer().frame(height: 8)
HStack {
Spacer().frame(width: 16)
ForEach(fullItem.Cast, id: \.Id) { cast in
NavigationLink(destination: LazyView {
LibraryView(viewModel: .init(filter: Filter(personIds: [
cast
.Id,
])), title: cast.Name)
}) {
VStack {
WebImage(url: cast.Image)
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
.placeholder {
Image(uiImage: UIImage(blurHash: cast
.ImageBlurHash == "" ?
"W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" :
cast.ImageBlurHash,
size: CGSize(width: 16,
height: 16))!)
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 100, height: 100)
.cornerRadius(10)
}
.aspectRatio(contentMode: .fill)
.frame(width: 100, height: 100)
.cornerRadius(10)
Text(cast.Name).font(.footnote).fontWeight(.regular).lineLimit(1)
.frame(width: 100).foregroundColor(Color.primary)
if cast.Role != "" {
Text(cast.Role).font(.caption).fontWeight(.medium).lineLimit(1)
.foregroundColor(Color.secondary).frame(width: 100)
}
}
}
Spacer().frame(width: 10)
}
Spacer().frame(width: 16)
}
}
}.padding(.top, -3)
}
if !fullItem.Directors.isEmpty {
HStack {
Text("Directors:").font(.callout).fontWeight(.semibold)
Text(fullItem.Directors.joined(separator: ", ")).font(.footnote).lineLimit(1)
.foregroundColor(Color.secondary)
}.padding(.leading, 16).padding(.trailing, 16)
}
if !fullItem.Writers.isEmpty {
HStack {
Text("Writers:").font(.callout).fontWeight(.semibold)
Text(fullItem.Writers.joined(separator: ", ")).font(.footnote).lineLimit(1)
.foregroundColor(Color.secondary)
}.padding(.leading, 16).padding(.trailing, 16)
}
if !fullItem.Studios.isEmpty {
HStack {
Text("Studios:").font(.callout).fontWeight(.semibold)
Text(fullItem.Studios.joined(separator: ", ")).font(.footnote).lineLimit(1)
.foregroundColor(Color.secondary)
}.padding(.leading, 16).padding(.trailing, 16)
}
Spacer().frame(height: 3)
}
} }
} }
.padding(EdgeInsets(top: UIDevice.current.userInterfaceIdiom == .pad ? 54 : 24, leading: 0, bottom: 0, if !fullItem.Cast.isEmpty {
trailing: 0)) ScrollView(.horizontal, showsIndicators: false) {
VStack {
Spacer().frame(height: 8)
HStack {
Spacer().frame(width: 16)
ForEach(fullItem.Cast, id: \.Id) { cast in
NavigationLink(destination: LazyView {
LibraryView(viewModel: .init(filter: Filter(personIds: [
cast
.Id,
])), title: cast.Name)
}) {
VStack {
WebImage(url: cast.Image)
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
.placeholder {
Image(uiImage: UIImage(blurHash: cast
.ImageBlurHash == "" ?
"W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" :
cast.ImageBlurHash,
size: CGSize(width: 16,
height: 16))!)
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 100, height: 100)
.cornerRadius(10)
}
.aspectRatio(contentMode: .fill)
.frame(width: 100, height: 100)
.cornerRadius(10)
Text(cast.Name).font(.footnote).fontWeight(.regular).lineLimit(1)
.frame(width: 100).foregroundColor(Color.primary)
if cast.Role != "" {
Text(cast.Role).font(.caption).fontWeight(.medium).lineLimit(1)
.foregroundColor(Color.secondary).frame(width: 100)
}
}
}
Spacer().frame(width: 10)
}
Spacer().frame(width: 16)
}
}
}.padding(.top, -3)
}
if !fullItem.Directors.isEmpty {
HStack {
Text("Directors:").font(.callout).fontWeight(.semibold)
Text(fullItem.Directors.joined(separator: ", ")).font(.footnote).lineLimit(1)
.foregroundColor(Color.secondary)
}.padding(.leading, 16).padding(.trailing, 16)
}
if !fullItem.Writers.isEmpty {
HStack {
Text("Writers:").font(.callout).fontWeight(.semibold)
Text(fullItem.Writers.joined(separator: ", ")).font(.footnote).lineLimit(1)
.foregroundColor(Color.secondary)
}.padding(.leading, 16).padding(.trailing, 16)
}
if !fullItem.Studios.isEmpty {
HStack {
Text("Studios:").font(.callout).fontWeight(.semibold)
Text(fullItem.Studios.joined(separator: ", ")).font(.footnote).lineLimit(1)
.foregroundColor(Color.secondary)
}.padding(.leading, 16).padding(.trailing, 16)
}
Spacer().frame(height: 3)
} }
} }
} else { } else {
GeometryReader { geometry in GeometryReader { geometry in
ZStack() { ZStack {
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.Id)/Images/Backdrop?maxWidth=\(String(Int(geometry.size.width + geometry.safeAreaInsets.leading + geometry.safeAreaInsets.trailing)))&quality=80&tag=\(fullItem.Backdrop)")!) WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.Id)/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 .resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
.placeholder { .placeholder {
@ -544,9 +542,9 @@ struct MovieItemView: View {
.frame(width: geometry.size.width + geometry.safeAreaInsets.leading + geometry.safeAreaInsets.trailing, .frame(width: geometry.size.width + geometry.safeAreaInsets.leading + geometry.safeAreaInsets.trailing,
height: geometry.size.height + geometry.safeAreaInsets.top + geometry.safeAreaInsets.bottom) height: geometry.size.height + geometry.safeAreaInsets.top + geometry.safeAreaInsets.bottom)
.edgesIgnoringSafeArea(.all) .edgesIgnoringSafeArea(.all)
.blur(radius:2) .blur(radius: 2)
HStack() { HStack {
VStack() { VStack {
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.Id)/Images/Primary?maxWidth=250&quality=90&tag=\(fullItem.Poster)")!) WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.Id)/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 .resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
.placeholder { .placeholder {

View File

@ -185,9 +185,8 @@ struct SeasonItemView: View {
return result return result
} }
func portraitHeaderView(proxy: GeometryProxy) -> some View { var portraitHeaderView: some View {
let yOffset = proxy.frame(in: .global).minY > 0 ? -proxy.frame(in: .global).minY : 0 WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.SeriesId ?? "")/Images/Backdrop?maxWidth=750&quality=80&tag=\(item.SeasonImage ?? "")")!)
return WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.SeriesId ?? "")/Images/Backdrop?maxWidth=750&quality=80&tag=\(item.SeasonImage ?? "")")!)
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size .resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
.placeholder { .placeholder {
Image(uiImage: UIImage(blurHash: item Image(uiImage: UIImage(blurHash: item
@ -195,50 +194,47 @@ struct SeasonItemView: View {
.SeasonImageBlurHash ?? "", .SeasonImageBlurHash ?? "",
size: CGSize(width: 32, height: 32))!) size: CGSize(width: 32, height: 32))!)
.resizable() .resizable()
.frame(width: proxy.size.width, height: proxy.size.height - yOffset)
} }
.opacity(0.4) .opacity(0.4)
.aspectRatio(contentMode: .fill) .aspectRatio(contentMode: .fill)
.frame(width: proxy.size.width, height: proxy.size.height - yOffset)
.shadow(radius: 5) .shadow(radius: 5)
.overlay(HStack(alignment: .bottom, spacing: 12) { }
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.Id)/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 var portraitHeaderOverlayView: some View {
.placeholder { HStack(alignment: .bottom, spacing: 12) {
Image(uiImage: UIImage(blurHash: fullItem WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.Id)/Images/Primary?maxWidth=250&quality=90&tag=\(fullItem.Poster)")!)
.PosterBlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : fullItem .resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
.PosterBlurHash, .placeholder {
size: CGSize(width: 32, height: 32))!) Image(uiImage: UIImage(blurHash: fullItem
.resizable() .PosterBlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : fullItem
.frame(width: 120, height: 180) .PosterBlurHash,
.cornerRadius(10) size: CGSize(width: 32, height: 32))!)
}.aspectRatio(contentMode: .fill) .resizable()
.frame(width: 120, height: 180) .frame(width: 120, height: 180)
.cornerRadius(10) .cornerRadius(10)
VStack(alignment: .leading) { }.aspectRatio(contentMode: .fill)
.frame(width: 120, height: 180)
.cornerRadius(10)
VStack(alignment: .leading) {
// Text(fullItem.SeriesName ?? "") // Text(fullItem.SeriesName ?? "")
// .font(.largeTitle) // .font(.largeTitle)
// .fontWeight(.bold) // .fontWeight(.bold)
// .foregroundColor(.primary) // .foregroundColor(.primary)
// .padding(.bottom, 8) // .padding(.bottom, 8)
Text(fullItem.Name).font(.headline) Text(fullItem.Name).font(.headline)
.fontWeight(.semibold) .fontWeight(.semibold)
.foregroundColor(.primary) .foregroundColor(.primary)
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
.offset(y: -4) .offset(y: -4)
if fullItem.ProductionYear != 0 { if fullItem.ProductionYear != 0 {
Text(String(fullItem.ProductionYear)).font(.subheadline) Text(String(fullItem.ProductionYear)).font(.subheadline)
.fontWeight(.medium) .fontWeight(.medium)
.foregroundColor(.secondary) .foregroundColor(.secondary)
.lineLimit(1) .lineLimit(1)
}
} }
}.padding(.horizontal, 16) }
.padding(.bottom, -22), }.padding(.horizontal, 16)
alignment: .bottomLeading) .padding(.bottom, -22)
.offset(y: yOffset)
} }
var body: some View { var body: some View {
@ -246,12 +242,13 @@ struct SeasonItemView: View {
LoadingView(isShowing: $isLoading) { LoadingView(isShowing: $isLoading) {
VStack(alignment: .leading) { VStack(alignment: .leading) {
if orientationInfo.orientation == .portrait { if orientationInfo.orientation == .portrait {
ScrollView { ParallaxHeaderScrollView(header: portraitHeaderView,
GeometryReader { proxy in staticOverlayView: portraitHeaderOverlayView,
portraitHeaderView(proxy: proxy) overlayAlignment: .bottomLeading,
} headerHeight: UIScreen.main.bounds.width * 0.5625) {
.frame(height: UIScreen.main.bounds.width * 0.5625)
VStack(alignment: .leading) { VStack(alignment: .leading) {
Spacer()
.frame(height: 22)
if fullItem.Tagline != "" { if fullItem.Tagline != "" {
Text(fullItem.Tagline).font(.body).italic().padding(.top, 7) Text(fullItem.Tagline).font(.body).italic().padding(.top, 7)
.fixedSize(horizontal: false, vertical: true).padding(.leading, 16) .fixedSize(horizontal: false, vertical: true).padding(.leading, 16)
@ -352,7 +349,7 @@ struct SeasonItemView: View {
.frame(width: geometry.size.width + geometry.safeAreaInsets.leading + geometry.safeAreaInsets.trailing, .frame(width: geometry.size.width + geometry.safeAreaInsets.leading + geometry.safeAreaInsets.trailing,
height: geometry.size.height + geometry.safeAreaInsets.top + geometry.safeAreaInsets.bottom) height: geometry.size.height + geometry.safeAreaInsets.top + geometry.safeAreaInsets.bottom)
.edgesIgnoringSafeArea(.all) .edgesIgnoringSafeArea(.all)
.blur(radius:2) .blur(radius: 2)
HStack { HStack {
VStack(alignment: .leading) { VStack(alignment: .leading) {
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.Id)/Images/Primary?maxWidth=250&quality=90&tag=\(fullItem.Poster)")!) WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(fullItem.Id)/Images/Primary?maxWidth=250&quality=90&tag=\(fullItem.Poster)")!)
@ -383,7 +380,7 @@ struct SeasonItemView: View {
.fixedSize(horizontal: false, vertical: true).padding(.leading, 16) .fixedSize(horizontal: false, vertical: true).padding(.leading, 16)
.padding(.trailing, 16) .padding(.trailing, 16)
} }
if(fullItem.Overview != "") { if fullItem.Overview != "" {
Text(fullItem.Overview).font(.footnote).padding(.top, 3) Text(fullItem.Overview).font(.footnote).padding(.top, 3)
.fixedSize(horizontal: false, vertical: true).padding(.bottom, 3).padding(.leading, 16) .fixedSize(horizontal: false, vertical: true).padding(.bottom, 3).padding(.leading, 16)
.padding(.trailing, 16) .padding(.trailing, 16)