|
4 | 4 |
|
5 | 5 | import 'package:flutter/animation.dart'; |
6 | 6 | import 'package:flutter/foundation.dart'; |
7 | | -import 'package:flutter/material.dart'; |
| 7 | +import 'package:flutter/material.dart' |
| 8 | + hide |
| 9 | + decelerateEasing, // ignore: undefined_hidden_name |
| 10 | + standardEasing, // ignore: undefined_hidden_name |
| 11 | + accelerateEasing; // ignore: undefined_hidden_name |
| 12 | +// TODO(goderbauer): Remove implementation import when material properly exports the file. |
| 13 | +import 'package:flutter/src/material/curves.dart'; // ignore: implementation_imports |
8 | 14 | import 'package:flutter/widgets.dart'; |
9 | 15 |
|
10 | 16 | // TODO(shihaohong): Remove DualTransitionBuilder once flutter/flutter's `stable` |
11 | 17 | // branch contains DualTransitionBuilder. |
12 | 18 | import 'dual_transition_builder.dart' as dual_transition_builder; |
13 | | -import 'utils/curves.dart'; |
14 | 19 |
|
15 | 20 | /// Determines which type of shared axis transition is used. |
16 | 21 | enum SharedAxisTransitionType { |
@@ -398,7 +403,7 @@ class _ExitTransition extends StatelessWidget { |
398 | 403 | final Color fillColor; |
399 | 404 | final Widget child; |
400 | 405 |
|
401 | | - static final Animatable<double> _fadeOutTransition = FlippedCurveTween( |
| 406 | + static final Animatable<double> _fadeOutTransition = _FlippedCurveTween( |
402 | 407 | curve: accelerateEasing, |
403 | 408 | ).chain(CurveTween(curve: const Interval(0.0, 0.3))); |
404 | 409 |
|
@@ -478,3 +483,21 @@ class _ExitTransition extends StatelessWidget { |
478 | 483 | return null; // unreachable |
479 | 484 | } |
480 | 485 | } |
| 486 | + |
| 487 | +/// Enables creating a flipped [CurveTween]. |
| 488 | +/// |
| 489 | +/// This creates a [CurveTween] that evaluates to a result that flips the |
| 490 | +/// tween vertically. |
| 491 | +/// |
| 492 | +/// This tween sequence assumes that the evaluated result has to be a double |
| 493 | +/// between 0.0 and 1.0. |
| 494 | +class _FlippedCurveTween extends CurveTween { |
| 495 | + /// Creates a vertically flipped [CurveTween]. |
| 496 | + _FlippedCurveTween({ |
| 497 | + @required Curve curve, |
| 498 | + }) : assert(curve != null), |
| 499 | + super(curve: curve); |
| 500 | + |
| 501 | + @override |
| 502 | + double transform(double t) => 1.0 - super.transform(t); |
| 503 | +} |
0 commit comments