keyboard_height_test
I want to compare different packages here, which want to determine the keyboard height for me.
-
MediaQuery.of(context).viewInsets.bottom
-
EdgeInsets.fromWindowPadding(WidgetsBinding.instance.window.viewInsets,WidgetsBinding.instance.window.devicePixelRatio).bottom;
- https://stackoverflow.com/a/64473806/10975692
- works well, but not on Android 12
-
- is no longer maintained
- works fine on iOS but does not work on Android (there is gap about 30 pixels on some devices)
-
flutter_persistent_keyboard_height
- based on
keyboard_utils
uses basically the maximum of the value fromkeyboard_utils
andMediaQuery.of(context).viewInsets.bottom
- not very handy
- based on
-
- does not look well maintained
- very simple, uses
MediaQuery.of(context).viewInsets.bottom
together withProvider
Other packages that are not featured here:
- keyboard_detection
- it simply uses
MediaQuery.of(context).viewInsets.bottom
- it simply uses
Testing
- Android 10, Xiaomi A2 Lite: everything works fine except for
keyboard_utils
- Android 10, Xiaomi A2 Lite with Android 10 gestures: everything works fine except for
keyboard_utils
- Android 6: everything works fine except for
keyboard_utils
with the workaround - Android 12 Motorola G22: everything work fine except for
keyboard_utils
- Android 10 tablet: TODO
- iOS: TODO
Last edited: 2022-07-10