keyboard_display 0.0.1 copy "keyboard_display: ^0.0.1" to clipboard
keyboard_display: ^0.0.1 copied to clipboard

Based on native keyboard monitoring, you can get the keyboard height and keyboard animation time.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:keyboard_display/keyboard_display.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        resizeToAvoidBottomInset: false,
        body: Container(
          alignment: Alignment.center,
          child: Column(
            children: [
              StreamBuilder(
                stream: KeyboardTool.keyboardInfo,
                builder: (_, snapData) {
                  return Text(snapData.data.toString());
                },
              ),
              const Spacer(),
              const TextField(),
              Container(
                width: 100,
                height: 100,
                color: Colors.red,
              ),
              KeyboardDisplayView(builder: (_, info) {
                return AnimatedContainer(
                  height:
                      info.keyboardHeight > 0 ? info.keyboardHeight - 60 : 0,
                  duration: Duration(milliseconds: info.duration),
                );
              }),
              SizedBox(
                height: 60,
                child: TextButton(
                    onPressed: () {}, child: const Text('this is button')),
              )
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
150
points
18
downloads

Publisher

unverified uploader

Weekly Downloads

Based on native keyboard monitoring, you can get the keyboard height and keyboard animation time.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, meta, plugin_platform_interface

More

Packages that depend on keyboard_display