101 lines
3.5 KiB
Swift
101 lines
3.5 KiB
Swift
import SwiftUI
|
|
|
|
struct EntryBrand: View {
|
|
var body: some View {
|
|
HStack(spacing: 9) {
|
|
Image("BrandMark")
|
|
.resizable()
|
|
.frame(width: 32, height: 32)
|
|
.clipShape(.rect(cornerRadius: 8))
|
|
.accessibilityHidden(true)
|
|
Text("见物").font(.headline)
|
|
}
|
|
}
|
|
}
|
|
|
|
extension Color {
|
|
static func entryBackground(for scheme: ColorScheme) -> Color {
|
|
scheme == .dark ? Color(uiColor: .systemBackground) : Color(red: 0.976, green: 0.969, blue: 0.951)
|
|
}
|
|
}
|
|
|
|
struct WelcomeView: View {
|
|
let account: AtlasAccount
|
|
@Environment(\.colorScheme) private var colorScheme
|
|
@Environment(\.dynamicTypeSize) private var dynamicType
|
|
@ScaledMetric(relativeTo: .largeTitle) private var headlineSize = 41.0
|
|
|
|
var body: some View {
|
|
GeometryReader { viewport in
|
|
ScrollView {
|
|
VStack(alignment: .leading, spacing: 19) {
|
|
EntryBrand()
|
|
if dynamicType.isAccessibilitySize { headline }
|
|
scene
|
|
Text("说一句「数据线放在书房抽屉」,见物帮你记下。")
|
|
.font(.body)
|
|
.foregroundStyle(.primary.opacity(0.77))
|
|
.lineSpacing(4)
|
|
signInLink
|
|
.padding(.top, 4)
|
|
}
|
|
.frame(maxWidth: 460, alignment: .leading)
|
|
.padding(.horizontal, 23)
|
|
.padding(.vertical, 16)
|
|
.frame(maxWidth: .infinity, minHeight: viewport.size.height)
|
|
}
|
|
}
|
|
.background(Color.entryBackground(for: colorScheme).ignoresSafeArea())
|
|
.toolbar(.hidden, for: .navigationBar)
|
|
}
|
|
|
|
private var signInLink: some View {
|
|
NavigationLink {
|
|
SignInView(account: account)
|
|
} label: {
|
|
HStack(spacing: 9) {
|
|
Text("进入我的空间")
|
|
Image(systemName: "arrow.right").accessibilityHidden(true)
|
|
}
|
|
.font(.body.weight(.semibold))
|
|
.frame(maxWidth: .infinity, minHeight: 29)
|
|
}
|
|
.buttonStyle(.borderedProminent)
|
|
.buttonBorderShape(.roundedRectangle(radius: 15))
|
|
.controlSize(.large)
|
|
}
|
|
|
|
private var headline: some View {
|
|
Text("家里有的,\n心里有数。")
|
|
.font(.system(size: headlineSize, weight: .semibold))
|
|
.accessibilityAddTraits(.isHeader)
|
|
}
|
|
|
|
private var scene: some View {
|
|
Color.atlasNavy
|
|
.aspectRatio(0.86, contentMode: .fit)
|
|
.overlay {
|
|
GeometryReader { proxy in
|
|
Image("WelcomeTray")
|
|
.resizable()
|
|
.scaledToFill()
|
|
.frame(width: proxy.size.width, height: proxy.size.height)
|
|
.accessibilityHidden(true)
|
|
}
|
|
}
|
|
.overlay(alignment: .topLeading) {
|
|
if !dynamicType.isAccessibilitySize {
|
|
ZStack(alignment: .topLeading) {
|
|
LinearGradient(colors: [.black.opacity(0.36), .clear], startPoint: .top, endPoint: .center)
|
|
.accessibilityHidden(true)
|
|
headline
|
|
.foregroundStyle(.white)
|
|
.padding(.horizontal, 23)
|
|
.padding(.top, 23)
|
|
}
|
|
}
|
|
}
|
|
.clipShape(.rect(cornerRadius: 25))
|
|
}
|
|
}
|