isWithinDisclosure method

bool isWithinDisclosure(
  1. int row,
  2. double dx
)

Whether a horizontal position falls inside the disclosure glyph of a nested row's first cell.

Lives here because the indent and the glyph are geometry the render layer owns; the widget layer would have to reconstruct both to ask the same question, and would get it wrong under RTL.

Implementation

bool isWithinDisclosure(int row, double dx) {
  if (_columnLayout.isEmpty) return false;
  final indent = _rowIndent?.call(row) ?? 0.0;
  final padding = _theme.effectiveCellPadding;
  final start = _screenLeft(0) + indent + padding.left;
  final extent = _theme.sortIconSize + _theme.cellIconGap;
  return _textDirection == TextDirection.ltr
      ? dx >= start && dx <= start + extent
      : dx <=
                _screenLeft(0) +
                    _columnLayout.widths[0] -
                    indent -
                    padding.left &&
            dx >=
                _screenLeft(0) +
                    _columnLayout.widths[0] -
                    indent -
                    padding.left -
                    extent;
}