From fe46f42fea7c50506700f7c8dda6f1adb3fb177e Mon Sep 17 00:00:00 2001 From: Selim Mustafaev Date: Tue, 27 May 2025 22:31:59 +0300 Subject: [PATCH] Fixing VIN keyboard --- AutoCat/Screens/MainScreen/MainTabScreen.swift | 2 +- .../SwiftUI/NumberEditView/ACVinKeyboardView.swift | 2 +- AutoCat/SwiftUI/ProportionalHStack.swift | 14 +++----------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/AutoCat/Screens/MainScreen/MainTabScreen.swift b/AutoCat/Screens/MainScreen/MainTabScreen.swift index 9189e55..2b44dbc 100644 --- a/AutoCat/Screens/MainScreen/MainTabScreen.swift +++ b/AutoCat/Screens/MainScreen/MainTabScreen.swift @@ -114,7 +114,7 @@ struct MainTabScreen: View { ) } } - .presentationDetents([.height(350)]) + .presentationDetents([.height(390)]) } func checkRecord(number: String, event: VehicleEventDto?) { diff --git a/AutoCat/SwiftUI/NumberEditView/ACVinKeyboardView.swift b/AutoCat/SwiftUI/NumberEditView/ACVinKeyboardView.swift index b588a0e..7924a83 100644 --- a/AutoCat/SwiftUI/NumberEditView/ACVinKeyboardView.swift +++ b/AutoCat/SwiftUI/NumberEditView/ACVinKeyboardView.swift @@ -13,7 +13,7 @@ struct ACVinKeyboardView: View { let buttonPressed: (PNButtonType) -> Void var body: some View { - ProportionalHStack(widthWeights: [2/3, 1/3], spacing: 16) { + ProportionalHStack(widthWeights: [2/3, 1/3], spacing: 8) { Grid(horizontalSpacing: 0, verticalSpacing: 0) { GridRow { ACKeyboardButton(type: .vin("A"), onTap: buttonPressed) diff --git a/AutoCat/SwiftUI/ProportionalHStack.swift b/AutoCat/SwiftUI/ProportionalHStack.swift index b74a123..adec63a 100644 --- a/AutoCat/SwiftUI/ProportionalHStack.swift +++ b/AutoCat/SwiftUI/ProportionalHStack.swift @@ -18,19 +18,11 @@ struct ProportionalHStack: Layout { } func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize { - let maxHeight = subviews - .map { proxy in - return proxy.sizeThatFits(.unspecified).height - } - .max() ?? .zero - - return CGSize(width: proposal.width ?? .zero, height: maxHeight) + + return CGSize(width: proposal.width ?? .zero, height: proposal.height ?? .zero) } func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) { - let subviewSizes = subviews.map { proxy in - return proxy.sizeThatFits(.infinity) - } var x = bounds.minX let y = bounds.minY @@ -40,7 +32,7 @@ struct ProportionalHStack: Layout { let widthWeight = widthWeights[index] let proposedWidth = widthWeight * parentTotalWith - let sizeProposal = ProposedViewSize(width: proposedWidth, height: subviewSizes[index].height) + let sizeProposal = ProposedViewSize(width: proposedWidth, height: proposal.height) subviews[index] .place(