FLUTTER ECOSYSTEM

Gerrel/keyboard_service

キーボードの可視性 / (自動)非表示パッケージ、ネイティブプラグインなし

keyboard_service のプロジェクト画像
Stars
10
Forks
1
最終プッシュ(UTC)
2025/08/05
プロジェクト状態
公開中
Gerrel GitHub avatar
GITHUB User

Gerrel ↗

The Netherlands
言語DartPythonKotlinSwiftObjective-C

技術トピック

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 3 件
  • flutter{"sdk":"flutter"}
  • flutter_test開発用{"sdk":"flutter"}
  • lints開発用^6.0.0

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

README を開く / 閉じる

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.