fix layout issue of ItemView when landscape
This commit is contained in:
parent
0f78534157
commit
443fcc4b66
|
@ -15,25 +15,25 @@ struct ItemLandscapeMainView: View {
|
|||
@Binding private var videoIsLoading: Bool
|
||||
@EnvironmentObject private var viewModel: ItemViewModel
|
||||
@EnvironmentObject private var videoPlayerItem: VideoPlayerItem
|
||||
|
||||
|
||||
init(videoIsLoading: Binding<Bool>) {
|
||||
self._videoIsLoading = videoIsLoading
|
||||
}
|
||||
|
||||
|
||||
// MARK: innerBody
|
||||
|
||||
|
||||
private var innerBody: some View {
|
||||
HStack {
|
||||
// MARK: Sidebar Image
|
||||
|
||||
|
||||
VStack {
|
||||
ImageView(src: viewModel.item.getPrimaryImage(maxWidth: 130),
|
||||
bh: viewModel.item.getPrimaryImageBlurHash())
|
||||
.frame(width: 130, height: 195)
|
||||
.cornerRadius(10)
|
||||
|
||||
|
||||
Spacer().frame(height: 15)
|
||||
|
||||
|
||||
Button {
|
||||
if let playButtonItem = viewModel.playButtonItem {
|
||||
self.videoPlayerItem.itemToPlay = playButtonItem
|
||||
|
@ -41,7 +41,7 @@ struct ItemLandscapeMainView: View {
|
|||
}
|
||||
} label: {
|
||||
// MARK: Play
|
||||
|
||||
|
||||
HStack {
|
||||
Image(systemName: "play.fill")
|
||||
.foregroundColor(viewModel.playButtonItem == nil ? Color(UIColor.secondaryLabel) : Color.white)
|
||||
|
@ -55,19 +55,19 @@ struct ItemLandscapeMainView: View {
|
|||
.background(viewModel.playButtonItem == nil ? Color(UIColor.secondarySystemFill) : Color.jellyfinPurple)
|
||||
.cornerRadius(10)
|
||||
}.disabled(viewModel.playButtonItem == nil)
|
||||
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
|
||||
ScrollView {
|
||||
VStack(alignment: .leading) {
|
||||
// MARK: ItemLandscapeTopBarView
|
||||
|
||||
|
||||
ItemLandscapeTopBarView()
|
||||
.environmentObject(viewModel)
|
||||
|
||||
|
||||
// MARK: ItemViewBody
|
||||
|
||||
|
||||
if let episodeViewModel = viewModel as? SeasonItemViewModel {
|
||||
EpisodeCardVStackView(items: episodeViewModel.episodes) { episode in
|
||||
itemRouter.route(to: \.item, episode)
|
||||
|
@ -80,28 +80,30 @@ struct ItemLandscapeMainView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: body
|
||||
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
ZStack {
|
||||
// MARK: Backdrop
|
||||
|
||||
ImageView(src: viewModel.item.getBackdropImage(maxWidth: 200),
|
||||
bh: viewModel.item.getBackdropImageBlurHash())
|
||||
.opacity(0.3)
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
.blur(radius: 4)
|
||||
|
||||
// iPadOS is making the view go all the way to the edge.
|
||||
// We have to accomodate this here
|
||||
ZStack {
|
||||
// MARK: Backdrop
|
||||
|
||||
ImageView(src: viewModel.item.getBackdropImage(maxWidth: 200),
|
||||
bh: viewModel.item.getBackdropImageBlurHash())
|
||||
.opacity(0.3)
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
.blur(radius: 4)
|
||||
.layoutPriority(1)
|
||||
|
||||
// iPadOS is making the view go all the way to the edge.
|
||||
// We have to accomodate this here
|
||||
Group {
|
||||
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||
innerBody.padding(.horizontal, 25)
|
||||
} else {
|
||||
innerBody
|
||||
}
|
||||
}
|
||||
.layoutPriority(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue