beginActivity method

  1. @override
void beginActivity(
  1. ScrollActivity? newActivity
)
override

Change the current activity, disposing of the old one and sending scroll notifications as necessary.

If the argument is null, this method has no effect. This is convenient for cases where the new activity is obtained from another method, and that method might return null, since it means the caller does not have to explicitly null-check the argument.

Implementation

@override
void beginActivity(ScrollActivity? newActivity) {
  _heldPreviousVelocity = 0.0;
  if (newActivity == null) {
    return;
  }
  assert(newActivity.delegate == this);
  super.beginActivity(newActivity);
  _currentDrag?.dispose();
  _currentDrag = null;
  if (!activity!.isScrolling) {
    updateUserScrollDirection(ScrollDirection.idle);
  }
}