hideKeyboard static method

dynamic hideKeyboard({
  1. bool animation = true,
})

Implementation

static hideKeyboard({bool animation = true}) {
  if (clearTask != null) {
    if (clearTask!.isActive) {
      clearTask!.cancel();
    }
    clearTask = null;
  }
  BackButtonInterceptor.removeByName('CustomKeyboard');
  if (_root!.hasKeyboard && _pageKey != null) {
    if (animation) {
      _pageKey!.currentState?.exit();
      Future.delayed(Duration(milliseconds: 116)).then((_) {
        _root!.clearKeyboard();
      });
    } else {
      _root!.clearKeyboard();
    }
  }
  _pageKey = null;
}