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

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

Issue 1216533003: Remove the pointless second argument to animate() in AnimatedValue. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « sky/sdk/lib/widgets/drawer.dart ('k') | sky/sdk/lib/widgets/toggleable.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/popup_menu.dart
diff --git a/sky/sdk/lib/widgets/popup_menu.dart b/sky/sdk/lib/widgets/popup_menu.dart
index 4687c2bc1ec5ff881500437e6f384df175dfda62..336b90280b74f956fde61e2b8a5a9fe81e5f9be2 100644
--- a/sky/sdk/lib/widgets/popup_menu.dart
+++ b/sky/sdk/lib/widgets/popup_menu.dart
@@ -60,10 +60,7 @@ class PopupMenu extends AnimatedComponent {
backgroundColor: Grey[50],
borderRadius: 2.0,
boxShadow: shadows[level]));
-
- animate(controller.position, (double value) {
- _position = value;
- });
+ watch(controller.position);
}
PopupMenuController controller;
@@ -78,16 +75,15 @@ class PopupMenu extends AnimatedComponent {
super.syncFields(source);
}
- double _position;
BoxPainter _painter;
double _opacityFor(int i) {
- if (_position == null || _position == 1.0)
+ if (controller.position.value == null || controller.position.value == 1.0)
return 1.0;
double unit = 1.0 / items.length;
double duration = 1.5 * unit;
double start = i * unit;
- return math.max(0.0, math.min(1.0, (_position - start) / duration));
+ return math.max(0.0, math.min(1.0, (controller.position.value - start) / duration));
}
Widget build() {
@@ -98,12 +94,12 @@ class PopupMenu extends AnimatedComponent {
}));
return new Opacity(
- opacity: math.min(1.0, _position * 3.0),
+ opacity: math.min(1.0, controller.position.value * 3.0),
child: new ShrinkWrapWidth(
child: new CustomPaint(
callback: (sky.Canvas canvas, Size size) {
- double width = math.min(size.width, size.width * (0.5 + _position * 2.0));
- double height = math.min(size.height, size.height * _position * 1.5);
+ double width = math.min(size.width, size.width * (0.5 + controller.position.value * 2.0));
+ double height = math.min(size.height, size.height * controller.position.value * 1.5);
_painter.paint(canvas, new Rect.fromLTRB(size.width - width, 0.0, width, height));
},
child: new Container(
« no previous file with comments | « sky/sdk/lib/widgets/drawer.dart ('k') | sky/sdk/lib/widgets/toggleable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698