fix View
This commit is contained in:
parent
067ac7c092
commit
c84bd4d12d
26
punchnet/Views/Common/VisualEffectView.swift
Normal file
26
punchnet/Views/Common/VisualEffectView.swift
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// VisualEffectView.swift
|
||||||
|
// punchnet
|
||||||
|
//
|
||||||
|
// Created by 安礼成 on 2026/3/24.
|
||||||
|
//
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
// MARK: - 1. 基础 UI 组件 (已修正 Material 枚举)
|
||||||
|
struct VisualEffectView: NSViewRepresentable {
|
||||||
|
let material: NSVisualEffectView.Material
|
||||||
|
let blendingMode: NSVisualEffectView.BlendingMode
|
||||||
|
|
||||||
|
func makeNSView(context: Context) -> NSVisualEffectView {
|
||||||
|
let view = NSVisualEffectView()
|
||||||
|
view.material = material
|
||||||
|
view.blendingMode = blendingMode
|
||||||
|
view.state = .active
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateNSView(_ nsView: NSVisualEffectView, context: Context) {
|
||||||
|
nsView.material = material
|
||||||
|
nsView.blendingMode = blendingMode
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -13,27 +13,22 @@ struct RegisterRootView: View {
|
|||||||
@Environment(AppContext.self) private var appContext: AppContext
|
@Environment(AppContext.self) private var appContext: AppContext
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ZStack {
|
ZStack(alignment: .center) {
|
||||||
Color.clear
|
switch registerModel.stage {
|
||||||
.ignoresSafeArea()
|
case .requestVerifyCode:
|
||||||
|
RegisterRequestVerifyCodeView()
|
||||||
ZStack(alignment: .center) {
|
case .submitVerifyCode:
|
||||||
switch registerModel.stage {
|
RegisterSubmitVerifyCodeView()
|
||||||
case .requestVerifyCode:
|
case .setPassword:
|
||||||
RegisterRequestVerifyCodeView()
|
RegisterSetPasswordView()
|
||||||
case .submitVerifyCode:
|
case .success:
|
||||||
RegisterSubmitVerifyCodeView()
|
RegisterSuccessView()
|
||||||
case .setPassword:
|
|
||||||
RegisterSetPasswordView()
|
|
||||||
case .success:
|
|
||||||
RegisterSuccessView()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.transition(.asymmetric(
|
|
||||||
insertion: .move(edge: registerModel.transitionEdge).combined(with: .opacity),
|
|
||||||
removal: .move(edge: registerModel.transitionEdge == .trailing ? .leading : .trailing).combined(with: .opacity)
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
.transition(.asymmetric(
|
||||||
|
insertion: .move(edge: registerModel.transitionEdge).combined(with: .opacity),
|
||||||
|
removal: .move(edge: registerModel.transitionEdge == .trailing ? .leading : .trailing).combined(with: .opacity)
|
||||||
|
))
|
||||||
.environment(registerModel)
|
.environment(registerModel)
|
||||||
// --- 核心改动:使用 overlay ---
|
// --- 核心改动:使用 overlay ---
|
||||||
.overlay(alignment: .topLeading) {
|
.overlay(alignment: .topLeading) {
|
||||||
|
|||||||
@ -13,27 +13,22 @@ struct ResetPasswordRootView: View {
|
|||||||
@Environment(AppContext.self) private var appContext: AppContext
|
@Environment(AppContext.self) private var appContext: AppContext
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ZStack {
|
ZStack(alignment: .center) {
|
||||||
Color.clear
|
switch resetPasswordModel.stage {
|
||||||
.ignoresSafeArea()
|
case .requestVerifyCode:
|
||||||
|
GetVerifyCodeView()
|
||||||
ZStack(alignment: .center) {
|
case .submitVerifyCode:
|
||||||
switch resetPasswordModel.stage {
|
SubmitVerifyCodeView()
|
||||||
case .requestVerifyCode:
|
case .resetPassword:
|
||||||
GetVerifyCodeView()
|
ResetPasswordView()
|
||||||
case .submitVerifyCode:
|
case .success:
|
||||||
SubmitVerifyCodeView()
|
ResetPasswordSuccessView()
|
||||||
case .resetPassword:
|
|
||||||
ResetPasswordView()
|
|
||||||
case .success:
|
|
||||||
ResetPasswordSuccessView()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.transition(.asymmetric(
|
|
||||||
insertion: .move(edge: resetPasswordModel.transitionEdge).combined(with: .opacity),
|
|
||||||
removal: .move(edge: resetPasswordModel.transitionEdge == .trailing ? .leading : .trailing).combined(with: .opacity)
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
.transition(.asymmetric(
|
||||||
|
insertion: .move(edge: resetPasswordModel.transitionEdge).combined(with: .opacity),
|
||||||
|
removal: .move(edge: resetPasswordModel.transitionEdge == .trailing ? .leading : .trailing).combined(with: .opacity)
|
||||||
|
))
|
||||||
.environment(resetPasswordModel)
|
.environment(resetPasswordModel)
|
||||||
.overlay(alignment: .topLeading) {
|
.overlay(alignment: .topLeading) {
|
||||||
// 仅在非成功页面显示返回按钮
|
// 仅在非成功页面显示返回按钮
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user