Skip to content

Instantly share code, notes, and snippets.

@JulianBissekkou
Created February 17, 2019 19:01
Show Gist options
  • Save JulianBissekkou/b4aa93a69cf357c91505f26bdcb9cb2d to your computer and use it in GitHub Desktop.
Save JulianBissekkou/b4aa93a69cf357c91505f26bdcb9cb2d to your computer and use it in GitHub Desktop.
bool _handleScrollNotification(ScrollNotification notification) {
if (_didDragStart(notification)) {
_dragOffset = 0;
_pullToReachStarted = true;
}
if (_didDragEnd(notification)) {
_dragOffset = 0;
_pullToReachStarted = false;
_notifySelectIfNeeded();
}
if (_pullToReachStarted) {
_shouldNotifyOnDragEnd = true;
} else {
return false;
}
var progress = _calculateScrollProgress(notification);
var index = indexCalculator.getIndexForScrollPercent(progress);
if (_itemIndex != index) {
_itemIndex = index;
PullToReachScope.of(context).setFocusIndex(_itemIndex);
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment