I'm using CustomScrollView, and providing it with a controller. ScrollController works, I even added a listener to it and print out the position of the scroll view.
CustomScrollView( controller: _scrollController,
Now, all i'm trying to do is jump to position 50.0 inside initState() function.
_scrollController.jumpTo(50.0);
But, i get the error
scrollController not attached to any scroll views
Scrollbar is a material widget in flutter that indicates to the user how lengthy the view is. It has a thumb that indicates how long the user has scrolled either from top or bottom. To display a scrollbar for a scrollview we have to add the scrollview as a child to scrollbar widget.
You should use ListView. builder in place of the inner column (as I suggested above that columns are not scrollable). Set shrinkWrap: true, and physics: ClampingScrollPhysics() inside ListView.
Check if the scrollController is attached to a scroll view by using its hasClients property first.
if (_scrollController.hasClients) _scrollController.jumpTo(50.0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With