Present sheets as a full bottom drawer

This commit is contained in:
2026-10-03 23:42:46 +08:00
parent 782143e87b
commit 31429e6923
7 changed files with 148 additions and 50 deletions
+22 -29
View File
@@ -6,8 +6,7 @@ struct AddressQR: Identifiable {
let address: String
}
/// Drawer that shows one address as a scannable QR, presented from the bottom
/// like the transaction detail sheet.
/// One address as a scannable QR, shown inside the shared bottom drawer.
struct AddressQRSheet: View {
var title: String
var address: String
@@ -16,38 +15,32 @@ struct AddressQRSheet: View {
@State private var copied = false
var body: some View {
ZStack {
Theme.background.ignoresSafeArea()
VStack(spacing: 16) {
Text(title)
.font(.system(size: 16, weight: .semibold))
.foregroundStyle(Theme.text)
.frame(maxWidth: .infinity, alignment: .leading)
VStack(spacing: 16) {
Text(title)
.font(.system(size: 16, weight: .semibold))
.foregroundStyle(Theme.text)
.frame(maxWidth: .infinity, alignment: .leading)
QRCodeView(text: address)
.frame(maxWidth: 220)
QRCodeView(text: address)
.frame(maxWidth: 220)
Text(address)
.font(.system(size: 12, design: .monospaced))
.foregroundStyle(Theme.muted)
.multilineTextAlignment(.center)
.lineLimit(4)
.truncationMode(.middle)
.textSelection(.enabled)
Text(address)
.font(.system(size: 12, design: .monospaced))
.foregroundStyle(Theme.muted)
.multilineTextAlignment(.center)
.lineLimit(4)
.truncationMode(.middle)
.textSelection(.enabled)
SecondaryButton(title: copied ? "Copied" : "Copy address") {
UIPasteboard.general.string = address
copied = true
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { copied = false }
}
PrimaryButton(title: "Done", action: onDone)
SecondaryButton(title: copied ? "Copied" : "Copy address") {
UIPasteboard.general.string = address
copied = true
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { copied = false }
}
.padding(22)
.frame(maxHeight: .infinity, alignment: .top)
PrimaryButton(title: "Done", action: onDone)
}
.padding(.horizontal, 22)
.preferredColorScheme(.dark)
.presentationDetents([.medium, .large])
.presentationDragIndicator(.visible)
}
}