focusActive method

void focusActive()

Focuses the first empty cell, or the last cell if all are filled.

Call this on any cell tap to enforce strict left-to-right entry order — preventing users from jumping to an arbitrary cell.

Implementation

void focusActive() {
  if (_isDisposed) return;
  final activeIndex = controllers.indexWhere((c) => c.text.isEmpty);
  final target = activeIndex == -1 ? length - 1 : activeIndex;
  focusNodes[target].requestFocus();
}