Go to file
Noah Schairer 938d5af3b8 0.0.2
2023-04-28 16:13:15 -04:00
android init 2023-04-28 15:21:41 -04:00
example updated example 2023-04-28 15:59:37 -04:00
ios init 2023-04-28 15:21:41 -04:00
lib published 0.0.1 2023-04-28 15:31:57 -04:00
test remove some tests 2023-04-28 15:23:54 -04:00
.gitignore init 2023-04-28 15:21:41 -04:00
.metadata init 2023-04-28 15:21:41 -04:00
analysis_options.yaml init 2023-04-28 15:21:41 -04:00
CHANGELOG.md init 2023-04-28 15:21:41 -04:00
LICENSE license stuff 2023-04-28 16:10:30 -04:00
pubspec.yaml 0.0.2 2023-04-28 16:13:15 -04:00
README.md Update README.md 2023-04-28 16:12:19 -04:00

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.

Installation

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

dependencies:
  keyboard_height_plugin: ^0.0.2

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.