calculateHeight method

void calculateHeight()

Implementation

void calculateHeight() {
  if (rows.isEmpty == true) {
    return;
  }

  double height = edgeInsets.top + edgeInsets.bottom;
  double colWidth = (UI.screen.width -
          edgeInsets.left -
          edgeInsets.right -
          (crossAxisCount > 1
              ? (crossAxisCount - 1) * crossAxisSpacing
              : 0)) /
      crossAxisCount;
  double colHeight = colWidth / aspectRatio;
  final mod = rows.length % crossAxisCount;
  final row = (rows.length / crossAxisCount + (mod != 0 ? 1 : 0)).toInt();
  height += (row * colHeight);
  height += (row > 1 ? (row - 1) * mainAxisSpacing : 0);
  cellHeight = height;
}