Open Marek00Malik opened 3 years ago
Facing the same issue, any news on this?
This workaround might help for now. The ScrollController needs jumping to top and bottom, then it recognize the updated ListView's children height. The 200 ms duration gives time for widget to rebuild.
late ScrollController _controller;
...
@override
Widget build(_) {
return ...
DraggableScrollbar.semicircle(child: ListView(children: [], controller: _controller), controller: _controller)
...
}
void _calibrateScrollbarPosition() {
final double offset = _controller.offset;
_controller.jumpTo(0.0);
_controller.jumpTo(_controller.position.maxScrollExtent);
_controller.jumpTo(offset);
}
@override
void dispose() {
_controller.dispose();
...
super.dispose();
}
@override
void initState() {
super.initState();
_controller = ScrollController();
...
}
void _triggerChangeContent() {
...
setState((){});
Future.delayed(Duration(milliseconds: 200), () => _calibrateScrollbarPosition());
}
@hendrickpras This only works if you scroll by swiping, but if I use the semicircle (thumb) to scroll, it doesn't jump. Have you found any other solution to this issue?
I need that when I find a certain text that I enter in the search (that I built) It automatically scrolls there Thanck
Hello, First thing, great work guys!
I would like to ask about the possibility of adding/making the scroll calculated dynamically depending on the number of items needed to be scrolled throw. When the list of items changes (increases or decreases), the scrollbar does not change - both its height and position.
This could also help to fix this issue that is already raised: https://github.com/fluttercommunity/flutter-draggable-scrollbar/issues/32