keyboard_detection 0.0.1+1 copy "keyboard_detection: ^0.0.1+1" to clipboard
keyboard_detection: ^0.0.1+1 copied to clipboard

outdated

This plugin gives you an easy way to detect if the keyboard is visible or not.

Keyboard Detection #

This plugin gives you an easy way to detect if the keyboard is visible or not. It uses the resizing of the bottom view inset to check the the keyboard visibility, so it's native to flutter.

Usage #

You just need to wrap the Scaffold with KeyboardDetection like below and listen to onChanged value.

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: KeyboardDetection(
        timerDuration: const Duration(milliseconds: 10),
        onChanged: (value) {
          print('Is Keyboard Opened: $value');
          setState(() {
            isKeyboardOpened = value;
          });
        },
        child: Scaffold(
          appBar: AppBar(
            title: const Text('Keyboard Detection'),
          ),
          body: Center(
            child: Text('Is Keyboard Opened: $isKeyboardOpened'),
          ),
        ),
      ),
    );
  }

onChanged will be true if the keyboard is visible and false otherwise.

timerDuration is the time interval between 2 checks. Default is 100 milliseconds.

20
likes
0
pub points
91%
popularity

Publisher

verified publisherlamnhan.dev

This plugin gives you an easy way to detect if the keyboard is visible or not.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on keyboard_detection