Commit da685ec2 authored by Adam Barth's avatar Adam Barth

Merge pull request #1485 from abarth/animation_renames

Improves names of animation classes
parents 850df83e 3f82552d
...@@ -60,7 +60,7 @@ class FeedFragment extends StatefulComponent { ...@@ -60,7 +60,7 @@ class FeedFragment extends StatefulComponent {
class FeedFragmentState extends State<FeedFragment> { class FeedFragmentState extends State<FeedFragment> {
FitnessMode _fitnessMode = FitnessMode.feed; FitnessMode _fitnessMode = FitnessMode.feed;
AnimationStatus _snackBarStatus = AnimationStatus.dismissed; PerformanceStatus _snackBarStatus = PerformanceStatus.dismissed;
bool _isShowingSnackBar = false; bool _isShowingSnackBar = false;
void _handleFitnessModeChange(FitnessMode value) { void _handleFitnessModeChange(FitnessMode value) {
...@@ -126,7 +126,7 @@ class FeedFragmentState extends State<FeedFragment> { ...@@ -126,7 +126,7 @@ class FeedFragmentState extends State<FeedFragment> {
setState(() { setState(() {
_undoItem = item; _undoItem = item;
_isShowingSnackBar = true; _isShowingSnackBar = true;
_snackBarStatus = AnimationStatus.forward; _snackBarStatus = PerformanceStatus.forward;
}); });
} }
...@@ -207,13 +207,13 @@ class FeedFragmentState extends State<FeedFragment> { ...@@ -207,13 +207,13 @@ class FeedFragmentState extends State<FeedFragment> {
} }
Widget buildSnackBar() { Widget buildSnackBar() {
if (_snackBarStatus == AnimationStatus.dismissed) if (_snackBarStatus == PerformanceStatus.dismissed)
return null; return null;
return new SnackBar( return new SnackBar(
showing: _isShowingSnackBar, showing: _isShowingSnackBar,
content: new Text("Item deleted."), content: new Text("Item deleted."),
actions: [new SnackBarAction(label: "UNDO", onPressed: _handleUndo)], actions: [new SnackBarAction(label: "UNDO", onPressed: _handleUndo)],
onDismissed: () { setState(() { _snackBarStatus = AnimationStatus.dismissed; }); } onDismissed: () { setState(() { _snackBarStatus = PerformanceStatus.dismissed; }); }
); );
} }
......
...@@ -25,7 +25,7 @@ class StockHomeState extends State<StockHome> { ...@@ -25,7 +25,7 @@ class StockHomeState extends State<StockHome> {
bool _isSearching = false; bool _isSearching = false;
String _searchQuery; String _searchQuery;
AnimationStatus _snackBarStatus = AnimationStatus.dismissed; PerformanceStatus _snackBarStatus = PerformanceStatus.dismissed;
bool _isSnackBarShowing = false; bool _isSnackBarShowing = false;
void _handleSearchBegin() { void _handleSearchBegin() {
...@@ -224,20 +224,20 @@ class StockHomeState extends State<StockHome> { ...@@ -224,20 +224,20 @@ class StockHomeState extends State<StockHome> {
GlobalKey snackBarKey = new GlobalKey(label: 'snackbar'); GlobalKey snackBarKey = new GlobalKey(label: 'snackbar');
Widget buildSnackBar() { Widget buildSnackBar() {
if (_snackBarStatus == AnimationStatus.dismissed) if (_snackBarStatus == PerformanceStatus.dismissed)
return null; return null;
return new SnackBar( return new SnackBar(
showing: _isSnackBarShowing, showing: _isSnackBarShowing,
content: new Text("Stock purchased!"), content: new Text("Stock purchased!"),
actions: [new SnackBarAction(label: "UNDO", onPressed: _handleUndo)], actions: [new SnackBarAction(label: "UNDO", onPressed: _handleUndo)],
onDismissed: () { setState(() { _snackBarStatus = AnimationStatus.dismissed; }); } onDismissed: () { setState(() { _snackBarStatus = PerformanceStatus.dismissed; }); }
); );
} }
void _handleStockPurchased() { void _handleStockPurchased() {
setState(() { setState(() {
_isSnackBarShowing = true; _isSnackBarShowing = true;
_snackBarStatus = AnimationStatus.forward; _snackBarStatus = PerformanceStatus.forward;
}); });
} }
......
...@@ -13,7 +13,7 @@ class ProgressIndicatorApp extends StatefulComponent { ...@@ -13,7 +13,7 @@ class ProgressIndicatorApp extends StatefulComponent {
class ProgressIndicatorAppState extends State<ProgressIndicatorApp> { class ProgressIndicatorAppState extends State<ProgressIndicatorApp> {
void initState() { void initState() {
super.initState(); super.initState();
valueAnimation = new ValueAnimation<double>() valueAnimation = new ValuePerformance<double>()
..duration = const Duration(milliseconds: 1500) ..duration = const Duration(milliseconds: 1500)
..variable = new AnimatedValue<double>( ..variable = new AnimatedValue<double>(
0.0, 0.0,
...@@ -22,15 +22,15 @@ class ProgressIndicatorAppState extends State<ProgressIndicatorApp> { ...@@ -22,15 +22,15 @@ class ProgressIndicatorAppState extends State<ProgressIndicatorApp> {
reverseCurve: ease, reverseCurve: ease,
interval: new Interval(0.0, 0.9) interval: new Interval(0.0, 0.9)
); );
valueAnimation.addStatusListener((AnimationStatus status) { valueAnimation.addStatusListener((PerformanceStatus status) {
if (status == AnimationStatus.dismissed || status == AnimationStatus.completed) if (status == PerformanceStatus.dismissed || status == PerformanceStatus.completed)
reverseValueAnimationDirection(); reverseValueAnimationDirection();
}); });
valueAnimation.play(valueAnimationDirection); valueAnimation.play(valueAnimationDirection);
} }
ValueAnimation<double> valueAnimation; ValuePerformance<double> valueAnimation;
Direction valueAnimationDirection = Direction.forward; AnimationDirection valueAnimationDirection = AnimationDirection.forward;
void handleTap() { void handleTap() {
setState(() { setState(() {
...@@ -43,9 +43,9 @@ class ProgressIndicatorAppState extends State<ProgressIndicatorApp> { ...@@ -43,9 +43,9 @@ class ProgressIndicatorAppState extends State<ProgressIndicatorApp> {
} }
void reverseValueAnimationDirection() { void reverseValueAnimationDirection() {
valueAnimationDirection = (valueAnimationDirection == Direction.forward) valueAnimationDirection = (valueAnimationDirection == AnimationDirection.forward)
? Direction.reverse ? AnimationDirection.reverse
: Direction.forward; : AnimationDirection.forward;
valueAnimation.play(valueAnimationDirection); valueAnimation.play(valueAnimationDirection);
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
library animation; library animation;
export 'src/animation/animated_value.dart'; export 'src/animation/animated_value.dart';
export 'src/animation/animation_performance.dart'; export 'src/animation/performance.dart';
export 'src/animation/clamped_simulation.dart'; export 'src/animation/clamped_simulation.dart';
export 'src/animation/curves.dart'; export 'src/animation/curves.dart';
export 'src/animation/forces.dart'; export 'src/animation/forces.dart';
......
...@@ -7,7 +7,7 @@ import 'dart:sky' show Color, Rect; ...@@ -7,7 +7,7 @@ import 'dart:sky' show Color, Rect;
import 'package:sky/src/animation/curves.dart'; import 'package:sky/src/animation/curves.dart';
/// The direction in which an animation is running /// The direction in which an animation is running
enum Direction { enum AnimationDirection {
/// The animation is running from beginning to end /// The animation is running from beginning to end
forward, forward,
...@@ -17,11 +17,11 @@ enum Direction { ...@@ -17,11 +17,11 @@ enum Direction {
/// An interface describing a variable that changes as an animation progresses. /// An interface describing a variable that changes as an animation progresses.
/// ///
/// AnimatedVariables, by convention, must be cheap to create. This allows them to be used in /// Animatable objects, by convention, must be cheap to create. This allows them
/// build functions in Widgets. /// to be used in build functions in Widgets.
abstract class AnimatedVariable { abstract class Animatable {
/// Update the variable to a given time in an animation that is running in the given direction /// Update the variable to a given time in an animation that is running in the given direction
void setProgress(double t, Direction direction); void setProgress(double t, AnimationDirection direction);
String toString(); String toString();
} }
...@@ -53,7 +53,7 @@ class AnimationTiming { ...@@ -53,7 +53,7 @@ class AnimationTiming {
Curve reverseCurve; Curve reverseCurve;
/// Applies this timing to the given animation clock value in the given direction /// Applies this timing to the given animation clock value in the given direction
double transform(double t, Direction direction) { double transform(double t, AnimationDirection direction) {
Interval interval = _getInterval(direction); Interval interval = _getInterval(direction);
if (interval != null) if (interval != null)
t = interval.transform(t); t = interval.transform(t);
...@@ -65,19 +65,19 @@ class AnimationTiming { ...@@ -65,19 +65,19 @@ class AnimationTiming {
return _applyCurve(t, direction); return _applyCurve(t, direction);
} }
Interval _getInterval(Direction direction) { Interval _getInterval(AnimationDirection direction) {
if (direction == Direction.forward || reverseInterval == null) if (direction == AnimationDirection.forward || reverseInterval == null)
return interval; return interval;
return reverseInterval; return reverseInterval;
} }
Curve _getCurve(Direction direction) { Curve _getCurve(AnimationDirection direction) {
if (direction == Direction.forward || reverseCurve == null) if (direction == AnimationDirection.forward || reverseCurve == null)
return curve; return curve;
return reverseCurve; return reverseCurve;
} }
double _applyCurve(double t, Direction direction) { double _applyCurve(double t, AnimationDirection direction) {
Curve curve = _getCurve(direction); Curve curve = _getCurve(direction);
if (curve == null) if (curve == null)
return t; return t;
...@@ -86,7 +86,7 @@ class AnimationTiming { ...@@ -86,7 +86,7 @@ class AnimationTiming {
} }
/// An animated variable with a concrete type /// An animated variable with a concrete type
class AnimatedValue<T extends dynamic> extends AnimationTiming implements AnimatedVariable { class AnimatedValue<T extends dynamic> extends AnimationTiming implements Animatable {
AnimatedValue(this.begin, { this.end, Interval interval, Interval reverseInterval, Curve curve, Curve reverseCurve }) AnimatedValue(this.begin, { this.end, Interval interval, Interval reverseInterval, Curve curve, Curve reverseCurve })
: super(interval: interval, reverseInterval: reverseInterval, curve: curve, reverseCurve: reverseCurve) { : super(interval: interval, reverseInterval: reverseInterval, curve: curve, reverseCurve: reverseCurve) {
value = begin; value = begin;
...@@ -105,7 +105,7 @@ class AnimatedValue<T extends dynamic> extends AnimationTiming implements Animat ...@@ -105,7 +105,7 @@ class AnimatedValue<T extends dynamic> extends AnimationTiming implements Animat
T lerp(double t) => begin + (end - begin) * t; T lerp(double t) => begin + (end - begin) * t;
/// Updates the value of this variable according to the given animation clock value and direction /// Updates the value of this variable according to the given animation clock value and direction
void setProgress(double t, Direction direction) { void setProgress(double t, AnimationDirection direction) {
if (end != null) { if (end != null) {
t = transform(t, direction); t = transform(t, direction);
if (t == 0.0) if (t == 0.0)
...@@ -120,24 +120,6 @@ class AnimatedValue<T extends dynamic> extends AnimationTiming implements Animat ...@@ -120,24 +120,6 @@ class AnimatedValue<T extends dynamic> extends AnimationTiming implements Animat
String toString() => 'AnimatedValue(begin=$begin, end=$end, value=$value)'; String toString() => 'AnimatedValue(begin=$begin, end=$end, value=$value)';
} }
/// A list of animated variables
class AnimatedList extends AnimationTiming implements AnimatedVariable {
/// The list of variables contained in the list
List<AnimatedVariable> variables;
AnimatedList(this.variables, { Interval interval, Interval reverseInterval, Curve curve, Curve reverseCurve })
: super(interval: interval, reverseInterval: reverseInterval, curve: curve, reverseCurve: reverseCurve);
// Updates the value of all the variables in the list according to the given animation clock value and direction
void setProgress(double t, Direction direction) {
double adjustedTime = transform(t, direction);
for (AnimatedVariable variable in variables)
variable.setProgress(adjustedTime, direction);
}
String toString() => 'AnimatedList([$variables])';
}
/// An animated variable containing a color /// An animated variable containing a color
/// ///
/// This class specializes the interpolation of AnimatedValue<Color> to be /// This class specializes the interpolation of AnimatedValue<Color> to be
...@@ -153,8 +135,8 @@ class AnimatedColorValue extends AnimatedValue<Color> { ...@@ -153,8 +135,8 @@ class AnimatedColorValue extends AnimatedValue<Color> {
/// ///
/// This class specializes the interpolation of AnimatedValue<Rect> to be /// This class specializes the interpolation of AnimatedValue<Rect> to be
/// appropriate for rectangles. /// appropriate for rectangles.
class AnimatedRect extends AnimatedValue<Rect> { class AnimatedRectValue extends AnimatedValue<Rect> {
AnimatedRect(Rect begin, { Rect end, Interval interval, Interval reverseInterval, Curve curve, Curve reverseCurve }) AnimatedRectValue(Rect begin, { Rect end, Interval interval, Interval reverseInterval, Curve curve, Curve reverseCurve })
: super(begin, end: end, interval: interval, reverseInterval: reverseInterval, curve: curve, reverseCurve: reverseCurve); : super(begin, end: end, interval: interval, reverseInterval: reverseInterval, curve: curve, reverseCurve: reverseCurve);
Rect lerp(double t) => Rect.lerp(begin, end, t); Rect lerp(double t) => Rect.lerp(begin, end, t);
......
...@@ -9,7 +9,7 @@ import 'package:sky/src/animation/forces.dart'; ...@@ -9,7 +9,7 @@ import 'package:sky/src/animation/forces.dart';
import 'package:sky/src/animation/simulation_stepper.dart'; import 'package:sky/src/animation/simulation_stepper.dart';
/// The status of an animation /// The status of an animation
enum AnimationStatus { enum PerformanceStatus {
/// The animation is stopped at the beginning /// The animation is stopped at the beginning
dismissed, dismissed,
...@@ -23,27 +23,27 @@ enum AnimationStatus { ...@@ -23,27 +23,27 @@ enum AnimationStatus {
completed, completed,
} }
typedef void AnimationPerformanceListener(); typedef void PerformanceListener();
typedef void AnimationPerformanceStatusListener(AnimationStatus status); typedef void PerformanceStatusListener(PerformanceStatus status);
/// An interface that is implemented by [AnimationPerformance] that exposes a /// An interface that is implemented by [Performance] that exposes a
/// read-only view of the underlying performance. This is used by classes that /// read-only view of the underlying performance. This is used by classes that
/// want to watch a performance but should not be able to change the /// want to watch a performance but should not be able to change the
/// performance's state. /// performance's state.
abstract class WatchableAnimationPerformance { abstract class PerformanceView {
/// Update the given variable according to the current progress of the performance /// Update the given variable according to the current progress of the performance
void updateVariable(AnimatedVariable variable); void updateVariable(Animatable variable);
/// Calls the listener every time the progress of the performance changes /// Calls the listener every time the progress of the performance changes
void addListener(AnimationPerformanceListener listener); void addListener(PerformanceListener listener);
/// Stop calling the listener every time the progress of the performance changes /// Stop calling the listener every time the progress of the performance changes
void removeListener(AnimationPerformanceListener listener); void removeListener(PerformanceListener listener);
/// Calls listener every time the status of the performance changes /// Calls listener every time the status of the performance changes
void addStatusListener(AnimationPerformanceStatusListener listener); void addStatusListener(PerformanceStatusListener listener);
/// Stops calling the listener every time the status of the performance changes /// Stops calling the listener every time the status of the performance changes
void removeStatusListener(AnimationPerformanceStatusListener listener); void removeStatusListener(PerformanceStatusListener listener);
} }
/// A timeline that can be reversed and used to update [AnimatedVariable]s. /// A timeline that can be reversed and used to update [Animatable]s.
/// ///
/// For example, a performance may handle an animation of a menu opening by /// For example, a performance may handle an animation of a menu opening by
/// sliding and fading in (changing Y value and opacity) over .5 seconds. The /// sliding and fading in (changing Y value and opacity) over .5 seconds. The
...@@ -51,30 +51,30 @@ abstract class WatchableAnimationPerformance { ...@@ -51,30 +51,30 @@ abstract class WatchableAnimationPerformance {
/// may also take direct control of the timeline by manipulating [progress], or /// may also take direct control of the timeline by manipulating [progress], or
/// [fling] the timeline causing a physics-based simulation to take over the /// [fling] the timeline causing a physics-based simulation to take over the
/// progression. /// progression.
class AnimationPerformance implements WatchableAnimationPerformance { class Performance implements PerformanceView {
AnimationPerformance({ this.duration, double progress }) { Performance({ this.duration, double progress }) {
_timeline = new SimulationStepper(_tick); _timeline = new SimulationStepper(_tick);
if (progress != null) if (progress != null)
_timeline.value = progress.clamp(0.0, 1.0); _timeline.value = progress.clamp(0.0, 1.0);
} }
/// Returns a [WatchableAnimationPerformance] for this performance, /// Returns a [PerformanceView] for this performance,
/// so that a pointer to this object can be passed around without /// so that a pointer to this object can be passed around without
/// allowing users of that pointer to mutate the AnimationPerformance state. /// allowing users of that pointer to mutate the AnimationPerformance state.
WatchableAnimationPerformance get view => this; PerformanceView get view => this;
/// The length of time this performance should last /// The length of time this performance should last
Duration duration; Duration duration;
SimulationStepper _timeline; SimulationStepper _timeline;
Direction _direction; AnimationDirection _direction;
/// The direction used to select the current curve /// The direction used to select the current curve
/// ///
/// Curve direction is only reset when we hit the beginning or the end of the /// Curve direction is only reset when we hit the beginning or the end of the
/// timeline to avoid discontinuities in the value of any variables this /// timeline to avoid discontinuities in the value of any variables this
/// performance is used to animate. /// performance is used to animate.
Direction _curveDirection; AnimationDirection _curveDirection;
/// If non-null, animate with this timing instead of a linear timing /// If non-null, animate with this timing instead of a linear timing
AnimationTiming timing; AnimationTiming timing;
...@@ -95,45 +95,45 @@ class AnimationPerformance implements WatchableAnimationPerformance { ...@@ -95,45 +95,45 @@ class AnimationPerformance implements WatchableAnimationPerformance {
} }
/// Whether this animation is stopped at the beginning /// Whether this animation is stopped at the beginning
bool get isDismissed => status == AnimationStatus.dismissed; bool get isDismissed => status == PerformanceStatus.dismissed;
/// Whether this animation is stopped at the end /// Whether this animation is stopped at the end
bool get isCompleted => status == AnimationStatus.completed; bool get isCompleted => status == PerformanceStatus.completed;
/// Whether this animation is currently animating in either the forward or reverse direction /// Whether this animation is currently animating in either the forward or reverse direction
bool get isAnimating => _timeline.isAnimating; bool get isAnimating => _timeline.isAnimating;
/// The current status of this animation /// The current status of this animation
AnimationStatus get status { PerformanceStatus get status {
if (!isAnimating && progress == 1.0) if (!isAnimating && progress == 1.0)
return AnimationStatus.completed; return PerformanceStatus.completed;
if (!isAnimating && progress == 0.0) if (!isAnimating && progress == 0.0)
return AnimationStatus.dismissed; return PerformanceStatus.dismissed;
return _direction == Direction.forward ? return _direction == AnimationDirection.forward ?
AnimationStatus.forward : PerformanceStatus.forward :
AnimationStatus.reverse; PerformanceStatus.reverse;
} }
/// Update the given varaible according to the current progress of this performance /// Update the given varaible according to the current progress of this performance
void updateVariable(AnimatedVariable variable) { void updateVariable(Animatable variable) {
variable.setProgress(_curvedProgress, _curveDirection); variable.setProgress(_curvedProgress, _curveDirection);
} }
/// Start running this animation forwards (towards the end) /// Start running this animation forwards (towards the end)
Future forward() => play(Direction.forward); Future forward() => play(AnimationDirection.forward);
/// Start running this animation in reverse (towards the beginning) /// Start running this animation in reverse (towards the beginning)
Future reverse() => play(Direction.reverse); Future reverse() => play(AnimationDirection.reverse);
/// Start running this animation in the given direction /// Start running this animation in the given direction
Future play([Direction direction = Direction.forward]) { Future play([AnimationDirection direction = AnimationDirection.forward]) {
_direction = direction; _direction = direction;
return resume(); return resume();
} }
/// Start running this animation in the most recently direction /// Start running this animation in the most recent direction
Future resume() { Future resume() {
return _animateTo(_direction == Direction.forward ? 1.0 : 0.0); return _animateTo(_direction == AnimationDirection.forward ? 1.0 : 0.0);
} }
/// Stop running this animation /// Stop running this animation
...@@ -149,46 +149,46 @@ class AnimationPerformance implements WatchableAnimationPerformance { ...@@ -149,46 +149,46 @@ class AnimationPerformance implements WatchableAnimationPerformance {
Future fling({double velocity: 1.0, Force force}) { Future fling({double velocity: 1.0, Force force}) {
if (force == null) if (force == null)
force = kDefaultSpringForce; force = kDefaultSpringForce;
_direction = velocity < 0.0 ? Direction.reverse : Direction.forward; _direction = velocity < 0.0 ? AnimationDirection.reverse : AnimationDirection.forward;
return _timeline.animateWith(force.release(progress, velocity)); return _timeline.animateWith(force.release(progress, velocity));
} }
final List<AnimationPerformanceListener> _listeners = new List<AnimationPerformanceListener>(); final List<PerformanceListener> _listeners = new List<PerformanceListener>();
/// Calls the listener every time the progress of this performance changes /// Calls the listener every time the progress of this performance changes
void addListener(AnimationPerformanceListener listener) { void addListener(PerformanceListener listener) {
_listeners.add(listener); _listeners.add(listener);
} }
/// Stop calling the listener every time the progress of this performance changes /// Stop calling the listener every time the progress of this performance changes
void removeListener(AnimationPerformanceListener listener) { void removeListener(PerformanceListener listener) {
_listeners.remove(listener); _listeners.remove(listener);
} }
void _notifyListeners() { void _notifyListeners() {
List<AnimationPerformanceListener> localListeners = new List<AnimationPerformanceListener>.from(_listeners); List<PerformanceListener> localListeners = new List<PerformanceListener>.from(_listeners);
for (AnimationPerformanceListener listener in localListeners) for (PerformanceListener listener in localListeners)
listener(); listener();
} }
final List<AnimationPerformanceStatusListener> _statusListeners = new List<AnimationPerformanceStatusListener>(); final List<PerformanceStatusListener> _statusListeners = new List<PerformanceStatusListener>();
/// Calls listener every time the status of this performance changes /// Calls listener every time the status of this performance changes
void addStatusListener(AnimationPerformanceStatusListener listener) { void addStatusListener(PerformanceStatusListener listener) {
_statusListeners.add(listener); _statusListeners.add(listener);
} }
/// Stops calling the listener every time the status of this performance changes /// Stops calling the listener every time the status of this performance changes
void removeStatusListener(AnimationPerformanceStatusListener listener) { void removeStatusListener(PerformanceStatusListener listener) {
_statusListeners.remove(listener); _statusListeners.remove(listener);
} }
AnimationStatus _lastStatus = AnimationStatus.dismissed; PerformanceStatus _lastStatus = PerformanceStatus.dismissed;
void _checkStatusChanged() { void _checkStatusChanged() {
AnimationStatus currentStatus = status; PerformanceStatus currentStatus = status;
if (currentStatus != _lastStatus) { if (currentStatus != _lastStatus) {
List<AnimationPerformanceStatusListener> localListeners = new List<AnimationPerformanceStatusListener>.from(_statusListeners); List<PerformanceStatusListener> localListeners = new List<PerformanceStatusListener>.from(_statusListeners);
for (AnimationPerformanceStatusListener listener in localListeners) for (PerformanceStatusListener listener in localListeners)
listener(currentStatus); listener(currentStatus);
} }
_lastStatus = currentStatus; _lastStatus = currentStatus;
...@@ -196,7 +196,7 @@ class AnimationPerformance implements WatchableAnimationPerformance { ...@@ -196,7 +196,7 @@ class AnimationPerformance implements WatchableAnimationPerformance {
void _updateCurveDirection() { void _updateCurveDirection() {
if (status != _lastStatus) { if (status != _lastStatus) {
if (_lastStatus == AnimationStatus.dismissed || _lastStatus == AnimationStatus.completed) if (_lastStatus == PerformanceStatus.dismissed || _lastStatus == PerformanceStatus.completed)
_curveDirection = _direction; _curveDirection = _direction;
} }
} }
...@@ -221,8 +221,8 @@ class AnimationPerformance implements WatchableAnimationPerformance { ...@@ -221,8 +221,8 @@ class AnimationPerformance implements WatchableAnimationPerformance {
} }
/// An animation performance with an animated variable with a concrete type /// An animation performance with an animated variable with a concrete type
class ValueAnimation<T> extends AnimationPerformance { class ValuePerformance<T> extends Performance {
ValueAnimation({ this.variable, Duration duration, double progress }) : ValuePerformance({ this.variable, Duration duration, double progress }) :
super(duration: duration, progress: progress); super(duration: duration, progress: progress);
AnimatedValue<T> variable; AnimatedValue<T> variable;
......
...@@ -28,7 +28,7 @@ class _TweenSimulation extends Simulation { ...@@ -28,7 +28,7 @@ class _TweenSimulation extends Simulation {
double x(double timeInSeconds) { double x(double timeInSeconds) {
assert(timeInSeconds >= 0.0); assert(timeInSeconds >= 0.0);
final double t = (timeInSeconds / _durationInSeconds).clamp(0.0, 1.0); final double t = (timeInSeconds / _durationInSeconds).clamp(0.0, 1.0);
_tween.setProgress(t, Direction.forward); _tween.setProgress(t, AnimationDirection.forward);
return _tween.value; return _tween.value;
} }
......
...@@ -30,13 +30,13 @@ class RadialReaction { ...@@ -30,13 +30,13 @@ class RadialReaction {
_outerOpacity = new AnimatedValue<double>(0.0, end: _kMaxOpacity, curve: easeOut); _outerOpacity = new AnimatedValue<double>(0.0, end: _kMaxOpacity, curve: easeOut);
_innerCenter = new AnimatedValue<Point>(startPosition, end: center, curve: easeOut); _innerCenter = new AnimatedValue<Point>(startPosition, end: center, curve: easeOut);
_innerRadius = new AnimatedValue<double>(0.0, end: radius, curve: easeOut); _innerRadius = new AnimatedValue<double>(0.0, end: radius, curve: easeOut);
_showPerformance = new AnimationPerformance(duration: _kShowDuration) _showPerformance = new Performance(duration: _kShowDuration)
..addListener(() { ..addListener(() {
_showPerformance.updateVariable(_outerOpacity); _showPerformance.updateVariable(_outerOpacity);
_showPerformance.updateVariable(_innerCenter); _showPerformance.updateVariable(_innerCenter);
_showPerformance.updateVariable(_innerRadius); _showPerformance.updateVariable(_innerRadius);
}); });
_fade = new ValueAnimation<double>( _fade = new ValuePerformance<double>(
variable: new AnimatedValue(1.0, end: 0.0, curve: easeIn), variable: new AnimatedValue(1.0, end: 0.0, curve: easeIn),
duration: _kHideDuration duration: _kHideDuration
); );
...@@ -48,14 +48,14 @@ class RadialReaction { ...@@ -48,14 +48,14 @@ class RadialReaction {
/// The radius of the circle in which the reaction occurs /// The radius of the circle in which the reaction occurs
final double radius; final double radius;
AnimationPerformance _showPerformance; Performance _showPerformance;
AnimatedValue<double> _outerOpacity; AnimatedValue<double> _outerOpacity;
AnimatedValue<Point> _innerCenter; AnimatedValue<Point> _innerCenter;
AnimatedValue<double> _innerRadius; AnimatedValue<double> _innerRadius;
Future _showComplete; Future _showComplete;
ValueAnimation<double> _fade; ValuePerformance<double> _fade;
/// Show the reaction /// Show the reaction
/// ///
......
...@@ -24,15 +24,15 @@ abstract class RenderToggleable extends RenderConstrainedBox { ...@@ -24,15 +24,15 @@ abstract class RenderToggleable extends RenderConstrainedBox {
: _value = value, : _value = value,
_onChanged = onChanged, _onChanged = onChanged,
super(additionalConstraints: new BoxConstraints.tight(size)) { super(additionalConstraints: new BoxConstraints.tight(size)) {
_performance = new ValueAnimation<double>( _performance = new ValuePerformance<double>(
variable: new AnimatedValue<double>(0.0, end: 1.0, curve: easeIn, reverseCurve: easeOut), variable: new AnimatedValue<double>(0.0, end: 1.0, curve: easeIn, reverseCurve: easeOut),
duration: _kToggleDuration, duration: _kToggleDuration,
progress: _value ? 1.0 : 0.0 progress: _value ? 1.0 : 0.0
)..addListener(markNeedsPaint); )..addListener(markNeedsPaint);
} }
ValueAnimation<double> get performance => _performance; ValuePerformance<double> get performance => _performance;
ValueAnimation<double> _performance; ValuePerformance<double> _performance;
double get position => _performance.value; double get position => _performance.value;
...@@ -68,7 +68,7 @@ abstract class RenderToggleable extends RenderConstrainedBox { ...@@ -68,7 +68,7 @@ abstract class RenderToggleable extends RenderConstrainedBox {
if (value == _value) if (value == _value)
return; return;
_value = value; _value = value;
performance.play(value ? Direction.forward : Direction.reverse); performance.play(value ? AnimationDirection.forward : AnimationDirection.reverse);
} }
ValueChanged get onChanged => _onChanged; ValueChanged get onChanged => _onChanged;
......
...@@ -9,13 +9,13 @@ abstract class AnimatedComponent extends StatefulComponent { ...@@ -9,13 +9,13 @@ abstract class AnimatedComponent extends StatefulComponent {
const AnimatedComponent({ Key key, this.direction, this.duration }) : super(key: key); const AnimatedComponent({ Key key, this.direction, this.duration }) : super(key: key);
final Duration duration; final Duration duration;
final Direction direction; final AnimationDirection direction;
} }
abstract class AnimatedState<T extends AnimatedComponent> extends State<T> { abstract class AnimatedState<T extends AnimatedComponent> extends State<T> {
void initState() { void initState() {
super.initState(); super.initState();
_performance = new AnimationPerformance(duration: config.duration); _performance = new Performance(duration: config.duration);
performance.addStatusListener(_handleAnimationStatusChanged); performance.addStatusListener(_handleAnimationStatusChanged);
if (buildDependsOnPerformance) { if (buildDependsOnPerformance) {
performance.addListener(() { performance.addListener(() {
...@@ -34,13 +34,13 @@ abstract class AnimatedState<T extends AnimatedComponent> extends State<T> { ...@@ -34,13 +34,13 @@ abstract class AnimatedState<T extends AnimatedComponent> extends State<T> {
performance.play(config.direction); performance.play(config.direction);
} }
AnimationPerformance get performance => _performance; Performance get performance => _performance;
AnimationPerformance _performance; Performance _performance;
void _handleAnimationStatusChanged(AnimationStatus status) { void _handleAnimationStatusChanged(PerformanceStatus status) {
if (status == AnimationStatus.completed) if (status == PerformanceStatus.completed)
handleCompleted(); handleCompleted();
else if (status == AnimationStatus.dismissed) else if (status == PerformanceStatus.dismissed)
handleDismissed(); handleDismissed();
} }
......
...@@ -90,11 +90,11 @@ class AnimatedContainerState extends State<AnimatedContainer> { ...@@ -90,11 +90,11 @@ class AnimatedContainerState extends State<AnimatedContainer> {
AnimatedValue<double> _width; AnimatedValue<double> _width;
AnimatedValue<double> _height; AnimatedValue<double> _height;
AnimationPerformance _performance; Performance _performance;
void initState() { void initState() {
super.initState(); super.initState();
_performance = new AnimationPerformance(duration: config.duration) _performance = new Performance(duration: config.duration)
..timing = new AnimationTiming(curve: config.curve) ..timing = new AnimationTiming(curve: config.curve)
..addListener(_updateAllVariables); ..addListener(_updateAllVariables);
_configAllVariables(); _configAllVariables();
...@@ -115,7 +115,7 @@ class AnimatedContainerState extends State<AnimatedContainer> { ...@@ -115,7 +115,7 @@ class AnimatedContainerState extends State<AnimatedContainer> {
super.dispose(); super.dispose();
} }
void _updateVariable(AnimatedVariable variable) { void _updateVariable(Animatable variable) {
if (variable != null) if (variable != null)
_performance.updateVariable(variable); _performance.updateVariable(variable);
} }
......
...@@ -141,7 +141,7 @@ class DialogRoute extends Route { ...@@ -141,7 +141,7 @@ class DialogRoute extends Route {
Duration get transitionDuration => _kTransitionDuration; Duration get transitionDuration => _kTransitionDuration;
bool get opaque => false; bool get opaque => false;
Widget build(NavigatorState navigator, WatchableAnimationPerformance nextRoutePerformance) { Widget build(NavigatorState navigator, PerformanceView nextRoutePerformance) {
return new FadeTransition( return new FadeTransition(
performance: performance, performance: performance,
opacity: new AnimatedValue<double>(0.0, end: 1.0, curve: easeOut), opacity: new AnimatedValue<double>(0.0, end: 1.0, curve: easeOut),
......
...@@ -50,15 +50,15 @@ class Dismissable extends StatefulComponent { ...@@ -50,15 +50,15 @@ class Dismissable extends StatefulComponent {
class DismissableState extends State<Dismissable> { class DismissableState extends State<Dismissable> {
void initState() { void initState() {
super.initState(); super.initState();
_fadePerformance = new AnimationPerformance(duration: _kCardDismissFadeout); _fadePerformance = new Performance(duration: _kCardDismissFadeout);
_fadePerformance.addStatusListener((AnimationStatus status) { _fadePerformance.addStatusListener((PerformanceStatus status) {
if (status == AnimationStatus.completed) if (status == PerformanceStatus.completed)
_handleFadeCompleted(); _handleFadeCompleted();
}); });
} }
AnimationPerformance _fadePerformance; Performance _fadePerformance;
AnimationPerformance _resizePerformance; Performance _resizePerformance;
Size _size; Size _size;
double _dragExtent = 0.0; double _dragExtent = 0.0;
...@@ -97,7 +97,7 @@ class DismissableState extends State<Dismissable> { ...@@ -97,7 +97,7 @@ class DismissableState extends State<Dismissable> {
assert(_resizePerformance == null); assert(_resizePerformance == null);
setState(() { setState(() {
_resizePerformance = new AnimationPerformance() _resizePerformance = new Performance()
..duration = _kCardDismissResize ..duration = _kCardDismissResize
..addListener(_handleResizeProgressChanged); ..addListener(_handleResizeProgressChanged);
_resizePerformance.play(); _resizePerformance.play();
...@@ -221,7 +221,7 @@ class DismissableState extends State<Dismissable> { ...@@ -221,7 +221,7 @@ class DismissableState extends State<Dismissable> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (_resizePerformance != null) { if (_resizePerformance != null) {
// make sure you remove this widget once it's been dismissed! // make sure you remove this widget once it's been dismissed!
assert(_resizePerformance.status == AnimationStatus.forward); assert(_resizePerformance.status == PerformanceStatus.forward);
AnimatedValue<double> squashAxisExtent = new AnimatedValue<double>( AnimatedValue<double> squashAxisExtent = new AnimatedValue<double>(
_directionIsYAxis ? _size.width : _size.height, _directionIsYAxis ? _size.width : _size.height,
......
...@@ -258,7 +258,7 @@ class DragRoute extends Route { ...@@ -258,7 +258,7 @@ class DragRoute extends Route {
bool get opaque => false; bool get opaque => false;
Duration get transitionDuration => const Duration(); Duration get transitionDuration => const Duration();
Widget build(NavigatorState navigator, WatchableAnimationPerformance nextRoutePerformance) { Widget build(NavigatorState navigator, PerformanceView nextRoutePerformance) {
return new Positioned( return new Positioned(
left: _lastOffset.dx, left: _lastOffset.dx,
top: _lastOffset.dy, top: _lastOffset.dy,
......
...@@ -55,15 +55,15 @@ class Drawer extends StatefulComponent { ...@@ -55,15 +55,15 @@ class Drawer extends StatefulComponent {
class DrawerState extends State<Drawer> { class DrawerState extends State<Drawer> {
void initState() { void initState() {
super.initState(); super.initState();
_performance = new AnimationPerformance(duration: _kBaseSettleDuration) _performance = new Performance(duration: _kBaseSettleDuration)
..addStatusListener((AnimationStatus status) { ..addStatusListener((PerformanceStatus status) {
if (status == AnimationStatus.dismissed) if (status == PerformanceStatus.dismissed)
config.navigator.pop(); config.navigator.pop();
}); });
_open(); _open();
} }
AnimationPerformance _performance; Performance _performance;
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget mask = new GestureDetector( Widget mask = new GestureDetector(
...@@ -138,7 +138,7 @@ class DrawerRoute extends Route { ...@@ -138,7 +138,7 @@ class DrawerRoute extends Route {
bool get opaque => false; bool get opaque => false;
Widget build(NavigatorState navigator, WatchableAnimationPerformance nextRoutePerformance) { Widget build(NavigatorState navigator, PerformanceView nextRoutePerformance) {
return new Focus( return new Focus(
key: new GlobalObjectKey(this), key: new GlobalObjectKey(this),
autofocus: true, autofocus: true,
......
...@@ -32,7 +32,7 @@ class InkSplash { ...@@ -32,7 +32,7 @@ class InkSplash {
_radius = new AnimatedValue<double>( _radius = new AnimatedValue<double>(
_kSplashInitialSize, end: _targetRadius, curve: easeOut); _kSplashInitialSize, end: _targetRadius, curve: easeOut);
_performance = new ValueAnimation<double>( _performance = new ValuePerformance<double>(
variable: _radius, variable: _radius,
duration: new Duration(milliseconds: (_targetRadius / _kSplashUnconfirmedVelocity).floor()) duration: new Duration(milliseconds: (_targetRadius / _kSplashUnconfirmedVelocity).floor())
)..addListener(_handleRadiusChange); )..addListener(_handleRadiusChange);
...@@ -47,7 +47,7 @@ class InkSplash { ...@@ -47,7 +47,7 @@ class InkSplash {
double _targetRadius; double _targetRadius;
double _pinnedRadius; double _pinnedRadius;
AnimatedValue<double> _radius; AnimatedValue<double> _radius;
AnimationPerformance _performance; Performance _performance;
Timer _startTimer; Timer _startTimer;
bool _cancelStartTimer() { bool _cancelStartTimer() {
......
...@@ -118,7 +118,7 @@ class NavigatorState extends State<Navigator> { ...@@ -118,7 +118,7 @@ class NavigatorState extends State<Navigator> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<Widget> visibleRoutes = new List<Widget>(); List<Widget> visibleRoutes = new List<Widget>();
bool alreadyInsertModalBarrier = false; bool alreadyInsertModalBarrier = false;
WatchableAnimationPerformance nextPerformance; PerformanceView nextPerformance;
for (int i = _history.length-1; i >= 0; i -= 1) { for (int i = _history.length-1; i >= 0; i -= 1) {
Route route = _history[i]; Route route = _history[i];
if (!route.hasContent) { if (!route.hasContent) {
...@@ -126,7 +126,7 @@ class NavigatorState extends State<Navigator> { ...@@ -126,7 +126,7 @@ class NavigatorState extends State<Navigator> {
continue; continue;
} }
route.ensurePerformance( route.ensurePerformance(
direction: (i <= _currentPosition) ? Direction.forward : Direction.reverse direction: (i <= _currentPosition) ? AnimationDirection.forward : AnimationDirection.reverse
); );
route._onDismissed = () { route._onDismissed = () {
setState(() { setState(() {
...@@ -159,28 +159,28 @@ class NavigatorState extends State<Navigator> { ...@@ -159,28 +159,28 @@ class NavigatorState extends State<Navigator> {
abstract class Route { abstract class Route {
WatchableAnimationPerformance get performance => _performance?.view; PerformanceView get performance => _performance?.view;
AnimationPerformance _performance; Performance _performance;
NotificationCallback _onDismissed; NotificationCallback _onDismissed;
AnimationPerformance createPerformance() { Performance createPerformance() {
Duration duration = transitionDuration; Duration duration = transitionDuration;
if (duration > Duration.ZERO) { if (duration > Duration.ZERO) {
return new AnimationPerformance(duration: duration) return new Performance(duration: duration)
..addStatusListener((AnimationStatus status) { ..addStatusListener((PerformanceStatus status) {
if (status == AnimationStatus.dismissed && _onDismissed != null) if (status == PerformanceStatus.dismissed && _onDismissed != null)
_onDismissed(); _onDismissed();
}); });
} }
return null; return null;
} }
void ensurePerformance({ Direction direction }) { void ensurePerformance({ AnimationDirection direction }) {
assert(direction != null); assert(direction != null);
if (_performance == null) if (_performance == null)
_performance = createPerformance(); _performance = createPerformance();
if (_performance != null) { if (_performance != null) {
AnimationStatus desiredStatus = direction == Direction.forward ? AnimationStatus.forward : AnimationStatus.reverse; PerformanceStatus desiredStatus = direction == AnimationDirection.forward ? PerformanceStatus.forward : PerformanceStatus.reverse;
if (_performance.status != desiredStatus) if (_performance.status != desiredStatus)
_performance.play(direction); _performance.play(direction);
} }
...@@ -236,14 +236,14 @@ abstract class Route { ...@@ -236,14 +236,14 @@ abstract class Route {
/// cover the entire application surface or are in any way semi-transparent. /// cover the entire application surface or are in any way semi-transparent.
bool get opaque => false; bool get opaque => false;
/// If this is set to a non-zero [Duration], then an [AnimationPerformance] /// If this is set to a non-zero [Duration], then an [Performance]
/// object, available via the performance field, will be created when the /// object, available via the performance field, will be created when the
/// route is first built, using the duration described here. /// route is first built, using the duration described here.
Duration get transitionDuration => Duration.ZERO; Duration get transitionDuration => Duration.ZERO;
bool get isActuallyOpaque => (performance == null || _performance.isCompleted) && opaque; bool get isActuallyOpaque => (performance == null || _performance.isCompleted) && opaque;
Widget build(NavigatorState navigator, WatchableAnimationPerformance nextRoutePerformance); Widget build(NavigatorState navigator, PerformanceView nextRoutePerformance);
void didPop([dynamic result]) { void didPop([dynamic result]) {
if (performance == null && _onDismissed != null) if (performance == null && _onDismissed != null)
_onDismissed(); _onDismissed();
...@@ -263,7 +263,7 @@ class PageRoute extends Route { ...@@ -263,7 +263,7 @@ class PageRoute extends Route {
bool get opaque => true; bool get opaque => true;
Duration get transitionDuration => _kTransitionDuration; Duration get transitionDuration => _kTransitionDuration;
Widget build(NavigatorState navigator, WatchableAnimationPerformance nextRoutePerformance) { Widget build(NavigatorState navigator, PerformanceView nextRoutePerformance) {
// TODO(jackson): Hit testing should ignore transform // TODO(jackson): Hit testing should ignore transform
// TODO(jackson): Block input unless content is interactive // TODO(jackson): Block input unless content is interactive
return new SlideTransition( return new SlideTransition(
...@@ -296,5 +296,5 @@ class StateRoute extends Route { ...@@ -296,5 +296,5 @@ class StateRoute extends Route {
super.didPop(result); super.didPop(result);
} }
Widget build(NavigatorState navigator, WatchableAnimationPerformance nextRoutePerformance) => null; Widget build(NavigatorState navigator, PerformanceView nextRoutePerformance) => null;
} }
...@@ -44,7 +44,7 @@ class PopupMenu extends StatefulComponent { ...@@ -44,7 +44,7 @@ class PopupMenu extends StatefulComponent {
final List<PopupMenuItem> items; final List<PopupMenuItem> items;
final int level; final int level;
final NavigatorState navigator; final NavigatorState navigator;
final WatchableAnimationPerformance performance; final PerformanceView performance;
PopupMenuState createState() => new PopupMenuState(); PopupMenuState createState() => new PopupMenuState();
} }
...@@ -159,8 +159,8 @@ class MenuRoute extends Route { ...@@ -159,8 +159,8 @@ class MenuRoute extends Route {
final PopupMenuItemsBuilder builder; final PopupMenuItemsBuilder builder;
final int level; final int level;
AnimationPerformance createPerformance() { Performance createPerformance() {
AnimationPerformance result = super.createPerformance(); Performance result = super.createPerformance();
AnimationTiming timing = new AnimationTiming(); AnimationTiming timing = new AnimationTiming();
timing.reverseInterval = new Interval(0.0, _kMenuCloseIntervalEnd); timing.reverseInterval = new Interval(0.0, _kMenuCloseIntervalEnd);
result.timing = timing; result.timing = timing;
...@@ -172,7 +172,7 @@ class MenuRoute extends Route { ...@@ -172,7 +172,7 @@ class MenuRoute extends Route {
bool get opaque => false; bool get opaque => false;
Duration get transitionDuration => _kMenuDuration; Duration get transitionDuration => _kMenuDuration;
Widget build(NavigatorState navigator, WatchableAnimationPerformance nextRoutePerformance) { Widget build(NavigatorState navigator, PerformanceView nextRoutePerformance) {
return new Positioned( return new Positioned(
top: position?.top, top: position?.top,
right: position?.right, right: position?.right,
......
...@@ -36,16 +36,16 @@ abstract class ProgressIndicator extends StatefulComponent { ...@@ -36,16 +36,16 @@ abstract class ProgressIndicator extends StatefulComponent {
class ProgressIndicatorState extends State<ProgressIndicator> { class ProgressIndicatorState extends State<ProgressIndicator> {
ValueAnimation<double> _performance; ValuePerformance<double> _performance;
void initState() { void initState() {
super.initState(); super.initState();
_performance = new ValueAnimation<double>( _performance = new ValuePerformance<double>(
variable: new AnimatedValue<double>(0.0, end: 1.0, curve: ease), variable: new AnimatedValue<double>(0.0, end: 1.0, curve: ease),
duration: const Duration(milliseconds: 1500) duration: const Duration(milliseconds: 1500)
); );
_performance.addStatusListener((AnimationStatus status) { _performance.addStatusListener((PerformanceStatus status) {
if (status == AnimationStatus.completed) if (status == PerformanceStatus.completed)
_restartAnimation(); _restartAnimation();
}); });
_performance.play(); _performance.play();
......
...@@ -49,7 +49,7 @@ class SnackBar extends AnimatedComponent { ...@@ -49,7 +49,7 @@ class SnackBar extends AnimatedComponent {
this.actions, this.actions,
bool showing, bool showing,
this.onDismissed this.onDismissed
}) : super(key: key, direction: showing ? Direction.forward : Direction.reverse, duration: _kSlideInDuration) { }) : super(key: key, direction: showing ? AnimationDirection.forward : AnimationDirection.reverse, duration: _kSlideInDuration) {
assert(content != null); assert(content != null);
} }
......
...@@ -408,16 +408,16 @@ class TabBar extends Scrollable { ...@@ -408,16 +408,16 @@ class TabBar extends Scrollable {
class TabBarState extends ScrollableState<TabBar> { class TabBarState extends ScrollableState<TabBar> {
void initState() { void initState() {
super.initState(); super.initState();
_indicatorAnimation = new ValueAnimation<Rect>() _indicatorAnimation = new ValuePerformance<Rect>()
..duration = _kTabBarScroll ..duration = _kTabBarScroll
..variable = new AnimatedRect(null, curve: ease); ..variable = new AnimatedRectValue(null, curve: ease);
scrollBehavior.isScrollable = config.isScrollable; scrollBehavior.isScrollable = config.isScrollable;
} }
Size _tabBarSize; Size _tabBarSize;
Size _viewportSize = Size.zero; Size _viewportSize = Size.zero;
List<double> _tabWidths; List<double> _tabWidths;
ValueAnimation<Rect> _indicatorAnimation; ValuePerformance<Rect> _indicatorAnimation;
void didUpdateConfig(TabBar oldConfig) { void didUpdateConfig(TabBar oldConfig) {
super.didUpdateConfig(oldConfig); super.didUpdateConfig(oldConfig);
...@@ -425,7 +425,7 @@ class TabBarState extends ScrollableState<TabBar> { ...@@ -425,7 +425,7 @@ class TabBarState extends ScrollableState<TabBar> {
scrollTo(0.0); scrollTo(0.0);
} }
AnimatedRect get _indicatorRect => _indicatorAnimation.variable; AnimatedRectValue get _indicatorRect => _indicatorAnimation.variable;
void _startIndicatorAnimation(int fromTabIndex, int toTabIndex) { void _startIndicatorAnimation(int fromTabIndex, int toTabIndex) {
_indicatorRect _indicatorRect
......
...@@ -7,7 +7,7 @@ import 'package:sky/src/widgets/basic.dart'; ...@@ -7,7 +7,7 @@ import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
export 'package:sky/animation.dart' show Direction; export 'package:sky/animation.dart' show AnimationDirection;
abstract class TransitionComponent extends StatefulComponent { abstract class TransitionComponent extends StatefulComponent {
TransitionComponent({ TransitionComponent({
...@@ -17,7 +17,7 @@ abstract class TransitionComponent extends StatefulComponent { ...@@ -17,7 +17,7 @@ abstract class TransitionComponent extends StatefulComponent {
assert(performance != null); assert(performance != null);
} }
final WatchableAnimationPerformance performance; final PerformanceView performance;
Widget build(BuildContext context); Widget build(BuildContext context);
...@@ -57,7 +57,7 @@ abstract class TransitionWithChild extends TransitionComponent { ...@@ -57,7 +57,7 @@ abstract class TransitionWithChild extends TransitionComponent {
TransitionWithChild({ TransitionWithChild({
Key key, Key key,
this.child, this.child,
WatchableAnimationPerformance performance PerformanceView performance
}) : super(key: key, performance: performance); }) : super(key: key, performance: performance);
final Widget child; final Widget child;
...@@ -71,7 +71,7 @@ class SlideTransition extends TransitionWithChild { ...@@ -71,7 +71,7 @@ class SlideTransition extends TransitionWithChild {
SlideTransition({ SlideTransition({
Key key, Key key,
this.position, this.position,
WatchableAnimationPerformance performance, PerformanceView performance,
Widget child Widget child
}) : super(key: key, }) : super(key: key,
performance: performance, performance: performance,
...@@ -91,7 +91,7 @@ class FadeTransition extends TransitionWithChild { ...@@ -91,7 +91,7 @@ class FadeTransition extends TransitionWithChild {
FadeTransition({ FadeTransition({
Key key, Key key,
this.opacity, this.opacity,
WatchableAnimationPerformance performance, PerformanceView performance,
Widget child Widget child
}) : super(key: key, }) : super(key: key,
performance: performance, performance: performance,
...@@ -109,7 +109,7 @@ class ColorTransition extends TransitionWithChild { ...@@ -109,7 +109,7 @@ class ColorTransition extends TransitionWithChild {
ColorTransition({ ColorTransition({
Key key, Key key,
this.color, this.color,
WatchableAnimationPerformance performance, PerformanceView performance,
Widget child Widget child
}) : super(key: key, }) : super(key: key,
performance: performance, performance: performance,
...@@ -131,7 +131,7 @@ class SquashTransition extends TransitionWithChild { ...@@ -131,7 +131,7 @@ class SquashTransition extends TransitionWithChild {
Key key, Key key,
this.width, this.width,
this.height, this.height,
WatchableAnimationPerformance performance, PerformanceView performance,
Widget child Widget child
}) : super(key: key, }) : super(key: key,
performance: performance, performance: performance,
...@@ -156,7 +156,7 @@ class BuilderTransition extends TransitionComponent { ...@@ -156,7 +156,7 @@ class BuilderTransition extends TransitionComponent {
Key key, Key key,
this.variables, this.variables,
this.builder, this.builder,
WatchableAnimationPerformance performance PerformanceView performance
}) : super(key: key, }) : super(key: key,
performance: performance); performance: performance);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment