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
|
2021-10-05 20:20:09 +00:00
|
|
|
|
2022-06-26 22:15:01 +00:00
|
|
|
let playerSize: CGSize
|
2021-09-18 20:36:42 +00:00
|
|
|
let additionalPadding: Double
|
2021-10-05 20:20:09 +00:00
|
|
|
let fullScreen: Bool
|
2021-08-22 19:13:33 +00:00
|
|
|
|
|
|
|
init(
|
2022-06-26 22:15:01 +00:00
|
|
|
playerSize: CGSize,
|
2021-10-05 20:20:09 +00:00
|
|
|
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
|
2021-10-05 20:20:09 +00:00
|
|
|
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 {
|
2021-10-05 20:20:09 +00:00
|
|
|
fullScreen ? 0 : (playerHeight + additionalPadding)
|
2021-08-22 19:13:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func body(content: Content) -> some View {
|
|
|
|
content
|
|
|
|
.padding(.top, topPadding)
|
|
|
|
}
|
|
|
|
}
|