selectedRect method

Rect? selectedRect(
  1. int first,
  2. int last
)

Implementation

Rect? selectedRect(int first, int last) {
  if (count <= 0 || last <= start || first >= start + count) return null;
  var a = (first - start).clamp(0, count) / count;
  var b = (last - start).clamp(0, count) / count;
  if (rtl) {
    a = 1 - a;
    b = 1 - b;
  }
  return Rect.fromLTRB(
    bounds.left + bounds.width * math.min(a, b),
    bounds.top,
    bounds.left + bounds.width * math.max(a, b),
    bounds.bottom,
  );
}