How to add ScrollController to SliverList flutter - flutter

I can add ScrollController to a ListView. I was trying to do the same for SliverList but I realized there is no parameter to add a controller. Is there any other way I can achieve this?
Thank you.

You cannot add it to a SliverList, you can however, add the controller to your parent CustomScrollView. The SliverList comes inside the CustomScrollView and should give you the effect you want.
As you can see in the screenshot, you can add a controller to your CustomScrollView

Related

above widgets are done by pageview builder and below is listview builder

I want to make it responsive like if I move the slider then correspondent list which is below should be highlighted and should move according to the slider.
I have tried PageView controller to pass in ListView controller but it never worked.

Unable to scroll on page from listview

So this listview is dynamically loaded from api, when I scroll on page (up/down) outside of listview it works perfectly, but when I scroll from inside listview I am unable to scroll on the page. Any ideas on what I can change?
It seems you have used Nested ListView.
Just declare:
ScrollController _scrollController = ScrollController();
And call _scrollController to both the properties of contoller in listviews.
I think setting the primary property to false in the listview will solve your problem

How to add swiping functionality on ListView?

How to add swiping functionality on ListView? I do not know the exact number of childs to use PageView, moreover I think having just a horizontal swipe on a scrollable widget is what will fit better.
if your want to add swipping functionality in PageView then you can use PageView.builder instead of just PageView.

How do I synchronise Silver Appbar scroll with the list view builder inside it in Flutter

Actually, I'm using a Silver AppBar in Flutter and inside it, I'm using a ListView Builder that has its own scroll. So basically there are two scrolls. But when I scroll List View Builder, Silver AppBar doesn't scroll. I want both of them to scroll from anywhere. What do I do?
Use sliver list istead of list view the problem will solve
here is the link of widget : https://api.flutter.dev/flutter/widgets/SliverList-class.html
You can put NeverScrollableScrollPhysics as a scroll physics for ListView.builder, so AppBar will scroll as with the content, maybe this is what you are looking for.

Auto Scrolling in Flutter

So I have a SingleChildScrollView() whose child is a Column() with different widgets inside it. I have 3 BUTTONS on the app bar. Each for 3 widgets I want to jump to.
When I press the button, I want the UI to automatically scroll to the mapped Widget. Just like we see that effect in websites.
How can I achieve this ?
You can create a ScrollController and pass it to the controller parameter of your scrolling widget. Then you can use the animateTo method to animate to an offset.
Ex.
ScrollController controller = ScrollController();
//In build
SingleChildScrollView(
controller: controller,
child: ...,
)
//In each button onPressed/onTap
controller.animateTo(offset);