damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 3d5a098423802a9e9d4f934d71ac2398e4ed3e65
parent d0e9e6c03a77ac4d3d122a5f8f08a64821df8296
Author: gladiusKatana <garthsnyder@protonmail.com>
Date:   Thu, 29 Dec 2022 20:17:24 -0500

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

Closes: #192

Diffstat:
Mdamus/Views/SaveKeysView.swift | 37++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/damus/Views/SaveKeysView.swift b/damus/Views/SaveKeysView.swift @@ -147,20 +147,24 @@ struct SaveKeyView: View { var body: some View { HStack { - Button(action: copy_text) { - Label("", systemImage: is_copied ? "checkmark.circle.fill" : "doc.on.doc") - .foregroundColor(is_copied ? .green : .white) - .background { - if is_copied { - Circle() - .foregroundColor(.white) - .frame(width: 25, height: 25, alignment: .center) - .padding(.leading, -8) - .padding(.top, 1) - } else { - EmptyView() + Spacer() + VStack { + spacerBlock(width: 0, height: 0) + Button(action: copy_text) { + Label("", systemImage: is_copied ? "checkmark.circle.fill" : "doc.on.doc") + .foregroundColor(is_copied ? .green : .white) + .background { + if is_copied { + Circle() + .foregroundColor(.white) + .frame(width: 25, height: 25, alignment: .center) + .padding(.leading, -8) + .padding(.top, 1) + } else { + EmptyView() + } } - } + } } Text(text) @@ -174,8 +178,15 @@ struct SaveKeyView: View { .onTapGesture { 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 {