Commit adb0d2e2 authored by Collin Jackson's avatar Collin Jackson

Merge pull request #1586 from collinjackson/dispatchOnScroll

Allow derived classes of Scrollable to listen for scroll events
parents cb77bd44 477a54c3
......@@ -166,8 +166,7 @@ abstract class ScrollableState<T extends Scrollable> extends State<T> {
setState(() {
_scrollOffset = newScrollOffset;
});
if (config.onScroll != null)
config.onScroll(_scrollOffset);
dispatchOnScroll();
}
Future scrollTo(double newScrollOffset, { Duration duration, Curve curve: ease }) {
......@@ -200,6 +199,12 @@ abstract class ScrollableState<T extends Scrollable> extends State<T> {
return _startToEndAnimation();
}
// Derived classes can override this method and call super.dispatchOnScroll()
void dispatchOnScroll() {
if (config.onScroll != null)
config.onScroll(_scrollOffset);
}
double _scrollVelocity(ui.Offset velocity) {
double scrollVelocity = config.scrollDirection == ScrollDirection.horizontal
? -velocity.dx
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment