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.
Dart. The SliverStack() allows putting one sliver on another. In the below example, through SliverPositioned() we are creating the complete layout of yellow color on top of which we are rendering list items using SliverList(). SliverList() takes a delegate as a parameter to give the items to the list to be scrolled.
Now lets start implementation of CustomScrollView in Flutter First of all, create a basic project and return a Custom Scroll View widget. Then, add a silver app bar and then add a silver grid. Here we only used two child widgets in the custom scroll view. The Entry point of code.
A scroll controller creates a ScrollPosition to manage the state specific to an individual Scrollable widget. To use a custom ScrollPosition, subclass ScrollController and override createScrollPosition. A ScrollController is a Listenable.
SliverFixedExtentList class Null safety. A sliver that places multiple box children with the same main axis extent in a linear array. SliverFixedExtentList places its children in a linear array along the main axis starting at offset zero and without gaps.
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
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