Open nitneuq33000 opened 6 years ago
Did you find anything?
This should be a feature request for the flutter team. At the moment this is not possible as a ScrollController can only be attached to one ScrollView. You cannot add the CustomScrollView's controller to the DraggableScrollbar as you will get the following exception:
ScrollController attached to multiple scroll views.
from the following method in ScrollScontroller:
/// Returns the attached [ScrollPosition], from which the actual scroll offset
/// of the [ScrollView] can be obtained.
///
/// Calling this is only valid when only a single position is attached.
ScrollPosition get position {
assert(_positions.isNotEmpty, 'ScrollController not attached to any scroll views.');
assert(_positions.length == 1, 'ScrollController attached to multiple scroll views.');
return _positions.single;
}
It looks like the flutter team need to design a solution for this use case.
I don't think you need to pass the ScrollView
controller to the DraggableScrollbar
to achieve this. You just need to pass a CustomScrollView
as a child. In my project I have something along these lines (without setting the scrollview controller):
DraggableScrollbar(
controller: myScrollController,
child: CustomScrollView(
slivers: [
...
],
),
),
That said, I forked this project a long time ago because of other issues. Feel free to try it
@deckerst, have you published your version of draggable_scrollbar, or should I check it out locally?
@goldy1992 please check it out locally.
@deckerst there is still an issue on your version of the repo, but I cannot make an issue on your repo.
The problem is when you want the DraggableScrollbar to have the controller of a parent NestedScrollView.
The use case would be:
DefaultTabController
that has a body
of a NestedScrollView
with a scrollController
.TabBarView
would contain a child
that has a DraggableScrollbar
DraggableScrollBar
would contain a SliverList
.Without the DraggableScrollbar
a normal ListView
can control the parent NestedScrollView
as expected.
However a DraggableScrollbar
expects a child ScrollController
Hi! Any news on this issue?
use SuperSliverList replace SliverList https://pub.dev/packages/super_sliver_list
hello , I tried to add the draggable scrollbar but I don't think how to use in out of your example. currently I use sliver list like this
new CustomScrollView ( slivers:
[
SliverAppBar(
automaticallyImplyLeading: false,
elevation: 2.0,
expandedHeight: 125.0,
backgroundColor:Colors.grey.shade50,
flexibleSpace: FlexibleSpaceBar(
background: new Image.asset('assets/logo.png')
),
),
SliverList
(
delegate: SliverChildListDelegate
(