moveColumn method

void moveColumn(
  1. int fromVisual,
  2. int toVisual
)

Move the column at visual position fromVisual to toVisual (header drag-and-drop). Only the visual order changes; logical indices — and so the selection, sort column and cell values — are untouched.

Implementation

void moveColumn(int fromVisual, int toVisual) {
  if (_order.isEmpty) return;
  final from = fromVisual.clamp(0, _order.length - 1);
  final to = toVisual.clamp(0, _order.length - 1);
  if (from == to) return;
  final li = _order.removeAt(from);
  _order.insert(to, li);
  notifyListeners();
}