yattee/Shared/Player/Video Details/VideoDetailsPaddingModifier.swift

34 lines
789 B
Swift
Raw Normal View History

2021-08-22 19:13:33 +00:00
import Foundation
import SwiftUI
struct VideoDetailsPaddingModifier: ViewModifier {
2022-06-24 23:39:29 +00:00
static var defaultAdditionalDetailsPadding = 0.0
2022-06-26 22:15:01 +00:00
let playerSize: CGSize
2021-09-18 20:36:42 +00:00
let additionalPadding: Double
let fullScreen: Bool
2021-08-22 19:13:33 +00:00
init(
2022-06-26 22:15:01 +00:00
playerSize: CGSize,
additionalPadding: Double? = nil,
fullScreen: Bool = false
2021-08-22 19:13:33 +00:00
) {
2022-06-26 22:15:01 +00:00
self.playerSize = playerSize
2022-05-20 19:53:17 +00:00
self.additionalPadding = additionalPadding ?? Self.defaultAdditionalDetailsPadding
self.fullScreen = fullScreen
2021-08-22 19:13:33 +00:00
}
2021-09-18 20:36:42 +00:00
var playerHeight: Double {
2022-06-26 22:15:01 +00:00
playerSize.height
2021-08-22 19:13:33 +00:00
}
2021-09-18 20:36:42 +00:00
var topPadding: Double {
fullScreen ? 0 : (playerHeight + additionalPadding)
2021-08-22 19:13:33 +00:00
}
func body(content: Content) -> some View {
content
.padding(.top, topPadding)
}
}