How to show scrollbar in SliverList?

Viewed 3052

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.

2 Answers

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).

Related