Fix for CXTDT-597984, Fixing the padding issue while calculating the itemwidth which is causing the issue.

This commit is contained in:
Sumanth Nadigadda 2024-08-20 18:07:10 +05:30
parent 0951a48467
commit 93b89ee754

View File

@ -112,8 +112,7 @@ class MatrixFlowLayout : UICollectionViewFlowLayout {
/// Fetches estimated height by calling the cell's component estimated height and adding padding
private func estimateHeightFor(item: TableItemModel, with width: CGFloat, index: IndexPath) -> CGFloat {
let horizontalPadding = (index.row == 0 && !striped) ? (VDSLayout.space1X + layoutPadding.horizontalValue()) : (2 * layoutPadding.horizontalValue())
let itemWidth = width - layoutPadding.horizontalValue() - defaultLeadingPadding
let itemWidth = width - layoutPadding.horizontalValue() - (index.row == 0 ? defaultLeadingPadding:layoutPadding.horizontalValue())
let maxSize = CGSize(width: itemWidth, height: CGFloat.greatestFiniteMagnitude)
let estItemSize = item.component?.systemLayoutSizeFitting(maxSize, withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel) ?? CGSize(width: itemWidth, height: item.defaultHeight)
return estItemSize.height + (2 * layoutPadding.verticalValue())