パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.3.0

keyboard_height_plugin

キーボードが表示される前にキーボードの高さを発生させる Flutter プラグイン(ios/android)

AndroidiOS
30日間ダウンロード
4.1万
いいね数
31
Pub ポイント
150

パッケージをインストール

flutter pub add keyboard_height_plugin

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

keyboard_height_plugin は、Android および iOS デバイスで画面キーボードが表示される前に、その高さに関するリアルタイムの更新を提供する Flutter パッケージです。キーボードが表示される直前にキーボードの高さを発行することで、開発者が UI レイアウトを動的に調整し、より良いユーザー体験を実現できます。このプラグインは、フォームや入力フィールドなど、コンテンツがキーボードに隠れてしまう可能性がある場合に特に役立ちます。2つの主要なモバイルプラットフォームでスムーズに動作し、pub.dev を通じて簡単に統合できます。このプラグインは軽量であり、追加機能なしにキーボードの高さ検出に特化しています。

用途

  • 動的フォームレイアウトの調整
  • 入力フィールドの重なりを防ぐ
  • リアルタイムUIの応答性
  • モバイルアプリのキーボード認識
  • 入力中の画面スペースの最適化

主な機能

  • 表示の前にキーボードの高さを発行します
  • クロスプラットフォーム(Android & iOS)
  • 軽量で集中
  • pub.dev を通じたシンプルな統合
  • 追加の依存関係なし

適している対象

  • 入力集約型アプリを開発する開発者
  • 応答性のあるUIを必要とするアプリ
  • フォームベースのモバイルアプリケーション
  • 正確なキーボードフィードバックが必要なプロジェクト
  • iOS および Android をターゲットとする Flutter アプリ

注意事項

  • レイアウト変更の手動処理が必要です
  • キーボードの高さのみに制限
  • カスタムキーボードをサポートしていません
  • 組み込みのアニメーションサポートなし
  • 追加の状態管理が必要になる場合があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Keyboard Height Plugin for Flutter

keyboard_height_plugin is a Flutter plugin for iOS and Android that provides the keyboard size before the keyboard animation occurs for showing or hiding it. This helps eliminate lag when positioning widgets around the keyboard, such as placing a TextField above the keyboard.

Requirements

Version 0.3.0+ (Current)
  • Android:
    • Android Gradle Plugin (AGP) 8.6.0+
    • Gradle 8.7+
    • Kotlin 2.1.0+
    • Java 17+
    • minSdkVersion 16 (Android 4.1+)
    • compileSdkVersion 34+
  • iOS:
    • iOS 12.0+
    • Supports both CocoaPods and Swift Package Manager
    • Includes Privacy Manifest for App Store compliance
Version 0.1.5 (Legacy Support)

For projects that cannot upgrade to the modern build tools, use version 0.1.5:

  • Android Gradle Plugin 7.x
  • Kotlin 1.7.x
  • Java 11+

Installation

To install keyboard_height_plugin, add it to your pubspec.yaml file under the dependencies section:

dependencies:
  keyboard_height_plugin: ^0.3.0

For legacy projects:

dependencies:
  keyboard_height_plugin: 0.1.5

Usage

To use the keyboard_height_plugin, first import it in your Dart file:

import 'package:keyboard_height_plugin/keyboard_height_plugin.dart';

Next, create a stateful widget and declare a variable to store the keyboard height and create an instance of the KeyboardHeightPlugin:

class _HomePageState extends State<HomePage>; {
  double _keyboardHeight = 0;
  final KeyboardHeightPlugin _keyboardHeightPlugin = KeyboardHeightPlugin();
  // ... rest of code ...
}

Then, initialize the KeyboardHeightPlugin in your initState method and listen for changes in the keyboard height:

@override
void initState() {
  super.initState();
  _keyboardHeightPlugin.onKeyboardHeightChanged((double height) {
    setState(() {
      _keyboardHeight = height;
    });
  });
}

Use the _keyboardHeight variable to position your widgets around the keyboard.

Example

For a complete example on how to use the keyboard_height_plugin, please refer to the example directory in the repository.

Contributing

If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request on the project's GitHub repository.

License

This plugin is licensed under the BSD 3-Clause License.

カテゴリー

依存関係

依存関係一覧 1 件

  • plugin_platform_interface^2.0.2

ソースリポジトリ

このパッケージを使用しているプロジェクト