mirror of
https://github.com/yattee/yattee.git
synced 2026-05-12 10:25:02 +00:00
Make tvOS details panel use full screen
This commit is contained in:
@@ -40,12 +40,6 @@ struct TVDetailsPanel: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
// Drag indicator
|
|
||||||
Capsule()
|
|
||||||
.fill(.white.opacity(0.4))
|
|
||||||
.frame(width: 80, height: 6)
|
|
||||||
.padding(.top, 20)
|
|
||||||
|
|
||||||
// Tab picker (hidden when description scroll is locked)
|
// Tab picker (hidden when description scroll is locked)
|
||||||
if !isDescriptionScrollLocked {
|
if !isDescriptionScrollLocked {
|
||||||
Picker("", selection: $selectedTab) {
|
Picker("", selection: $selectedTab) {
|
||||||
@@ -56,7 +50,7 @@ struct TVDetailsPanel: View {
|
|||||||
}
|
}
|
||||||
.pickerStyle(.segmented)
|
.pickerStyle(.segmented)
|
||||||
.padding(.horizontal, 120)
|
.padding(.horizontal, 120)
|
||||||
.padding(.top, 24)
|
.padding(.top, 60)
|
||||||
.padding(.bottom, 20)
|
.padding(.bottom, 20)
|
||||||
.focused($focusedItem, equals: .tabPicker)
|
.focused($focusedItem, equals: .tabPicker)
|
||||||
.transition(.opacity.combined(with: .move(edge: .top)))
|
.transition(.opacity.combined(with: .move(edge: .top)))
|
||||||
@@ -72,17 +66,14 @@ struct TVDetailsPanel: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 88)
|
.padding(.horizontal, 88)
|
||||||
|
.frame(maxHeight: .infinity)
|
||||||
Spacer()
|
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.frame(height: UIScreen.main.bounds.height * 0.65)
|
|
||||||
.background(
|
.background(
|
||||||
RoundedRectangle(cornerRadius: 32, style: .continuous)
|
Rectangle()
|
||||||
.fill(.ultraThinMaterial)
|
.fill(.ultraThinMaterial)
|
||||||
.ignoresSafeArea(edges: .bottom)
|
.ignoresSafeArea()
|
||||||
)
|
)
|
||||||
.frame(maxHeight: .infinity, alignment: .bottom)
|
|
||||||
.onExitCommand {
|
.onExitCommand {
|
||||||
// If description scroll is locked, unlock it first
|
// If description scroll is locked, unlock it first
|
||||||
if isDescriptionScrollLocked {
|
if isDescriptionScrollLocked {
|
||||||
@@ -120,7 +111,6 @@ struct TVDetailsPanel: View {
|
|||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
// Top section with title, channel, stats (hidden when description expanded)
|
// Top section with title, channel, stats (hidden when description expanded)
|
||||||
if !isDescriptionScrollLocked {
|
if !isDescriptionScrollLocked {
|
||||||
ScrollView {
|
|
||||||
VStack(alignment: .leading, spacing: 24) {
|
VStack(alignment: .leading, spacing: 24) {
|
||||||
// Video title
|
// Video title
|
||||||
Text(video?.title ?? "")
|
Text(video?.title ?? "")
|
||||||
@@ -136,8 +126,7 @@ struct TVDetailsPanel: View {
|
|||||||
statsRow
|
statsRow
|
||||||
}
|
}
|
||||||
.padding(.vertical, 16)
|
.padding(.vertical, 16)
|
||||||
}
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
.frame(height: 180)
|
|
||||||
.transition(.opacity.combined(with: .move(edge: .top)))
|
.transition(.opacity.combined(with: .move(edge: .top)))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,9 +140,6 @@ struct TVDetailsPanel: View {
|
|||||||
.padding(.top, isDescriptionScrollLocked ? 24 : 8)
|
.padding(.top, isDescriptionScrollLocked ? 24 : 8)
|
||||||
}
|
}
|
||||||
|
|
||||||
if isDescriptionScrollLocked {
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.animation(.easeInOut(duration: 0.25), value: isDescriptionScrollLocked)
|
.animation(.easeInOut(duration: 0.25), value: isDescriptionScrollLocked)
|
||||||
}
|
}
|
||||||
@@ -334,11 +320,6 @@ struct TVScrollableDescription: View {
|
|||||||
private let scrollStep: CGFloat = 80
|
private let scrollStep: CGFloat = 80
|
||||||
private let maxScroll: CGFloat = 5000
|
private let maxScroll: CGFloat = 5000
|
||||||
|
|
||||||
/// Height of description area - expands when locked
|
|
||||||
private var descriptionHeight: CGFloat {
|
|
||||||
isScrollLocked ? 500 : 200
|
|
||||||
}
|
|
||||||
|
|
||||||
private var isFocused: Bool {
|
private var isFocused: Bool {
|
||||||
focusedItem == .description
|
focusedItem == .description
|
||||||
}
|
}
|
||||||
@@ -400,7 +381,13 @@ struct TVScrollableDescription: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clipped container for scrollable text
|
// Clipped container for scrollable text. The Rectangle owns the
|
||||||
|
// layout size (fills available space) so the Text's intrinsic
|
||||||
|
// height from .fixedSize doesn't push parents.
|
||||||
|
Rectangle()
|
||||||
|
.fill(Color.clear)
|
||||||
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
|
.overlay(alignment: .topLeading) {
|
||||||
Text(description)
|
Text(description)
|
||||||
.font(.body)
|
.font(.body)
|
||||||
.foregroundStyle(.white.opacity(0.9))
|
.foregroundStyle(.white.opacity(0.9))
|
||||||
@@ -409,7 +396,7 @@ struct TVScrollableDescription: View {
|
|||||||
.multilineTextAlignment(.leading)
|
.multilineTextAlignment(.leading)
|
||||||
.frame(maxWidth: .infinity, alignment: .topLeading)
|
.frame(maxWidth: .infinity, alignment: .topLeading)
|
||||||
.offset(y: -scrollOffset)
|
.offset(y: -scrollOffset)
|
||||||
.frame(height: descriptionHeight, alignment: .top)
|
}
|
||||||
.clipped()
|
.clipped()
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
|||||||
Reference in New Issue
Block a user