Skip to content

Commit

Permalink
Merge pull request #491 from Adamant-im/dev/trello.com/c/bfhjk1NL
Browse files Browse the repository at this point in the history
[trello.com/c/bfhjk1NL] Fixed: Back button disappears from the toolbar
  • Loading branch information
IanaaDvlp authored Jun 7, 2024
2 parents ed51f05 + 9a5a71c commit 0863b38
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions Adamant/Modules/PartnerQR/PartnerQRView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,37 @@ struct PartnerQRView: View {
@ObservedObject var viewModel: PartnerQRViewModel

var body: some View {
Form {
infoSection()
toggleSection()
buttonSection()
}
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .principal) {
toolbar()
GeometryReader { geometry in
Form {
infoSection()
toggleSection()
buttonSection()
}
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .principal) {
toolbar(maxWidth: geometry.size.width)
}
}
}
}
}

private extension PartnerQRView {
func toolbar() -> some View {
Button(action: {
viewModel.renameContact()
}) {
func toolbar(maxWidth: CGFloat) -> some View {
Button(action: viewModel.renameContact) {
HStack {
if let uiImage = viewModel.partnerImage {
Image(uiImage: uiImage)
.resizable()
.frame(squareSize: viewModel.partnerImageSize)
}
Text(viewModel.partnerName).font(.headline)
Text(viewModel.partnerName)
.font(.headline)
.minimumScaleFactor(0.7)
.lineLimit(1)
}
.frame(maxWidth: maxWidth - toolbarSpace, alignment: .center)
}
}

Expand Down Expand Up @@ -101,3 +105,5 @@ private extension PartnerQRView {
}
}
}

private let toolbarSpace: CGFloat = 150

0 comments on commit 0863b38

Please sign in to comment.