fillHandleRect property

Rect? get fillHandleRect

The fill handle's box in this box's own coordinates, or null.

Implementation

Rect? get fillHandleRect {
  final (row, column) = _fillHandleCell;
  if (row < 0 || row >= rowCount) return null;
  if (column < 0 || column >= _columnLayout.length) return null;
  final side = _theme.fillHandleSize;
  final left = _screenLeft(column);
  final x = _textDirection == TextDirection.ltr
      ? left + _columnLayout.widths[column]
      : left;
  final y = _rowMetrics.offsetOf(row + 1) - _verticalOffset;
  // Kept inside the section: on the last column, or the last row at the
  // bottom of the viewport, a handle centred on the corner would hang half
  // outside — half hidden, and half beyond where a press can reach it.
  final half = side / 2;
  return Rect.fromCenter(
    center: Offset(
      x.clamp(half, math.max(half, size.width - half)),
      y.clamp(half, math.max(half, size.height - half)),
    ),
    width: side,
    height: side,
  );
}