Beispiel #1
0
        public void removeRoute(Route route)
        {
            D.assert(route != null);
            D.assert(!this._debugLocked);
            D.assert(() => {
                this._debugLocked = true;
                return(true);
            });
            D.assert(route._navigator == this);
            var index = this._history.IndexOf(route);

            D.assert(index != -1);
            var previousRoute = index > 0 ? this._history[index - 1] : null;
            var nextRoute     = index + 1 < this._history.Count ? this._history[index + 1] : null;

            this._history.RemoveAt(index);
            previousRoute?.didChangeNext(nextRoute);
            nextRoute?.didChangePrevious(previousRoute);
            foreach (var observer in this.widget.observers)
            {
                observer.didRemove(route, previousRoute);
            }

            route.dispose();
            D.assert(() => {
                this._debugLocked = false;
                return(true);
            });
            this._afterNavigation();
        }
Beispiel #2
0
        public void replace(Route oldRoute = null, Route newRoute = null)
        {
            D.assert(!this._debugLocked);
            D.assert(oldRoute != null);
            D.assert(newRoute != null);
            if (oldRoute == newRoute)
            {
                return;
            }

            D.assert(() => {
                this._debugLocked = true;
                return(true);
            });
            D.assert(oldRoute._navigator == this);
            D.assert(newRoute._navigator == null);
            D.assert(oldRoute.overlayEntries.isNotEmpty());
            D.assert(newRoute.overlayEntries.isEmpty());
            D.assert(!this.overlay.debugIsVisible(oldRoute.overlayEntries.last()));
            var index = this._history.IndexOf(oldRoute);

            D.assert(index >= 0);
            newRoute._navigator = this;
            newRoute.install(oldRoute.overlayEntries.last());
            this._history[index] = newRoute;
            newRoute.didReplace(oldRoute);
            if (index + 1 < this._history.Count)
            {
                newRoute.didChangeNext(this._history[index + 1]);
                this._history[index + 1].didChangePrevious(newRoute);
            }
            else
            {
                newRoute.didChangeNext(null);
            }

            if (index > 0)
            {
                this._history[index - 1].didChangeNext(newRoute);
                newRoute.didChangePrevious(this._history[index - 1]);
            }

            foreach (var observer in this.widget.observers)
            {
                observer.didReplace(newRoute: newRoute, oldRoute: oldRoute);
            }

            oldRoute.dispose();
            D.assert(() => {
                this._debugLocked = false;
                return(true);
            });
        }
Beispiel #3
0
 public void finalizeRoute(Route route)
 {
     this._poppedRoutes.Remove(route);
     route.dispose();
 }