place method

void place(
  1. Iterable<K> keys, {
  2. int trailing = 0,
})

Places the staying keys in one run of rounded rows, ahead of trailing rows that close it; a leaving key keeps the place it had.

Implementation

void place(Iterable<K> keys, {int trailing = 0}) {
  final staying = keys.where((key) => !isLeaving(key)).toList();
  final count = staying.length + trailing;
  for (final (index, key) in staying.indexed) {
    _positions[key] = ItemPosition.get(index, count);
  }
}