Skip to content
pubscout

keyboard_detection

0.8.1, released a year ago by lamnhan.dev

Detect keyboard visibility using bottom view inset in Flutter

WASM-ready
$ flutter pub add keyboard_detection
Source repository

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.