Created
August 8, 2021 18:29
-
-
Save dsandif/e981c4a42612bc5bd1f62ea687992fc4 to your computer and use it in GitHub Desktop.
A Welcome screen with a gradient / frosted background
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Net Estate | |
// | |
// Created by Darien Sandifer on 8/8/21. | |
// | |
import SwiftUI | |
struct WelcomeView: View { | |
var backGroundGradient: some View{ | |
LinearGradient(gradient: Gradient(colors: [Color.green.opacity(0.4),Color.flatGreen.opacity(0.6),Color.blue.opacity(0.3)]), startPoint: .topLeading, endPoint: .bottomTrailing) | |
} | |
var logo: some View{ | |
Circle() | |
.opacity(0) | |
.background(Color.white.opacity(0.6).clipShape(Circle())) | |
.frame(width: 200, height: 200) | |
.overlay( | |
Image(systemName: "folder.fill") | |
.font(.system(size: 100)) | |
.foregroundColor(.teal) | |
) | |
} | |
var frostedArea: some View{ | |
HStack{ | |
Spacer() | |
VStack(alignment: .leading, spacing: 20){ | |
logo.offset(x: 50.0, y: 0).padding(.bottom, 30) | |
description.offset(CGSize(width: -60.0, height: 0)) | |
} | |
Spacer() | |
} | |
} | |
var description: some View{ | |
VStack(alignment: .leading){ | |
Group{ | |
Text("File") | |
.bold() | |
Text("Manager_") | |
.fontWeight(.light) | |
} | |
.foregroundColor(.backgroundBlue.opacity(0.8)) | |
.font(.system(size: 50)) | |
Text("It's a simple option that doesn't have a lot of flair. Let's manage your files.") | |
.font(.headline) | |
.foregroundColor(.black.opacity(0.35)) | |
.frame(maxWidth: 300, alignment: .leading) | |
.padding([.vertical],25) | |
Button(action: {}) { | |
HStack { | |
Image(systemName: "lock.shield") | |
.font(.title) | |
Text("Unlock") | |
.fontWeight(.bold) | |
.font(.title3) | |
} | |
.frame(minWidth: 0, maxWidth: 200) | |
.padding() | |
.foregroundColor(.white.opacity(0.7)) | |
.background( | |
LinearGradient(gradient: Gradient(colors: [Color.teal, Color.flatGreen]), startPoint: .leading, endPoint: .trailing)) | |
} | |
.cornerRadius(40) | |
.padding(.top,25) | |
} | |
.multilineTextAlignment(.leading) | |
} | |
var body: some View { | |
ZStack{ | |
backGroundGradient | |
Color.white | |
.opacity(0.15) | |
.frame(width: 500, height: 700, alignment: .center) | |
.cornerRadius(50) | |
.overlay(frostedArea) | |
}.edgesIgnoringSafeArea(.all) | |
} | |
} | |
struct WelcomeView_Previews: PreviewProvider { | |
static var previews: some View { | |
WelcomeView() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment