keyboard_detection
0.8.1, released a year ago by lamnhan.dev
Detect keyboard visibility using bottom view inset in Flutter
What it does
Provides a widget and controller to listen for keyboard visibility changes and size. It exposes callbacks, streams, and boolean helpers.
AI-written summary of version 0.8.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to react to keyboard show/hide events
- You want to adjust UI when keyboard appears
- You need keyboard size for layout calculations
Skip it when
- You only need a simple focus change listener
- You are building a non-Flutter platform
- You prefer a different method of detecting keyboard (e.g., MediaQuery)
Strengths
- Simple API, no extra dependencies
- Supports callbacks, streams, and boolean helpers
- Works across all supported platforms
- Handles transitional states
Weaknesses
- Does not support floating keyboards
- Relies on bottom inset, may be inaccurate on some devices
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Add dependency and wrap Scaffold with KeyboardDetection widget
```dart
KeyboardDetection(
controller: KeyboardDetectionController(
onChanged: (state) => print('Keyboard: $state'),
),
child: Scaffold(
appBar: AppBar(title: const Text('Demo')),
body: const Center(child: TextField()),
),
);
```Alternatives
Packages that do the same job and could replace keyboard_detection.
- keyboard_visibility_pro
Detects soft-keyboard open and close status in Flutter applications.
39Compare - flutter_carousel_widget
A Flutter carousel with ten composable effects, autoplay, indicators, and accessibility.
86Compare - flutter_keyboard_visibility_temp_fork
Detects whether the on-screen keyboard is visible on Android and iOS.
78Compare - scroll_spy
Detect visible items and select one stable primary item in Flutter scrollables.
67Compare