コード例 #1
0
        public override Widget build(BuildContext context)
        {
            return(new LayoutBuilder(
                       builder: (BuildContext _context, BoxConstraints constraints) => {
                Size size = constraints.biggest;

                CurvedAnimation primaryAnimation = new CurvedAnimation(
                    parent: animation,
                    curve: _transitionCurve,
                    reverseCurve: _transitionCurve.flipped
                    );

                Animation <float> clipAnimation = new FloatTween(
                    begin: 0.0f,
                    end: size.height
                    ).animate(primaryAnimation);

                Animation <float> opacityAnimation = _scrimOpacityTween.animate(primaryAnimation);
                Animation <Offset> primaryTranslationAnimation = _primaryTranslationTween.animate(primaryAnimation);

                Animation <Offset> secondaryTranslationAnimation = _secondaryTranslationTween.animate(
                    new CurvedAnimation(
                        parent: secondaryAnimation,
                        curve: _transitionCurve,
                        reverseCurve: _transitionCurve.flipped
                        )
                    );

                return new AnimatedBuilder(
                    animation: animation,
                    builder: (BuildContext _, Widget child) => {
                    return new Container(
                        color: Colors.black.withOpacity(opacityAnimation.value),
                        alignment: Alignment.bottomLeft,
                        child: new ClipRect(
                            child: new SizedBox(
                                height: clipAnimation.value,
                                child: new OverflowBox(
                                    alignment: Alignment.bottomLeft,
                                    maxHeight: size.height,
                                    child: child
                                    )
                                )
                            )
                        );
                },
                    child: new AnimatedBuilder(
                        animation: secondaryAnimation,
                        child: new FractionalTranslation(
                            translation: primaryTranslationAnimation.value,
                            child: this.child
                            ),
                        builder: (BuildContext _, Widget child) => {
                    return new FractionalTranslation(
                        translation: secondaryTranslationAnimation.value,
                        child: child
                        );
                }
                        )
                    );
            }
                       ));
        }