keyboard_utils_fork

Last updated:

0 purchases

keyboard_utils_fork Image
keyboard_utils_fork Images
Add to Cart

Description:

keyboard utils fork

keyboard_utils #
A Flutter plugin to check keyboard visibility and height.


Install #
Follow this guide
How to use #
Add the imports:
import 'package:keyboard_utils/keyboard_utils.dart';
import 'package:keyboard_utils/keyboard_listener.dart';
copied to clipboard
Create the KeyboardUtils:
KeyboardUtils _keyboardUtils = KeyboardUtils();
copied to clipboard
Attach the listener to KeyboardUtils:
final int _idKeyboardListener = _keyboardUtils.add(
listener: KeyboardListener(willHideKeyboard: () {
// Your code here
}, willShowKeyboard: (double keyboardHeight) {
// Your code here
}));
copied to clipboard
Remember call dispose:
_keyboardUtils.unsubscribeListener(subscribingId: _idKeyboardListener);
if (_keyboardUtils.canCallDispose()) {
_keyboardUtils.dispose();
}
copied to clipboard
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}');
},
),
],
),
);
}

....
copied to clipboard
To share KeyboardConfig in your widget tree, use the KeyboardConfigInheritedWidget widget.
Check the sample for more details.
Authors #


IsaĆ­as Santana
Will Filho

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.