flutter_keyboard_size 0.1.2
flutter_keyboard_size: ^0.1.2 copied to clipboard

A very simple, but convinient provider that helps get info about keyboard height, is it open or not and set bool valu is screen small or not.

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 the simple but useful provider that gives all info about keyboard in one place in any widget down the tree.

Showcase|100x100, 10%

Usage #

After installing wrap Scaffold widget to

KeyboardSizeProvider(
      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

22
likes
90
pub points
88%
popularity

Publisher

awaik.pro

A very simple, but convinient provider that helps get info about keyboard height, is it open or not and set bool valu is screen small or not.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter, provider

More

Packages that depend on flutter_keyboard_size