startObserving method
void
startObserving()
NOTE:
startObserving must be called inside initState. Do NOT call it like this:
final _keyboardObserver = KeyboardObserver(onShow: () {}, onHide: () {})..stopObserving();
Implementation
void startObserving() {
this._timer = Timer.periodic(Duration.zero, (_) {
if (this._view.viewInsets.bottom > 0.0) {
if (this._didCallOnShow == false) {
this.onShow?.call();
this._didCallOnShow = true;
this._didCallOnHide = false;
}
} else {
if (this._didCallOnHide == false) {
this.onHide?.call();
this._didCallOnHide = true;
this._didCallOnShow = false;
}
}
});
}