16

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.

emvaized
  • 884
  • 12
  • 23
  • Do you have any code so far? could you show your progress? You can build one yourself using a stack widget: https://medium.com/flutter-community/creating-draggable-scrollbar-in-flutter-a0ae8cf3143b – Mariano Zorrilla Jun 18 '19 at 18:18
  • As I see, in your example simple AppBar was used, not a SliverAppBar. – emvaized Jun 18 '19 at 21:28

2 Answers2

5

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
                 ]
Luan Träsel
  • 127
  • 1
  • 7
3

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

edward
  • 101
  • 2
  • 3