React to soft keyboard visibility changes in a Flutter app
open sourceMITfree
flutter_keyboard_visibility is a Flutter plugin that tells your app when the soft keyboard shows or hides. You can build widgets from it with KeyboardVisibilityBuilder or KeyboardVisibilityProvider, or query and subscribe to it with KeyboardVisibilityController. KeyboardDismissOnTap dismisses the keyboard when the user taps outside the focused widget, and the controller can be replaced with a mock in widget tests.
Problems it solves
- know when the soft keyboard opens or closes in a Flutter app
- dismiss the keyboard when the user taps outside a text field in Flutter
- hide a bottom bar while the on-screen keyboard is visible in Flutter
Features
- KeyboardVisibilityBuilder and KeyboardVisibilityProvider widgets
- KeyboardVisibilityController to query or subscribe to visibility
- KeyboardDismissOnTap to dismiss the keyboard when tapping outside the focused widget
- A replaceable controller for mocking in widget tests
Limitations
- Web and desktop aren't supported yet: it always reports the keyboard as hidden there1
Alternatives
The same job
These do what flutter_keyboard_visibility does.
- flutter_local_notifications Cross-platform Flutter plugin for displaying and scheduling local notifications
