jel/Jel/Views/Item/ItemHeaderView.swift

53 lines
1.5 KiB
Swift
Raw Normal View History

2023-12-24 04:47:21 +00:00
//
// ItemHeaderView.swift
// Jel
//
// Created by zerocool on 12/23/23.
//
import SwiftUI
import JellyfinKit
struct ItemHeaderView: View {
2024-01-08 00:20:56 +00:00
var item: BaseItemDto
2023-12-24 04:47:21 +00:00
2024-01-08 17:57:25 +00:00
let overlayGradientMask = LinearGradient(gradient: Gradient(stops: [
2023-12-24 04:47:21 +00:00
.init(color: .clear, location: 0),
2024-01-08 17:57:25 +00:00
.init(color: .black, location: 0.3),
]), startPoint: .bottom, endPoint: .top)
let overlayGradient = LinearGradient(gradient: Gradient(stops: [
.init(color: .black, location: 0),
.init(color: .clear, location: 0.5)
2023-12-24 04:47:21 +00:00
]), startPoint: .bottom, endPoint: .top)
var body: some View {
ZStack(alignment: .bottom) {
2024-01-08 19:00:59 +00:00
StickyHeaderView(minHeight: 400) {
ItemIconView(item: item, imageType: "Backdrop", contentMode: .fill)
2023-12-25 01:01:52 +00:00
.setCornerRadius(0)
2024-01-09 17:32:06 +00:00
.overlay(overlayGradient)
2023-12-25 01:01:52 +00:00
}
2023-12-24 04:47:21 +00:00
HStack {
ItemIconView(item: item, imageType: "Logo", width: 200, height: 100, placeHolder: AnyView(Text(item.name ?? "Unknown").font(.title).bold().truncationMode(.middle)))
2023-12-24 04:47:21 +00:00
.setCornerRadius(0)
.shadow(radius: 10)
2023-12-25 01:01:52 +00:00
.frame(alignment: .leading)
2023-12-24 04:47:21 +00:00
Spacer()
2023-12-25 01:01:52 +00:00
ItemInfoView(item: item)
2023-12-24 04:47:21 +00:00
}
2023-12-25 01:01:52 +00:00
.padding([.leading, .trailing])
}
2024-01-08 19:00:59 +00:00
// .scrollTransition {content, phase in
// content
// .scaleEffect(phase.isIdentity ? 1 : 2)
// .opacity(phase.isIdentity ? 1 : 0.1)
// .blur(radius: phase.isIdentity ? 0 : 50)
// }
2023-12-24 04:47:21 +00:00
}
}
// #Preview {
// ItemHeaderView(item: BaseItemDto())
// }