Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1919)

Unified Diff: sky/sdk/lib/widgets/animation_builder.dart

Issue 1233703003: add initState, rename animated_container (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: remove print statement Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/sdk/lib/widgets/animation_builder.dart
diff --git a/sky/sdk/lib/widgets/animated_container.dart b/sky/sdk/lib/widgets/animation_builder.dart
similarity index 86%
copy from sky/sdk/lib/widgets/animated_container.dart
copy to sky/sdk/lib/widgets/animation_builder.dart
index 89a5a0cb1941cf62df6a67c969c720a323990f50..bbb61d6fd648d3c418107c75d1517d925d874e2a 100644
--- a/sky/sdk/lib/widgets/animated_container.dart
+++ b/sky/sdk/lib/widgets/animation_builder.dart
@@ -14,20 +14,20 @@ import 'basic.dart';
// This class builds a Container object from a collection of optionally-
// animated properties. Use syncFields to update the Container's properties,
// which will optionally animate them using an AnimationPerformance.
-class AnimatedContainer {
+class AnimationBuilder {
AnimatedType<double> opacity;
AnimatedType<Point> position;
AnimatedType<double> shadow;
AnimatedColor backgroundColor;
- // These don't animate, but are used to build the Container anyway.
+ // These don't animate, but are used to build the AnimationBuilder anyway.
double borderRadius;
Shape shape;
Map<AnimatedVariable, AnimationPerformance> _variableToPerformance =
new Map<AnimatedVariable, AnimationPerformance>();
- AnimatedContainer();
+ AnimationBuilder();
AnimationPerformance createPerformance(List<AnimatedType> variables,
{Duration duration}) {
@@ -65,16 +65,17 @@ class AnimatedContainer {
return current;
}
- void syncFields(AnimatedContainer source) {
- _syncField(position, source.position);
- _syncField(shadow, source.shadow);
- _syncField(backgroundColor, source.backgroundColor);
-
- borderRadius = source.borderRadius;
- shape = source.shape;
+ void updateFields({ AnimatedType<double> shadow,
+ AnimatedColor backgroundColor,
+ double borderRadius,
+ Shape shape }) {
+ _updateField(this.shadow, shadow);
+ _updateField(this.backgroundColor, backgroundColor);
+ this.borderRadius = borderRadius;
+ this.shape = shape;
}
- void _syncField(AnimatedType variable, AnimatedType sourceVariable) {
+ void _updateField(AnimatedType variable, AnimatedType sourceVariable) {
if (variable == null)
return; // TODO(mpcomplete): Should we handle transition from null?

Powered by Google App Engine
This is Rietveld 408576698