calcSlotRect method

  1. @protected
Rect calcSlotRect({
  1. required int index,
  2. required double layoutWidth,
})
inherited

Implementation

@protected
Rect calcSlotRect({
  required int index,
  required double layoutWidth,
}) {
  final double width = _itemSize.width, height = _itemSize.height;
  double lineX = 0, lineY = 0;
  for (var i = 0; i < index; i++) {
    if (index > 0) {
      lineX += width + _crossSpacing;
      if ((lineX + width > layoutWidth)) {
        lineX = 0;
        lineY += height + _mainSpacing;
      }
    }
  }
  // print('calcSlotRect $index: $lineX,$lineY');
  return Rect.fromLTWH(lineX, lineY, width, height);
}