30 lines
851 B
Swift
30 lines
851 B
Swift
import SwiftUI
|
|
|
|
struct ScanProgressView: View {
|
|
let progress: ScanProgress
|
|
let onCancel: () -> Void
|
|
|
|
var body: some View {
|
|
VStack(spacing: 14) {
|
|
if let fraction = progress.fractionCompleted {
|
|
ProgressView(value: fraction) {
|
|
Text(progress.phase.label)
|
|
} currentValueLabel: {
|
|
Text(progress.detailText)
|
|
.monospacedDigit()
|
|
}
|
|
} else {
|
|
ProgressView {
|
|
Text(progress.phase.label)
|
|
}
|
|
}
|
|
|
|
Button("中止", role: .cancel, action: onCancel)
|
|
}
|
|
.frame(width: 300)
|
|
.padding(24)
|
|
.background(.regularMaterial, in: RoundedRectangle(cornerRadius: 14, style: .continuous))
|
|
.shadow(radius: 20)
|
|
}
|
|
}
|