Esempio n. 1
0
        internal void _prepend(FocusScopeNode child)
        {
            D.assert(child != this);
            D.assert(child != this._firstChild);
            D.assert(child != this._lastChild);
            D.assert(child._parent == null);
            D.assert(child._manager == null);
            D.assert(child._nextSibling == null);
            D.assert(child._previousSibling == null);
            D.assert(() => {
                var node = this;
                while (node._parent != null)
                {
                    node = node._parent;
                }

                D.assert(node != child);
                return(true);
            });
            child._parent      = this;
            child._nextSibling = this._firstChild;
            if (this._firstChild != null)
            {
                this._firstChild._previousSibling = child;
            }

            this._firstChild = child;
            this._lastChild  = this._lastChild ?? child;
            child._updateManager(this._manager);
        }
Esempio n. 2
0
        internal void _remove(FocusScopeNode child)
        {
            D.assert(child._parent == this);
            D.assert(child._manager == this._manager);
            D.assert(this._debugUltimatePreviousSiblingOf(child, equals: this._firstChild));
            D.assert(this._debugUltimateNextSiblingOf(child, equals: this._lastChild));
            if (child._previousSibling == null)
            {
                D.assert(this._firstChild == child);
                this._firstChild = child._nextSibling;
            }
            else
            {
                child._previousSibling._nextSibling = child._nextSibling;
            }

            if (child._nextSibling == null)
            {
                D.assert(this._lastChild == child);
                this._lastChild = child._previousSibling;
            }
            else
            {
                child._nextSibling._previousSibling = child._previousSibling;
            }

            child._previousSibling = null;
            child._nextSibling     = null;
            child._parent          = null;
            child._updateManager(null);
        }