openKeyboard static method

dynamic openKeyboard()

Implementation

static openKeyboard() {
  var keyboardHeight = _currentKeyboard!.getHeight!(_context);
  _keyboardHeightNotifier.value = keyboardHeight;
  if (_root.hasKeyboard && _pageKey != null) return;
  _pageKey = GlobalKey<KeyboardPageState>();
  // KeyboardMediaQueryState queryState = _context
  //         .ancestorStateOfType(const TypeMatcher<KeyboardMediaQueryState>())
  //     as KeyboardMediaQueryState;
  // queryState.update();

  var tempKey = _pageKey;
  _root.setKeyboard((ctx) {
    if (_currentKeyboard != null && _keyboardHeightNotifier.value != null) {
      return KeyboardPage(
          key: tempKey,
          builder: (ctx) {
              return (_currentKeyboard?.builder == null ? null : _currentKeyboard?.builder!(
                  ctx, _keyboardController, _keyboardParam)) as Widget;
          },
          height: _keyboardHeightNotifier.value);
    } else {
      return Container();
    }
  });

  BackButtonInterceptor.add((_,_1) {
    CoolKeyboard.sendPerformAction(TextInputAction.done);
    return true;
  }, zIndex: 1, name: 'CustomKeyboard');
}