beginActivity method

void beginActivity (
  1. ScrollActivity newActivity

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.


void beginActivity(ScrollActivity newActivity) {
  if (newActivity == null)
  bool wasScrolling, oldIgnorePointer;
  if (_activity != null) {
    oldIgnorePointer = _activity.shouldIgnorePointer;
    wasScrolling = _activity.isScrolling;
    if (wasScrolling && !newActivity.isScrolling)
      didEndScroll(); // notifies and then saves the scroll offset
  } else {
    oldIgnorePointer = false;
    wasScrolling = false;
  _activity = newActivity;
  if (oldIgnorePointer != activity.shouldIgnorePointer)
  isScrollingNotifier.value = activity.isScrolling;
  if (!wasScrolling && _activity.isScrolling)