calculateContentHeight static method
Calculate the total content height from a flat item count.
Since all rows have the same fixed height, this is O(1).
Implementation
static double calculateContentHeight({
required int itemCount,
double rowHeight = 40.0,
double rowSpacing = 0.0,
double topPadding = 0.0,
double bottomPadding = 0.0,
}) {
if (itemCount == 0) return topPadding + bottomPadding;
final totalRowHeight = itemCount * rowHeight;
final totalSpacing = (itemCount - 1) * rowSpacing;
return totalRowHeight + totalSpacing + topPadding + bottomPadding;
}