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

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

83 lines
2.9 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.

//
// TravelAlbumDetailMaterialGridItem.swift
// suixinkan
//
// Android MaterialGridItem
//
import SwiftUI
///
struct TravelAlbumDetailMaterialGridItem: View {
let material: TravelAlbumMaterial
let isSelectionMode: Bool
let isSelected: Bool
let onSelect: () -> Void
let onPreview: () -> Void
var body: some View {
VStack(alignment: .leading, spacing: 4) {
thumbnailSection
MiddleTruncatedText(
text: material.fileName,
font: .systemFont(ofSize: 11),
textColor: UIColor(TravelAlbumDetailDesign.text333)
)
.frame(maxWidth: .infinity, minHeight: 14, maxHeight: 14, alignment: .leading)
Text(WiredTransferPhotoRecord.formatFileSize(Int64(material.fileSize)))
.font(.system(size: 10))
.foregroundStyle(TravelAlbumDetailDesign.text999)
.lineLimit(1)
}
.frame(maxWidth: .infinity, alignment: .leading)
.contentShape(Rectangle())
.onTapGesture {
if isSelectionMode {
onSelect()
} else {
onPreview()
}
}
}
/// 1:1
private var thumbnailSection: some View {
Color.clear
.aspectRatio(1, contentMode: .fit)
.overlay {
RemoteImage(
urlString: material.thumbnailURLString,
contentMode: .fill
) {
Color(hex: 0xE5E7EB)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.clipShape(RoundedRectangle(cornerRadius: TravelAlbumDetailDesign.thumbnailCornerRadius))
.overlay(alignment: .topLeading) {
if material.isPurchased {
Text("已购买")
.font(.system(size: 10))
.foregroundStyle(.white)
.padding(.horizontal, 4)
.padding(.vertical, 2)
.background(AppDesign.primary)
.clipShape(RoundedRectangle(cornerRadius: TravelAlbumDetailDesign.uploadedBadgeCornerRadius))
.padding(4)
}
}
.overlay(alignment: .topTrailing) {
if isSelectionMode {
Image(systemName: isSelected ? "checkmark.circle.fill" : "circle")
.font(.system(size: TravelAlbumDetailDesign.selectionCheckSize))
.foregroundStyle(isSelected ? AppDesign.primary : .white)
.padding(4)
.background(Color.black.opacity(0.4), in: Circle())
.padding(4)
}
}
}
}