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,10 +13,6 @@ struct RegisterRootView: View {
|
||||
@Environment(AppContext.self) private var appContext: AppContext
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
Color.clear
|
||||
.ignoresSafeArea()
|
||||
|
||||
ZStack(alignment: .center) {
|
||||
switch registerModel.stage {
|
||||
case .requestVerifyCode:
|
||||
@ -33,7 +29,6 @@ struct RegisterRootView: View {
|
||||
insertion: .move(edge: registerModel.transitionEdge).combined(with: .opacity),
|
||||
removal: .move(edge: registerModel.transitionEdge == .trailing ? .leading : .trailing).combined(with: .opacity)
|
||||
))
|
||||
}
|
||||
.environment(registerModel)
|
||||
// --- 核心改动:使用 overlay ---
|
||||
.overlay(alignment: .topLeading) {
|
||||
|
||||
@ -13,10 +13,6 @@ struct ResetPasswordRootView: View {
|
||||
@Environment(AppContext.self) private var appContext: AppContext
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
Color.clear
|
||||
.ignoresSafeArea()
|
||||
|
||||
ZStack(alignment: .center) {
|
||||
switch resetPasswordModel.stage {
|
||||
case .requestVerifyCode:
|
||||
@ -33,7 +29,6 @@ struct ResetPasswordRootView: View {
|
||||
insertion: .move(edge: resetPasswordModel.transitionEdge).combined(with: .opacity),
|
||||
removal: .move(edge: resetPasswordModel.transitionEdge == .trailing ? .leading : .trailing).combined(with: .opacity)
|
||||
))
|
||||
}
|
||||
.environment(resetPasswordModel)
|
||||
.overlay(alignment: .topLeading) {
|
||||
// 仅在非成功页面显示返回按钮
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user