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

Closes: #192
This commit is contained in:
gladiusKatana
2022-12-29 20:17:24 -05:00
committed by William Casarin
parent d0e9e6c03a
commit 3d5a098423

View File

@@ -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,8 +178,15 @@ 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)
}
} }
struct SaveKeysView_Previews: PreviewProvider { struct SaveKeysView_Previews: PreviewProvider {