|
| 1 | +// |
| 2 | +// BlurredSheetExample.swift |
| 3 | +// PartialSheetExample |
| 4 | +// |
| 5 | +// Created by Rasmus Styrk on 14/08/2020. |
| 6 | +// Copyright © 2020 Swift. All rights reserved. |
| 7 | +// |
| 8 | + |
| 9 | +import SwiftUI |
| 10 | +import PartialSheet |
| 11 | + |
| 12 | +struct GradientExample: View { |
| 13 | + @State var isSheetPresented = false |
| 14 | + let iPhoneStyle = PSIphoneStyle( |
| 15 | + background: .gradient(LinearGradient(colors: [.red, .yellow], startPoint: .bottom, endPoint: .top)), |
| 16 | + handleBarStyle: .solid(.secondary), |
| 17 | + cover: .enabled(Color.black.opacity(0.4)), |
| 18 | + cornerRadius: 10 |
| 19 | + ) |
| 20 | + |
| 21 | + var body: some View { |
| 22 | + VStack { |
| 23 | + Spacer() |
| 24 | + PSButton( |
| 25 | + isPresenting: $isSheetPresented, |
| 26 | + label: { |
| 27 | + Text("Display the GrdientExample Sheet") |
| 28 | + }) |
| 29 | + .padding() |
| 30 | + Spacer() |
| 31 | + } |
| 32 | + .navigationBarTitle("Gradient Example") |
| 33 | + .partialSheet(isPresented: $isSheetPresented, |
| 34 | + type: .scrollView(height: 300, showsIndicators: false), |
| 35 | + iPhoneStyle: iPhoneStyle, |
| 36 | + content: GradeintSheetView.init) |
| 37 | + } |
| 38 | +} |
| 39 | + |
| 40 | +struct GradientExample_Previews: PreviewProvider { |
| 41 | + static var previews: some View { |
| 42 | + NavigationView { |
| 43 | + BlurredExample() |
| 44 | + } |
| 45 | + .navigationViewStyle(StackNavigationViewStyle()) |
| 46 | + .attachPartialSheetToRoot() |
| 47 | + |
| 48 | + } |
| 49 | +} |
| 50 | + |
| 51 | +struct GradeintSheetView: View { |
| 52 | + @State private var selectedStrength = 0 |
| 53 | + |
| 54 | + var body: some View { |
| 55 | + VStack(alignment: .center, spacing: 20) { |
| 56 | + Text("Settings Panel").font(.headline).foregroundColor(Color.primary) |
| 57 | + Group { |
| 58 | + Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce vestibulum porttitor ligula quis faucibus. Maecenas auctor tincidunt maximus. Donec lectus dui, fermentum sed orci gravida, porttitor porta dui. Fusce ut diam et diam venenatis molestie vel vel augue. Mauris at mauris porta, auctor lorem et, efficitur lacus.") |
| 59 | + Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce vestibulum porttitor ligula quis faucibus. Maecenas auctor tincidunt maximus. Donec lectus dui, fermentum sed orci gravida, porttitor porta dui. Fusce ut diam et diam venenatis molestie vel vel augue. Mauris at mauris porta, auctor lorem et, efficitur lacus.") |
| 60 | + } |
| 61 | + .font(.subheadline).foregroundColor(Color.primary) |
| 62 | + } |
| 63 | + .padding() |
| 64 | + } |
| 65 | +} |
0 commit comments