flutter_keyboard_size 0.1.2+2

  • Readme
  • Changelog
  • Example
  • Installing
  • 90

flutter_keyboard_size Pub #

When the virtual keyboard is opened, we can get its height with MediaQuery.of(context).viewInsets.bottom

BUT, in case of complicated widgets tree, it doesn't work. So, every time we have to mutate the keyboard size down to the widget tree.

This package is a straightforward and convenient provider that helps get info about: keyboard height, is it open or not, set bool value is screen small or not.

Showcase|100x100, 10%

Usage #

After installing wrap Scaffold widget to

      smallSize: 500.0,
      child: Scaffold(

where smallSize property is optional, default is 400.0

After that, down to the widget tree you can use Consumer widget to get info about keyboard

Widget build(BuildContext context) {
    return Consumer<ScreenHeight>(
      builder: (context, _res, child) {
        return Center(

available properties:

  double keyboardHeight
  double screenHeight
  bool isSmall // returns true if screen height becomes less then smallSize property
  bool isOpen // true if open

Full example is here https://github.com/awaik/flutter_keyboard_size/tree/master/example

Note: This plugin is under active development, if you have a feature to implement or find bugs, please, add them here: issue

0.1.2+2 #

  • Add license

0.1.2+1 #

  • Update docs

0.1.2 #

  • Change location ScreenHeight class for export compatibility

0.1.1+2 #

  • Improve read.me

0.1.1+1 #

  • Update docs

0.1.1 - Initial release #

Available key properties for getting info

  double keyboardHeight;
  double screenHeight;
  bool isSmall; // returns true if screen height becomes less then smallSize property
  bool isOpen; // true if open

example is here https://github.com/awaik/flutter_keyboard_size/tree/master/example


import 'package:flutter/material.dart';
import 'package:flutter_keyboard_size/flutter_keyboard_size.dart';
import 'body_of_main_screen.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      home: MyHomePage(title: 'Flutter Demo Home Page'),

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  _MyHomePageState createState() => _MyHomePageState();

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {

  Widget build(BuildContext context) {
    return KeyboardSizeProvider(
      smallSize: 500.0,
      child: Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        body: BodyOfMainScreen(counter: _counter),

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_keyboard_size: ^0.1.2+2

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_keyboard_size/flutter_keyboard_size.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 4, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [flutter_keyboard_size] that is in a package requiring null.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
provider ^4.0.5 4.1.3
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
nested 0.0.4
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies