You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a CustomScrollView which I need to scroll down when keyboard is shown. To detect when keyboard is shown I use the following code:
late StreamSubscription<bool> keyboardSubscription;
@override
void initState() {
super.initState();
scrollController = new ScrollController();
var keyboardVisibilityController = KeyboardVisibilityController();
keyboardSubscription = keyboardVisibilityController.onChange.listen((bool visible) {
if (visible) {
Future.delayed(const Duration(milliseconds: 350), () {
this.scrollToBottom();// here I scroll my CustomScrollView
});
}
});
}
As it seen I call this.scrollToBottom() with 350 ms delay because otherwise my CustomScrollView is not scrolled. So the question, when is keyboardVisibilityController.onChange.listen called? When keyboard is just starting showing or when keyboard is fully shown and ready for typing? Or could anyone explain why I need to use delay in my code?
The text was updated successfully, but these errors were encountered:
I have a
CustomScrollView
which I need to scroll down when keyboard is shown. To detect when keyboard is shown I use the following code:As it seen I call
this.scrollToBottom()
with 350 ms delay because otherwise myCustomScrollView
is not scrolled. So the question, when iskeyboardVisibilityController.onChange.listen
called? When keyboard is just starting showing or when keyboard is fully shown and ready for typing? Or could anyone explain why I need to use delay in my code?The text was updated successfully, but these errors were encountered: