I'm using SliverAppBar and SliverList as main containers in my app. When I try to wrap SliverList in Scrollbar widget, I get an error, and when I wrap whole CustomScrollView in Scrollbar, it overlaps SliverAppBar. So how can I show scrollbar indicator only in my SliverList? Thanks in advance.
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.
How to use slivers? It is to note that all of the sliver's components should always be placed inside a CustomScrollView. After that, we can combine the list of slivers to make the custom scrollable area.
Check out @JLarana's answer at https://stackoverflow.com/a/62938436/10647220
But basically what you need to do is:
ScrollController _scrollController = ScrollController();
...
body: PrimaryScrollController(
controller: _scrollController,
child: CupertinoScrollbar(
child: CustomScrollView(
slivers:[
your slivers code here
]
If I understand your question correctly... as of Flutter 1.12 released in Dec 2019, I think this issue is currently tracked under
https://github.com/flutter/flutter/issues/13253
I'm not aware of a easy solution for this(maybe NestedScrollView
will solve your problem, but it has some subtle fidelity issues so I don't want to use).
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