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

Unified Diff: sky/examples/fn/widgets/drawer.dart

Issue 976193002: Fix the drawer curve to match Android (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/fn/widgets/drawer.dart
diff --git a/sky/examples/fn/widgets/drawer.dart b/sky/examples/fn/widgets/drawer.dart
index 229022011e18d2b967dbd16601853739d51380b6..c44906964c22625d7e6ece85b1f936d3638dc8c3 100644
--- a/sky/examples/fn/widgets/drawer.dart
+++ b/sky/examples/fn/widgets/drawer.dart
@@ -2,8 +2,8 @@ part of widgets;
const double _kWidth = 256.0;
const double _kMinFlingVelocity = 0.4;
-const double _kMinAnimationDurationMS = 246.0;
-const double _kMaxAnimationDurationMS = 600.0;
+const double _kBaseSettleDurationMS = 246.0;
+const double _kMaxSettleDurationMS = 600.0;
const Cubic _kAnimationCurve = easeOut;
class DrawerAnimation {
@@ -73,10 +73,8 @@ class DrawerAnimation {
void _animateToPosition(double targetPosition) {
double distance = (targetPosition - _position).abs();
- double duration = math.max(
- _kMinAnimationDurationMS,
- _kMaxAnimationDurationMS * distance / _kWidth);
-
+ double targetDuration = distance / _kWidth * _kBaseSettleDurationMS;
+ double duration = math.min(targetDuration, _kMaxSettleDurationMS);
_animate(duration, _position, targetPosition, _kAnimationCurve);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698