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

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

Issue 1235233004: Make the popup menu width animation work (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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
« no previous file with comments | « sky/sdk/lib/widgets/fixed_height_scrollable.dart ('k') | sky/sdk/lib/widgets/scrollable.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 bd449705475c1afffe005554432f86518f757764..b00fa3923f946766a88cb8a632776ff933d8feed 100644
--- a/sky/sdk/lib/widgets/popup_menu.dart
+++ b/sky/sdk/lib/widgets/popup_menu.dart
@@ -47,8 +47,8 @@ class PopupMenu extends AnimatedComponent {
int level;
AnimatedType<double> _opacity;
- AnimatedType<double> _height;
AnimatedType<double> _width;
+ AnimatedType<double> _height;
List<AnimatedType<double>> _itemOpacities;
AnimationPerformance _performance;
@@ -82,13 +82,13 @@ class PopupMenu extends AnimatedComponent {
}
void _updateAnimationVariables() {
+ double unit = 1.0 / (items.length + 1);
_opacity = new AnimatedType<double>(0.0, end: 1.0);
- _width = new AnimatedType<double>(0.5, end: 1.0, interval: new Interval(0.0, 0.5));
- _height = new AnimatedType<double>(0.0, end: 1.0, interval: new Interval(0.0, 0.33));
+ _width = new AnimatedType<double>(0.0, end: 1.0, interval: new Interval(0.0, unit));
+ _height = new AnimatedType<double>(0.0, end: 1.0, interval: new Interval(0.0, 0.5));
_itemOpacities = new List<AnimatedType<double>>();
- double unit = 1.0 / items.length;
for (int i = 0; i < items.length; ++i) {
- double start = i * unit;
+ double start = (i + 1) * unit;
double end = (start + 1.5 * unit).clamp(0.0, 1.0);
_itemOpacities.add(new AnimatedType<double>(
0.0, end: 1.0, interval: new Interval(start, end)));
@@ -146,7 +146,7 @@ class PopupMenu extends AnimatedComponent {
callback: (sky.Canvas canvas, Size size) {
double width = _width.value * size.width;
double height = _height.value * size.height;
- _painter.paint(canvas, new Rect.fromLTRB(size.width - width, 0.0, width, height));
+ _painter.paint(canvas, new Rect.fromLTWH(size.width - width, 0.0, width, height));
},
child: new ConstrainedBox(
constraints: new BoxConstraints(
« no previous file with comments | « sky/sdk/lib/widgets/fixed_height_scrollable.dart ('k') | sky/sdk/lib/widgets/scrollable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698