Files
汉秋 28db8b3182 优化相册管理与指定上传弹层展示逻辑。
相册详情网格仅对已购买素材显示角标;指定上传 Sheet 改用 NavigationStack 与系统 navigationTitle。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 14:00:46 +08:00

91 lines
3.2 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// SpecifyUploadBottomSheet.swift
// suixinkan
//
import SwiftUI
/// Bottom Sheet Android SpecifyUploadBottomSheet
struct SpecifyUploadBottomSheet: View {
@Binding var isPresented: Bool
let onConfirm: (String) -> Void
@State private var selectedOption = WiredCameraTransferViewModel.specifyUploadAllPending
private let options = [
WiredCameraTransferViewModel.specifyUploadAllPending,
WiredCameraTransferViewModel.specifyUploadTodayCaptured
]
var body: some View {
NavigationStack {
VStack(spacing: 0) {
VStack(spacing: 12) {
ForEach(options, id: \.self) { option in
optionRow(option)
}
}
.padding(.horizontal, 16)
.padding(.top, 12)
Spacer(minLength: 20)
HStack(spacing: 12) {
Button("取消") { isPresented = false }
.font(.system(size: 16, weight: .medium))
.foregroundStyle(AppDesign.primary)
.frame(maxWidth: .infinity)
.frame(height: 48)
.background(Color.white)
.overlay {
RoundedRectangle(cornerRadius: 10)
.stroke(AppDesign.primary, lineWidth: 1)
}
Button("确认上传") {
onConfirm(selectedOption)
}
.font(.system(size: 16, weight: .medium))
.foregroundStyle(.white)
.frame(maxWidth: .infinity)
.frame(height: 48)
.background(AppDesign.primary)
.clipShape(RoundedRectangle(cornerRadius: 10))
}
.padding(.horizontal, 16)
.padding(.vertical, 12)
}
.background(WiredTransferDesign.pageBackground)
.navigationTitle("指定上传")
.navigationBarTitleDisplayMode(.inline)
}
.onAppear {
selectedOption = options.first ?? WiredCameraTransferViewModel.specifyUploadAllPending
}
}
private func optionRow(_ option: String) -> some View {
Button {
selectedOption = option
} label: {
HStack {
Text(option)
.font(.system(size: 15))
.foregroundStyle(WiredTransferDesign.text333)
.frame(maxWidth: .infinity, alignment: .leading)
Image(systemName: selectedOption == option ? "largecircle.fill.circle" : "circle")
.foregroundStyle(selectedOption == option ? WiredTransferDesign.text333 : WiredTransferDesign.borderLight)
}
.padding(.horizontal, 14)
.padding(.vertical, 8)
.background(Color.white)
.clipShape(RoundedRectangle(cornerRadius: 10))
.overlay {
RoundedRectangle(cornerRadius: 10)
.stroke(WiredTransferDesign.borderLight, lineWidth: 1)
}
}
.buttonStyle(.plain)
}
}