Browse Source

SaveKeyView: add spacers to make Text frames invariant upon Copy-tap

Closes: #192
post-button-style
gladiusKatana 2 years ago
committed by William Casarin
parent
commit
3d5a098423
  1. 11
      damus/Views/SaveKeysView.swift

11
damus/Views/SaveKeysView.swift

@ -147,6 +147,9 @@ struct SaveKeyView: View {
var body: some View { var body: some View {
HStack { HStack {
Spacer()
VStack {
spacerBlock(width: 0, height: 0)
Button(action: copy_text) { Button(action: copy_text) {
Label("", systemImage: is_copied ? "checkmark.circle.fill" : "doc.on.doc") Label("", systemImage: is_copied ? "checkmark.circle.fill" : "doc.on.doc")
.foregroundColor(is_copied ? .green : .white) .foregroundColor(is_copied ? .green : .white)
@ -162,6 +165,7 @@ struct SaveKeyView: View {
} }
} }
} }
}
Text(text) Text(text)
.padding(5) .padding(5)
@ -174,7 +178,14 @@ struct SaveKeyView: View {
.onTapGesture { .onTapGesture {
copy_text() copy_text()
} }
spacerBlock(width: 0, height: 0) /// set a 'width' > 0 here to vary key Text's aspect ratio
}
} }
@ViewBuilder private func spacerBlock(width: CGFloat, height: CGFloat) -> some View {
Color.orange.opacity(1)
.frame(width: width, height: height)
} }
} }

Loading…
Cancel
Save