Fixing VIN keyboard

This commit is contained in:
Selim Mustafaev 2025-05-27 22:31:59 +03:00
parent 8a875ab7a1
commit fe46f42fea
3 changed files with 5 additions and 13 deletions

View File

@ -114,7 +114,7 @@ struct MainTabScreen: View {
) )
} }
} }
.presentationDetents([.height(350)]) .presentationDetents([.height(390)])
} }
func checkRecord(number: String, event: VehicleEventDto?) { func checkRecord(number: String, event: VehicleEventDto?) {

View File

@ -13,7 +13,7 @@ struct ACVinKeyboardView: View {
let buttonPressed: (PNButtonType) -> Void let buttonPressed: (PNButtonType) -> Void
var body: some View { 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) { Grid(horizontalSpacing: 0, verticalSpacing: 0) {
GridRow { GridRow {
ACKeyboardButton(type: .vin("A"), onTap: buttonPressed) ACKeyboardButton(type: .vin("A"), onTap: buttonPressed)

View File

@ -18,19 +18,11 @@ struct ProportionalHStack: Layout {
} }
func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize { 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 ()) { 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 var x = bounds.minX
let y = bounds.minY let y = bounds.minY
@ -40,7 +32,7 @@ struct ProportionalHStack: Layout {
let widthWeight = widthWeights[index] let widthWeight = widthWeights[index]
let proposedWidth = widthWeight * parentTotalWith let proposedWidth = widthWeight * parentTotalWith
let sizeProposal = ProposedViewSize(width: proposedWidth, height: subviewSizes[index].height) let sizeProposal = ProposedViewSize(width: proposedWidth, height: proposal.height)
subviews[index] subviews[index]
.place( .place(