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

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

Issue 1226143010: Port Toggleable to the new animation system (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: typo 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 | « no previous file | sky/sdk/lib/widgets/switch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/checkbox.dart
diff --git a/sky/sdk/lib/widgets/checkbox.dart b/sky/sdk/lib/widgets/checkbox.dart
index f52cafa23bcc82743a5a8e0b86b9552c3c0ba559..84cfd8c694455980dee86b1aa1e2047e8d7ee692 100644
--- a/sky/sdk/lib/widgets/checkbox.dart
+++ b/sky/sdk/lib/widgets/checkbox.dart
@@ -48,7 +48,7 @@ class Checkbox extends Toggleable {
..color = uncheckedColor;
// The rrect contracts slightly during the animation
- double inset = 2.0 - (toggleAnimation.value - _kMidpoint).abs() * 2.0;
+ double inset = 2.0 - (position.value - _kMidpoint).abs() * 2.0;
sky.Rect rect = new sky.Rect.fromLTRB(inset, inset, _kEdgeSize - inset, _kEdgeSize - inset);
sky.RRect rrect = new sky.RRect()..setRectXY(rect, _kEdgeRadius, _kEdgeRadius);
@@ -57,20 +57,20 @@ class Checkbox extends Toggleable {
canvas.drawRRect(rrect, paint);
// Radial gradient that changes size
- if (toggleAnimation.value > 0) {
+ if (position.value > 0) {
paint.setStyle(sky.PaintingStyle.fill);
paint.setShader(
new sky.Gradient.radial(
new Point(_kEdgeSize / 2.0, _kEdgeSize / 2.0),
- _kEdgeSize * (_kMidpoint - toggleAnimation.value) * 8.0,
+ _kEdgeSize * (_kMidpoint - position.value) * 8.0,
[const sky.Color(0x00000000), uncheckedColor]
)
);
canvas.drawRRect(rrect, paint);
}
- if (toggleAnimation.value > _kMidpoint) {
- double t = (toggleAnimation.value - _kMidpoint) / (1.0 - _kMidpoint);
+ if (position.value > _kMidpoint) {
+ double t = (position.value - _kMidpoint) / (1.0 - _kMidpoint);
// Solid filled rrect
paint.setStyle(sky.PaintingStyle.strokeAndFill);
« no previous file with comments | « no previous file | sky/sdk/lib/widgets/switch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698