feat: for tvOS
This commit is contained in:
@@ -3,9 +3,17 @@ import SwiftUI
|
||||
struct ContentCardView: View {
|
||||
let item: ContentItem
|
||||
|
||||
#if os(tvOS)
|
||||
private let cardWidth: CGFloat = 250
|
||||
#else
|
||||
private let cardWidth: CGFloat = 140
|
||||
#endif
|
||||
private let aspectRatio: CGFloat = 2.0 / 3.0
|
||||
|
||||
#if os(tvOS)
|
||||
@Environment(\.isFocused) private var isFocused
|
||||
#endif
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
// 海报
|
||||
@@ -54,6 +62,11 @@ struct ContentCardView: View {
|
||||
}
|
||||
}
|
||||
.frame(width: cardWidth)
|
||||
#if os(tvOS)
|
||||
.scaleEffect(isFocused ? 1.1 : 1.0)
|
||||
.shadow(color: isFocused ? .blue.opacity(0.4) : .clear, radius: 10)
|
||||
.animation(.easeInOut(duration: 0.2), value: isFocused)
|
||||
#endif
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
|
||||
Reference in New Issue
Block a user