Beispiel #1
0
        Widget _buildOverlay(BuildContext context)
        {
            D.assert(manifest != null);
            shuttle = shuttle ?? manifest.shuttleBuilder(
                context,
                manifest.animation,
                manifest.type,
                manifest.fromHero.context,
                manifest.toHero.context);
            D.assert(shuttle != null);

            return(new AnimatedBuilder(
                       animation: _proxyAnimation,
                       child: shuttle,
                       builder: (BuildContext _, Widget child) => {
                RenderBox toHeroBox = manifest.toHero.context?.findRenderObject() as RenderBox;
                if (_aborted || toHeroBox == null || !toHeroBox.attached)
                {
                    if (_heroOpacity.isCompleted)
                    {
                        _heroOpacity = _proxyAnimation.drive(
                            _reverseTween.chain(
                                new CurveTween(curve: new Interval(_proxyAnimation.value, 1.0f)))
                            );
                    }
                }
                else if (toHeroBox.hasSize)
                {
                    RenderBox finalRouteBox = manifest.toRoute.subtreeContext?.findRenderObject() as RenderBox;
                    Offset toHeroOrigin = toHeroBox.localToGlobal(Offset.zero, ancestor: finalRouteBox);
                    if (toHeroOrigin != heroRectTween.end.topLeft)
                    {
                        Rect heroRectEnd = toHeroOrigin & heroRectTween.end.size;
                        heroRectTween = _doCreateRectTween(heroRectTween.begin, heroRectEnd);
                    }
                }

                Rect rect = heroRectTween.evaluate(_proxyAnimation);
                Size size = manifest.navigatorRect.size;
                RelativeRect offsets = RelativeRect.fromSize(rect, size);

                return new Positioned(
                    top: offsets.top,
                    right: offsets.right,
                    bottom: offsets.bottom,
                    left: offsets.left,
                    child: new IgnorePointer(
                        child: new RepaintBoundary(
                            child: new Opacity(
                                opacity: _heroOpacity.value,
                                child: child
                                )
                            )
                        )
                    );
            }
                       ));
        }