Visitar URL original
[animations] Remove copy of curves (#182) · creatorpiyush/packages@7ed84d9 · GitHub
Skip to content

Commit 7ed84d9

Browse files
authored
[animations] Remove copy of curves (flutter#182)
1 parent f2983b8 commit 7ed84d9

3 files changed

Lines changed: 30 additions & 71 deletions

File tree

‎packages/animations/lib/src/fade_scale_transition.dart‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'package:flutter/material.dart';
5+
import 'package:flutter/material.dart'
6+
hide decelerateEasing; // ignore: undefined_hidden_name
7+
// TODO(goderbauer): Remove implementation import when material properly exports the file.
8+
import 'package:flutter/src/material/curves.dart'; // ignore: implementation_imports
69

710
// TODO(shihaohong): Remove DualTransitionBuilder once flutter/flutter's `stable`
811
// branch contains DualTransitionBuilder.
912
import 'dual_transition_builder.dart' as dual_transition_builder;
1013
import 'modal.dart';
11-
import 'utils/curves.dart';
1214

1315
/// The modal transition configuration for a Material fade transition.
1416
///

‎packages/animations/lib/src/shared_axis_transition.dart‎

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@
44

55
import 'package:flutter/animation.dart';
66
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
814
import 'package:flutter/widgets.dart';
915

1016
// TODO(shihaohong): Remove DualTransitionBuilder once flutter/flutter's `stable`
1117
// branch contains DualTransitionBuilder.
1218
import 'dual_transition_builder.dart' as dual_transition_builder;
13-
import 'utils/curves.dart';
1419

1520
/// Determines which type of shared axis transition is used.
1621
enum SharedAxisTransitionType {
@@ -398,7 +403,7 @@ class _ExitTransition extends StatelessWidget {
398403
final Color fillColor;
399404
final Widget child;
400405

401-
static final Animatable<double> _fadeOutTransition = FlippedCurveTween(
406+
static final Animatable<double> _fadeOutTransition = _FlippedCurveTween(
402407
curve: accelerateEasing,
403408
).chain(CurveTween(curve: const Interval(0.0, 0.3)));
404409

@@ -478,3 +483,21 @@ class _ExitTransition extends StatelessWidget {
478483
return null; // unreachable
479484
}
480485
}
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+
}

‎packages/animations/lib/src/utils/curves.dart‎

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)