MaterialInputAutoSelectDirective constructor

MaterialInputAutoSelectDirective(
  1. BaseMaterialInput input
)

Implementation

MaterialInputAutoSelectDirective(BaseMaterialInput input) {
  _disposer.addStreamSubscription(input.onFocus.listen((event) {
    if (!autoSelect) return;

    // Selection of the text needs to be delayed a bit because in some
    // browsers click event fires after the focus event causing text selection
    // to be lost.
    // Please visit go/acx-input-auto-select-directive for more details.
    _selectionTimer?.cancel();
    _selectionTimer = Timer(Duration(milliseconds: 30), input.selectAll);
  }));
}