Add missing gradient to lock screen placeholder. (#1991)

This commit is contained in:
Doug
2023-10-31 13:25:18 +00:00
committed by GitHub
parent 913b8ed244
commit b2f30974e3
3 changed files with 24 additions and 5 deletions
@@ -17,16 +17,29 @@
import SwiftUI
class PlaceholderScreenCoordinator: CoordinatorProtocol {
private let showsBackgroundGradient: Bool
init(showsBackgroundGradient: Bool = false) {
self.showsBackgroundGradient = showsBackgroundGradient
}
func toPresentable() -> AnyView {
AnyView(PlaceholderScreen())
AnyView(PlaceholderScreen(showsBackgroundGradient: showsBackgroundGradient))
}
}
/// The screen shown in split view when the detail has no content.
struct PlaceholderScreen: View {
let showsBackgroundGradient: Bool
var body: some View {
OnboardingLogo(isOnGradient: false)
OnboardingLogo(isOnGradient: showsBackgroundGradient)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background {
if showsBackgroundGradient {
OnboardingScreenBackgroundImage()
}
}
.background()
.environment(\.backgroundStyle, AnyShapeStyle(Color.compound.bgCanvasDefault))
.ignoresSafeArea(edges: .top)
@@ -35,9 +48,12 @@ struct PlaceholderScreen: View {
struct PlaceholderScreen_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
PlaceholderScreen()
PlaceholderScreen(showsBackgroundGradient: false)
.previewDisplayName("Screen")
PlaceholderScreen(showsBackgroundGradient: true)
.previewDisplayName("With background")
NavigationSplitView {
List {
ForEach("Nothing to see here".split(separator: " "), id: \.self) { word in
@@ -45,7 +61,7 @@ struct PlaceholderScreen_Previews: PreviewProvider, TestablePreview {
}
}
} detail: {
PlaceholderScreen()
PlaceholderScreen(showsBackgroundGradient: false)
}
.previewDisplayName("Split View")
.previewInterfaceOrientation(.landscapeLeft)