Search packages, repositories and app categories

Package detailsv0.5.6

keyboard_visibility

Flutter plugin for discovering the state of the soft-keyboard visibility on Android and iOS.

30-day downloads
735
Likes
122
Pub points
35

Install package

flutter pub add keyboard_visibility

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The keyboard_visibility package is a Flutter plugin that enables developers to detect the visibility state of the soft keyboard on both Android and iOS devices. It provides a simple API to listen for keyboard show/hide events, allowing apps to respond dynamically—such as adjusting layouts or scrolling content into view. This is particularly useful in forms or chat interfaces where user input requires visual feedback. The plugin works seamlessly across platforms with minimal setup, making it ideal for responsive UIs.

Use cases

  • Form input handling
  • Chat app UI adjustments
  • Dynamic layout resizing
  • Scrolling to focused fields
  • Responsive user interfaces

Key features

  • Real-time keyboard state detection
  • Cross-platform support (Android & iOS)
  • Simple event listener API
  • Minimal configuration
  • Works with FocusNode and TextEditingController

Suitable for

  • Developers building form-heavy apps
  • Chat or messaging applications
  • UIs requiring dynamic keyboard-aware layouts
  • Apps needing responsive input handling
  • Flutter beginners exploring platform-specific features

Considerations

  • Does not work on web platform
  • Requires proper event listener management
  • May need additional logic for complex UI transitions
  • Limited to keyboard visibility, not size or animation
  • No built-in animations or transitions

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

keyboard_visibility

Notification service for soft-keyboard visibility

Usage

Add the dependency to your pubspec.yaml file in the root folder of your project. Look for the 'dependencies:'-line and add the following line after this line:

keyboard_visibility: any

or

keyboard_visibility: ^[CURRENT VERSION NUMBER]

(Please note that the two spaces in the beginning of the line are important) Run 'flutter packages get' in your root folder after saving the pubspec.yaml file. For additional documentation about the pubspec.yaml file please refer to the official flutter documentation using packages

Import package:keyboard_visibility/keyboard_visibility.dart, instantiate KeyboardVisibilityNotification and use the Android and iOS notifications to get events about changes of the visibility of the soft-keyboard

The best practice to call the addNewListener function is inside the initState function as in the following example:

import 'package:keyboard_visibility/keyboard_visibility.dart';

@protected
void initState() {
  super.initState();

  KeyboardVisibilityNotification().addNewListener(
    onChange: (bool visible) {
      print(visible);
    },
  );
}

Also check out the example included with the package

Getting Started

For help getting started with Flutter, view the following online documentation.

Categories

Source repository

Projects using this package