2021-08-23 00:43:33 +05:30
|
|
|
import Foundation
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct VideoDetailsPaddingModifier: ViewModifier {
|
2022-06-25 05:09:29 +05:30
|
|
|
static var defaultAdditionalDetailsPadding = 0.0
|
2021-10-06 01:50:09 +05:30
|
|
|
|
2022-06-27 03:45:01 +05:30
|
|
|
let playerSize: CGSize
|
2021-09-19 02:06:42 +05:30
|
|
|
let minimumHeightLeft: Double
|
|
|
|
let additionalPadding: Double
|
2021-10-06 01:50:09 +05:30
|
|
|
let fullScreen: Bool
|
2021-08-23 00:43:33 +05:30
|
|
|
|
|
|
|
init(
|
2022-06-27 03:45:01 +05:30
|
|
|
playerSize: CGSize,
|
2021-09-19 02:06:42 +05:30
|
|
|
minimumHeightLeft: Double? = nil,
|
2021-10-06 01:50:09 +05:30
|
|
|
additionalPadding: Double? = nil,
|
|
|
|
fullScreen: Bool = false
|
2021-08-23 00:43:33 +05:30
|
|
|
) {
|
2022-06-27 03:45:01 +05:30
|
|
|
self.playerSize = playerSize
|
2021-08-23 00:43:33 +05:30
|
|
|
self.minimumHeightLeft = minimumHeightLeft ?? VideoPlayerView.defaultMinimumHeightLeft
|
2022-05-21 01:23:17 +05:30
|
|
|
self.additionalPadding = additionalPadding ?? Self.defaultAdditionalDetailsPadding
|
2021-10-06 01:50:09 +05:30
|
|
|
self.fullScreen = fullScreen
|
2021-08-23 00:43:33 +05:30
|
|
|
}
|
|
|
|
|
2021-09-19 02:06:42 +05:30
|
|
|
var playerHeight: Double {
|
2022-06-27 03:45:01 +05:30
|
|
|
playerSize.height
|
2021-08-23 00:43:33 +05:30
|
|
|
}
|
|
|
|
|
2021-09-19 02:06:42 +05:30
|
|
|
var topPadding: Double {
|
2021-10-06 01:50:09 +05:30
|
|
|
fullScreen ? 0 : (playerHeight + additionalPadding)
|
2021-08-23 00:43:33 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
func body(content: Content) -> some View {
|
|
|
|
content
|
|
|
|
.padding(.top, topPadding)
|
|
|
|
}
|
|
|
|
}
|