halkyon/third_party/keyboard_height_plugin/README.md
Tizian 「ティツィアーン」 438ce20dbf
build: Android's built-in Kotlin, the three plugins applying KGP themselves patched in third_party/
AGP 9 compiles Kotlin itself (android.builtInKotlin=true in every app),
and warns that applying the Kotlin Gradle Plugin will soon fail.
flutter_web_auth_2 5.1.0, keyboard_height_plugin 0.3.0 and flutter_tts
4.2.5 still apply it unconditionally, so their pub releases are copied
into third_party/ with only their android/build.gradle changed, and
the root overrides them by path (third_party/README.md says when to
drop each). The servers' images copy third_party/, as pub refuses an
override whose path is missing. third_party/ isn't our own code: left
out of the analysis and the format check.

All four apps' APKs build without the warning. A Kotlin daemon's
session file that slipped into Train's android/ goes, and every app's
android/.gitignore keeps .kotlin/ out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-11-04 09:32:13 +01:00

85 lines
2.3 KiB
Markdown

# 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:
```yaml
dependencies:
keyboard_height_plugin: ^0.3.0
```
**For legacy projects:**
```yaml
dependencies:
keyboard_height_plugin: 0.1.5
```
## Usage
To use the `keyboard_height_plugin`, first import it in your Dart file:
```dart
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`:
```dart
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:
```dart
@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`](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](LICENSE).