Compare commits

...

2 Commits

Author SHA1 Message Date
6b645dedf0 refactor: 移除指引窗口的动画效果以简化代码 2025-12-27 20:15:27 +08:00
3cb14be4bc feat(UI): 添加动画效果和优化界面布局
为菜单内容和指引界面添加平滑的动画过渡效果
优化权限管理区域的布局和视觉层次
调整窗口打开/关闭时的渐变动画
2025-12-27 20:09:29 +08:00
2 changed files with 37 additions and 21 deletions

View File

@@ -250,6 +250,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
@@ -259,6 +260,7 @@
ENABLE_PREVIEWS = YES;
ENABLE_USER_SELECTED_FILES = readonly;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_LSUIElement = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@@ -274,7 +276,6 @@
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
INFOPLIST_KEY_LSUIElement = YES;
};
name = Debug;
};
@@ -283,6 +284,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
@@ -292,6 +294,7 @@
ENABLE_PREVIEWS = YES;
ENABLE_USER_SELECTED_FILES = readonly;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_LSUIElement = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@@ -307,7 +310,6 @@
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
INFOPLIST_KEY_LSUIElement = YES;
};
name = Release;
};

View File

@@ -55,12 +55,15 @@ struct MenuContent: View {
//
Button(action: {
//
withAnimation(.easeInOut(duration: 0.3)) {
appState.toggleFunction()
}
}) {
HStack(spacing: 12) {
Image(systemName: appState.isFunctionEnabled ? "stop.circle.fill" : "play.circle.fill")
.foregroundColor(appState.isFunctionEnabled ? .red : .green)
.font(.title2)
.transition(.scale(scale: 0.8, anchor: .center))
VStack(alignment: .leading, spacing: 2) {
Text(appState.isFunctionEnabled ? "关闭常亮" : "开启常亮")
.font(.body)
@@ -74,11 +77,14 @@ struct MenuContent: View {
.background(
RoundedRectangle(cornerRadius: 8)
.fill(appState.isFunctionEnabled ? Color.red.opacity(0.1) : Color.green.opacity(0.1))
.transition(.opacity)
)
}
.buttonStyle(.plain)
Divider()
.transition(.opacity)
.animation(.easeInOut(duration: 0.3), value: appState.isFunctionEnabled)
//
VStack(alignment: .leading, spacing: 4) {
@@ -91,6 +97,7 @@ struct MenuContent: View {
Circle()
.fill(appState.isUserIdle ? Color.orange : Color.green)
.frame(width: 8, height: 8)
.transition(.scale(scale: 0.5, anchor: .center))
Text(appState.isUserIdle ? "空闲" : "活动中")
.font(.body)
@@ -112,6 +119,8 @@ struct MenuContent: View {
}
Spacer()
}
.transition(.opacity)
.animation(.easeInOut(duration: 0.3), value: appState.isFunctionEnabled || appState.isUserIdle)
}
.padding(8)
.background(
@@ -122,7 +131,7 @@ struct MenuContent: View {
Divider()
//
VStack(alignment: .leading, spacing: 4) {
VStack(alignment: .leading, spacing: 8) {
Text("权限管理")
.font(.caption)
.foregroundColor(.secondary)
@@ -147,9 +156,15 @@ struct MenuContent: View {
.font(.caption)
.foregroundColor(.blue)
}
.padding(8)
.frame(maxWidth: .infinity, alignment: .leading)
.background(
RoundedRectangle(cornerRadius: 8)
.fill(Color.blue.opacity(0.05))
)
}
.buttonStyle(.plain)
.padding(4)
//
Button(action: {
@@ -164,11 +179,16 @@ struct MenuContent: View {
.font(.caption)
.foregroundColor(.blue)
}
.padding(8)
.frame(maxWidth: .infinity, alignment: .leading)
.background(
RoundedRectangle(cornerRadius: 8)
.fill(Color.blue.opacity(0.05))
)
}
.buttonStyle(.plain)
.padding(4)
}
.padding(4)
.padding(8)
Divider()
@@ -185,7 +205,7 @@ struct MenuContent: View {
}
.toggleStyle(.checkbox)
.font(.caption)
.padding(4)
.padding(8)
Divider()
@@ -197,7 +217,7 @@ struct MenuContent: View {
.buttonStyle(.plain)
.font(.caption)
.foregroundColor(.secondary)
.padding(4)
.padding(8)
Divider()
@@ -208,7 +228,7 @@ struct MenuContent: View {
.buttonStyle(.plain)
.font(.caption)
.foregroundColor(.secondary)
.padding(4)
.padding(8)
}
.padding(12)
.frame(minWidth: 280)
@@ -239,6 +259,8 @@ struct MenuContent: View {
window.title = "PowerBar 使用指南"
window.contentView = NSHostingView(rootView: GuideView())
window.center()
//
window.makeKeyAndOrderFront(nil)
//
@@ -246,16 +268,6 @@ struct MenuContent: View {
//
guideWindow = window
//
NotificationCenter.default.addObserver(
forName: NSWindow.willCloseNotification,
object: window,
queue: nil
) { _ in
//
guideWindow = nil
}
}
}
@@ -308,7 +320,7 @@ struct GuideView: View {
}
HStack(spacing: 12) {
Image(systemName: "power.on.circle")
Image(systemName: "power.circle")
.font(.title)
.foregroundColor(.orange)
.frame(width: 40)
@@ -415,6 +427,8 @@ struct GuideView: View {
RoundedRectangle(cornerRadius: 8)
.fill(.blue)
)
.transition(.scale(scale: 0.9, anchor: .center))
.animation(.easeInOut(duration: 0.2), value: UUID())
}
.padding(.bottom, 20)
}