keyboardShowingIn static method

bool keyboardShowingIn(
  1. BuildContext context
)

Implementation

static bool keyboardShowingIn(BuildContext context) {
  final maxInset = max(
    of(context).bottomInset,
    View.of(context).viewInsets.bottom /
        // Note that we obviously do not care about the pixel ratio for our
        // > 0 comparison, however, I do want to prevent any future mistake,
        // where someone forgets the pixel ratio on the window.
        View.of(context).devicePixelRatio,
  );

  return maxInset > 0;
}