You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

188 lines
9.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

//
// ContentView.swift
// MyQrCode
//
// Created by dev on 2025/8/19.
//
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
ZStack {
//
LinearGradient(
gradient: Gradient(colors: [
Color(.systemBackground),
Color(.systemGray6).opacity(0.3)
]),
startPoint: .top,
endPoint: .bottom
)
.ignoresSafeArea()
VStack(spacing: 24) {
//
VStack(spacing: 12) {
Text("QR Code Creator")
.font(.system(size: 34, weight: .bold, design: .rounded))
.foregroundColor(.primary)
Text("快速创建和扫描二维码")
.font(.system(size: 16, weight: .medium))
.foregroundColor(.secondary)
.multilineTextAlignment(.center)
}
.padding(.top, 0)
//
VStack(spacing: 18) {
// -
NavigationLink(destination: CodeTypeSelectionView()) {
VStack(alignment: .leading, spacing: 20) {
HStack {
Image(systemName: "qrcode")
.font(.system(size: 32, weight: .bold))
.foregroundColor(.white)
Spacer()
Image(systemName: "arrow.up.right")
.font(.system(size: 22, weight: .medium))
.foregroundColor(.white.opacity(0.8))
}
VStack(alignment: .leading, spacing: 12) {
Text("创建二维码")
.font(.system(size: 28, weight: .bold))
.foregroundColor(.white)
Text("生成文本、链接、WiFi、联系人等各种二维码")
.font(.system(size: 16))
.foregroundColor(.white.opacity(0.9))
.lineLimit(2)
}
}
.padding(24)
.frame(maxWidth: .infinity, minHeight: 160)
.background(
LinearGradient(
gradient: Gradient(colors: [
Color.purple,
Color.blue,
Color.purple.opacity(0.8)
]),
startPoint: .topLeading,
endPoint: .bottomTrailing
)
)
.cornerRadius(24)
.shadow(color: .purple.opacity(0.4), radius: 20, x: 0, y: 10)
}
.padding(.horizontal, 20)
// -
HStack(spacing: 14) {
//
NavigationLink(destination: ScannerView()) {
VStack(alignment: .leading, spacing: 12) {
HStack {
Image(systemName: "camera.fill")
.font(.system(size: 22, weight: .medium))
.foregroundColor(.white)
Spacer()
}
VStack(alignment: .leading, spacing: 6) {
Text("扫描识别")
.font(.system(size: 16, weight: .bold))
.foregroundColor(.white)
Text("扫描二维码")
.font(.system(size: 13))
.foregroundColor(.white.opacity(0.9))
}
}
.padding(16)
.frame(maxWidth: .infinity, minHeight: 100)
.background(
LinearGradient(
gradient: Gradient(colors: [
Color.blue,
Color.blue.opacity(0.8)
]),
startPoint: .topLeading,
endPoint: .bottomTrailing
)
)
.cornerRadius(16)
.shadow(color: .blue.opacity(0.25), radius: 8, x: 0, y: 4)
}
//
NavigationLink(destination: HistoryView()) {
VStack(alignment: .leading, spacing: 12) {
HStack {
Image(systemName: "clock.arrow.circlepath")
.font(.system(size: 22, weight: .medium))
.foregroundColor(.white)
Spacer()
}
VStack(alignment: .leading, spacing: 6) {
Text("历史记录")
.font(.system(size: 16, weight: .bold))
.foregroundColor(.white)
Text("查看历史")
.font(.system(size: 13))
.foregroundColor(.white.opacity(0.9))
}
}
.padding(16)
.frame(maxWidth: .infinity, minHeight: 100)
.background(
LinearGradient(
gradient: Gradient(colors: [
Color.orange,
Color.orange.opacity(0.8)
]),
startPoint: .topLeading,
endPoint: .bottomTrailing
)
)
.cornerRadius(16)
.shadow(color: .orange.opacity(0.25), radius: 8, x: 0, y: 4)
}
}
.padding(.horizontal, 20)
}
Spacer(minLength: 0)
}
.padding(.top, 0)
}
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
NavigationLink(destination: SettingsView()) {
Image(systemName: "gearshape.fill")
.font(.system(size: 18, weight: .medium))
.foregroundColor(.primary)
}
}
}
}
}
}
#if DEBUG
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
#endif