How to scroll SingleChildScrollView programmatically?
On long Form, it is desirable to automatically scroll to a require input field.
There are multiple solutions :
ScrollController
: Assign it to controller
field of your SingleChildScrollView
. And use myScrollController.animateTo
or myScrollController.jumpTo
Scrollable
. Possibly Scrollable.ensureVisible
. But be aware that the context
parameter is the context of the widget that needs to be visible. You can get that context by using GlobalKey
.