keyboard_utils_plugin

v1.1.2

fork from https://github.com/IsaiasSantana/keyboard_utils

Архив пакета: https://pubdev.letsnova.ru/api/archives/keyboard_utils_plugin/1.1.2.tar.gz

Установкаdart pub add keyboard_utils_plugin

README

keyboard_utils

A Flutter plugin to check keyboard visibility and height.

Licence

sample

Install

Follow this guide

How to use

Add the imports:

import 'package:keyboard_utils/keyboard_utils.dart';
                import 'package:keyboard_utils/keyboard_listener.dart';
                

Create the KeyboardUtils:

KeyboardUtils  _keyboardUtils = KeyboardUtils();
                

Attach the listener to KeyboardUtils:

final int _idKeyboardListener = _keyboardUtils.add(
                        listener: KeyboardListener(willHideKeyboard: () {
                      // Your code here
                    }, willShowKeyboard: (double keyboardHeight) {
                      // Your code here
                    }));
                

Remember call dispose:

_keyboardUtils.unsubscribeListener(subscribingId: _idKeyboardListener);
                    if (_keyboardUtils.canCallDispose()) {
                      _keyboardUtils.dispose();
                    }
                

Instead, you can also use KeyboardAware Widget:

 import 'package:keyboard_utils/widgets.dart';
                 
                 ....
                 
                 Widget buildSampleUsingKeyboardAwareWidget() {
                    return Center(
                      child: Column(
                        children: <Widget>[
                          TextField(),
                          TextField(
                            keyboardType: TextInputType.number,
                          ),
                          TextField(),
                          SizedBox(
                            height: 30,
                          ),
                          KeyboardAware(
                            builder: (context, keyboardConfig) {
                              return Text('is keyboard open: ${keyboardConfig.isKeyboardOpen}\n'
                                  'Height: ${keyboardConfig.keyboardHeight}');
                            },
                          ),
                        ],
                      ),
                    );
                  }
                  
                  ....
                

To share KeyboardConfig in your widget tree, use the KeyboardConfigInheritedWidget widget.

Check the sample for more details.

Authors

Isaías Santana
Isaías Santana
Will Filho
Will Filho

История изменений

1.1.2

  • Flutter Android build update, flutter 3.38.5 base

1.1.0

  • Flutter swift plugin fix

1.0.0

  • fork keyboard_utils_fork 1.0.1