Skip to content

Commit

Permalink
Add gradient example
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea authored and Andrea committed Aug 30, 2023
1 parent 4d185f4 commit 6c61890
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
01D3460C27CA64E40061D4C7 /* ListExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01D345FD27CA64E40061D4C7 /* ListExample.swift */; };
01D3460E27CA64E40061D4C7 /* BaseExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01D345FE27CA64E40061D4C7 /* BaseExample.swift */; };
01D3461027CA64E40061D4C7 /* PushNavigationExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01D345FF27CA64E40061D4C7 /* PushNavigationExample.swift */; };
65AE69B82A9F7A6600DDA4F1 /* GradientSheetExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AE69B72A9F7A6500DDA4F1 /* GradientSheetExample.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -42,6 +43,7 @@
01D345FE27CA64E40061D4C7 /* BaseExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseExample.swift; sourceTree = "<group>"; };
01D345FF27CA64E40061D4C7 /* PushNavigationExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushNavigationExample.swift; sourceTree = "<group>"; };
01F64A5727CD89E8000D9AC0 /* PartialSheet */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = PartialSheet; path = ..; sourceTree = "<group>"; };
65AE69B72A9F7A6500DDA4F1 /* GradientSheetExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GradientSheetExample.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -64,6 +66,7 @@
01B5932327CD29E300072948 /* CustonAnimationExample.swift */,
01B5932027CA9E6A00072948 /* ScrollViewExample.swift */,
01D345F727CA64E30061D4C7 /* BlurredSheetExample.swift */,
65AE69B72A9F7A6500DDA4F1 /* GradientSheetExample.swift */,
01D345FC27CA64E40061D4C7 /* DatePickerExample.swift */,
01D345F827CA64E30061D4C7 /* HandlerBarFreeExample.swift */,
01D345FD27CA64E40061D4C7 /* ListExample.swift */,
Expand Down Expand Up @@ -201,6 +204,7 @@
01D3460827CA64E40061D4C7 /* TextfieldExample.swift in Sources */,
01D3460C27CA64E40061D4C7 /* ListExample.swift in Sources */,
01D345DF27CA61D40061D4C7 /* ContentView.swift in Sources */,
65AE69B82A9F7A6600DDA4F1 /* GradientSheetExample.swift in Sources */,
01D345DD27CA61D40061D4C7 /* PartialSheet_ExampleApp.swift in Sources */,
01D3460427CA64E40061D4C7 /* AnimationContentExample.swift in Sources */,
01D3460227CA64E40061D4C7 /* HandlerBarFreeExample.swift in Sources */,
Expand Down
4 changes: 4 additions & 0 deletions PartialSheet-Example/Shared/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ struct ContentView: View {
destination: BlurredExample(),
label: {Text("Blurred Example")
})
NavigationLink(
destination: GradientExample(),
label: {Text("Gradient Example")
})
NavigationLink(
destination: AnimationContentExample(),
label: {Text("AnimationContent Example")
Expand Down
65 changes: 65 additions & 0 deletions PartialSheet-Example/Shared/Examples/GradientSheetExample.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//
// BlurredSheetExample.swift
// PartialSheetExample
//
// Created by Rasmus Styrk on 14/08/2020.
// Copyright © 2020 Swift. All rights reserved.
//

import SwiftUI
import PartialSheet

struct GradientExample: View {
@State var isSheetPresented = false
let iPhoneStyle = PSIphoneStyle(
background: .gradient(LinearGradient(colors: [.red, .yellow], startPoint: .bottom, endPoint: .top)),
handleBarStyle: .solid(.secondary),
cover: .enabled(Color.black.opacity(0.4)),
cornerRadius: 10
)

var body: some View {
VStack {
Spacer()
PSButton(
isPresenting: $isSheetPresented,
label: {
Text("Display the GrdientExample Sheet")
})
.padding()
Spacer()
}
.navigationBarTitle("Gradient Example")
.partialSheet(isPresented: $isSheetPresented,
type: .scrollView(height: 300, showsIndicators: false),
iPhoneStyle: iPhoneStyle,
content: GradeintSheetView.init)
}
}

struct GradientExample_Previews: PreviewProvider {
static var previews: some View {
NavigationView {
BlurredExample()
}
.navigationViewStyle(StackNavigationViewStyle())
.attachPartialSheetToRoot()

}
}

struct GradeintSheetView: View {
@State private var selectedStrength = 0

var body: some View {
VStack(alignment: .center, spacing: 20) {
Text("Settings Panel").font(.headline).foregroundColor(Color.primary)
Group {
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.")
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.")
}
.font(.subheadline).foregroundColor(Color.primary)
}
.padding()
}
}

0 comments on commit 6c61890

Please sign in to comment.