Visitar URL original
[animations] Remove copy of curves by goderbauer · Pull Request #182 · flutter/packages · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[animations] Remove copy of curves
  • Loading branch information
goderbauer committed Jul 27, 2020
commit 77b4a44ec25660ccd37fab8eb2e0028b06b5cf9b
5 changes: 4 additions & 1 deletion packages/animations/lib/src/fade_scale_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
// found in the LICENSE file.

import 'package:flutter/material.dart';
// TODO(goderbauer): Remove implementation import when material properly exports the file.
import 'package:/flutter/src/material/curves.dart'; // ignore: implementation_imports

// TODO(shihaohong): Remove DualTransitionBuilder once flutter/flutter's `stable`
// branch contains DualTransitionBuilder.
import 'dual_transition_builder.dart' as dual_transition_builder;
import 'modal.dart';
import 'utils/curves.dart';



/// The modal transition configuration for a Material fade transition.
///
Expand Down
23 changes: 21 additions & 2 deletions packages/animations/lib/src/shared_axis_transition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
import 'package:flutter/animation.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
// TODO(goderbauer): Remove implementation import when material properly exports the file.
import 'package:/flutter/src/material/curves.dart'; // ignore: implementation_imports
import 'package:flutter/widgets.dart';

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

/// Determines which type of shared axis transition is used.
enum SharedAxisTransitionType {
Expand Down Expand Up @@ -398,7 +399,7 @@ class _ExitTransition extends StatelessWidget {
final Color fillColor;
final Widget child;

static final Animatable<double> _fadeOutTransition = FlippedCurveTween(
static final Animatable<double> _fadeOutTransition = _FlippedCurveTween(
curve: accelerateEasing,
).chain(CurveTween(curve: const Interval(0.0, 0.3)));

Expand Down Expand Up @@ -478,3 +479,21 @@ class _ExitTransition extends StatelessWidget {
return null; // unreachable
}
}

/// Enables creating a flipped [CurveTween].
///
/// This creates a [CurveTween] that evaluates to a result that flips the
/// tween vertically.
///
/// This tween sequence assumes that the evaluated result has to be a double
/// between 0.0 and 1.0.
class _FlippedCurveTween extends CurveTween {
/// Creates a vertically flipped [CurveTween].
_FlippedCurveTween({
@required Curve curve,
}) : assert(curve != null),
super(curve: curve);

@override
double transform(double t) => 1.0 - super.transform(t);
}
66 changes: 0 additions & 66 deletions packages/animations/lib/src/utils/curves.dart

This file was deleted.