Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JulianBissekkou/8df81cf7f792c1c0aeca2864af4b6f46 to your computer and use it in GitHub Desktop.
Save JulianBissekkou/8df81cf7f792c1c0aeca2864af4b6f46 to your computer and use it in GitHub Desktop.
double _calculateScrollProgress(ScrollNotification notification) {
var containerExtent = notification.metrics.viewportDimension;
if (notification is ScrollUpdateNotification) {
_dragOffset -= notification.scrollDelta;
}
if (notification is OverscrollNotification) {
_dragOffset -= notification.overscroll;
}
var percent = _dragOffset / (containerExtent * widget.dragExtentPercentage);
return percent.clamp(0.0, 1.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment