Search packages, repositories and app categories

Package detailsv2.0.4

keyboard_service

Keyboard visibility / (auto-) dismiss package without the need of native plugin

AndroidiOSWebmacOSWindowsLinux
30-day downloads
1.1K
Likes
43
Pub points
160

Install package

flutter pub add keyboard_service

Package Overview

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

A Flutter package that manages keyboard visibility and automatic dismissal across multiple platforms without requiring native plugins. It provides a simple, cross-platform solution to detect when the keyboard is open or closed and allows developers to programmatically hide it. Ideal for improving user experience in forms and input-heavy interfaces by ensuring smooth keyboard interactions. The package works seamlessly on Android, iOS, Web, macOS, Windows, and Linux, making it a versatile choice for modern Flutter applications.

Use cases

  • Form input handling
  • Auto-dismissing keyboard on focus change
  • Improving UX in chat apps
  • Handling keyboard overlap in UI
  • Responsive layout adjustments
  • Dynamic form field management

Key features

  • Cross-platform compatibility
  • No native plugin required
  • Keyboard state detection
  • Programmatic keyboard dismissal
  • Lightweight and easy to integrate
  • Supports all major desktop and mobile platforms

Suitable for

  • Developers building multi-platform apps
  • Apps with complex input forms
  • Chat or messaging interfaces
  • UIs requiring responsive keyboard handling
  • Teams avoiding platform-specific code

Considerations

  • May not support all edge cases on web
  • Limited customization for keyboard behavior
  • Depends on Flutter's built-in keyboard APIs
  • Not suitable for advanced keyboard customization
  • Requires careful handling in nested scroll views

Original README

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

keyboard_service

Keyboard visibility / (auto-) dismiss package without the need of native plugin

Watch on GitHub Star on GitHub pub package

Getting Started

Use it for example when you want to automatically dimiss the on-screen keyboard when tapped outside of textfield. And if you want know if the on-screen keyboard is visible and/or want to explicitly dismiss it.

There are 2 classes

  • 'KeyboardService': Check if keyboard is visible and dismiss keyboard.
  • 'KeyboardAutoDismiss': A widget that wraps a Scaffold widget for automatically dismissing the keyboard.

Also see example project

Wrap your top scaffold:

return KeyboardAutoDismiss(
        scaffold: Scaffold(
            appBar: AppBar(
                title: Text('Keyboard Service Example'),
            ),
      ...
        ),
    );

Use the service class if needed:

// Use method below to dismiss the keyboard
KeyboardService.dismiss();

// Use the optional BuildContext parameter to remove focus of a TextField
KeyboardService.dismiss(unfocus: context);

// Check if the keyboard is visible
KeyboardService.isVisible(context);

License

This project is licensed under the MIT License - see the license file for details.

Categories

Source repository

Projects using this package

No data available yet.