Пример #1
0
        void _markNeedsBuild()
        {
            if (_handles != null)
            {
                _handles[0].markNeedsBuild();
                _handles[1].markNeedsBuild();
            }

            _toolbar?.markNeedsBuild();
        }
Пример #2
0
        void updateDrag(Offset globalPosition)
        {
            _lastOffset = globalPosition - dragStartPoint;
            _entry.markNeedsBuild();

            HitTestResult result = new HitTestResult();

            WidgetsBinding.instance.hitTest(result, globalPosition + feedbackOffset);

            List <_DragTargetState <T> > targets = _getDragTargets(result.path);

            bool listsMatch = false;

            if (targets.Count >= _enteredTargets.Count && _enteredTargets.isNotEmpty())
            {
                listsMatch = true;
                List <_DragTargetState <T> > .Enumerator iterator = targets.GetEnumerator();
                for (int i = 0; i < _enteredTargets.Count; i++)
                {
                    iterator.MoveNext();
                    if (iterator.Current != _enteredTargets[i])
                    {
                        listsMatch = false;
                        break;
                    }
                }
            }

            if (listsMatch)
            {
                return;
            }

            _leaveAllEntered();

            _DragTargetState <T> newTarget = null;

            foreach (var target in targets)
            {
                _enteredTargets.Add(target);
                if (target.didEnter(this))
                {
                    newTarget = target;
                    break;
                }
            }

            _activeTarget = newTarget;
        }
Пример #3
0
        public void divert(_HeroFlightManifest newManifest)
        {
            D.assert(manifest.tag == newManifest.tag);
            if (manifest.type == HeroFlightDirection.push && newManifest.type == HeroFlightDirection.pop)
            {
                D.assert(newManifest.animation.status == AnimationStatus.reverse);
                D.assert(manifest.fromHero == newManifest.toHero);
                D.assert(manifest.toHero == newManifest.fromHero);
                D.assert(manifest.fromRoute == newManifest.toRoute);
                D.assert(manifest.toRoute == newManifest.fromRoute);

                _proxyAnimation.parent = new ReverseAnimation(newManifest.animation);
                heroRectTween          = new ReverseTween <Rect>(heroRectTween);
            }
            else if (manifest.type == HeroFlightDirection.pop && newManifest.type == HeroFlightDirection.push)
            {
                D.assert(newManifest.animation.status == AnimationStatus.forward);
                D.assert(manifest.toHero == newManifest.fromHero);
                D.assert(manifest.toRoute == newManifest.fromRoute);

                _proxyAnimation.parent = newManifest.animation.drive(
                    new FloatTween(
                        begin: manifest.animation.value,
                        end: 1.0f
                        )
                    );

                if (manifest.fromHero != newManifest.toHero)
                {
                    manifest.fromHero.endFlight(keepPlaceholder: true);
                    newManifest.toHero.startFlight();
                    heroRectTween = _doCreateRectTween(
                        heroRectTween.end,
                        HeroUtils._boundingBoxFor(newManifest.toHero.context, newManifest.toRoute.subtreeContext)
                        );
                }
                else
                {
                    heroRectTween = _doCreateRectTween(heroRectTween.end, heroRectTween.begin);
                }
            }
            else
            {
                D.assert(manifest.fromHero != newManifest.fromHero);
                D.assert(manifest.toHero != newManifest.toHero);

                heroRectTween = _doCreateRectTween(
                    heroRectTween.evaluate(_proxyAnimation),
                    HeroUtils._boundingBoxFor(newManifest.toHero.context, newManifest.toRoute.subtreeContext)
                    );
                shuttle = null;

                if (newManifest.type == HeroFlightDirection.pop)
                {
                    _proxyAnimation.parent = new ReverseAnimation(newManifest.animation);
                }
                else
                {
                    _proxyAnimation.parent = newManifest.animation;
                }
                manifest.fromHero.endFlight(keepPlaceholder: true);
                manifest.toHero.endFlight(keepPlaceholder: true);

                // Let the heroes in each of the routes rebuild with their placeholders.
                newManifest.fromHero.startFlight(shouldIncludedChildInPlaceholder: newManifest.type == HeroFlightDirection.push);
                newManifest.toHero.startFlight();

                overlayEntry.markNeedsBuild();
            }

            _aborted = false;
            manifest = newManifest;
        }