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

Side by Side Diff: sky/sdk/lib/widgets/toggleable.dart

Issue 1226113007: Add @override annotation to known overriden methods (Closed) Base URL: https://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 unified diff | Download patch
« no previous file with comments | « sky/sdk/lib/widgets/theme.dart ('k') | sky/sdk/lib/widgets/tool_bar.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'dart:sky' as sky; 5 import 'dart:sky' as sky;
6 6
7 import '../animation/animated_value.dart'; 7 import '../animation/animated_value.dart';
8 import '../animation/curves.dart'; 8 import '../animation/curves.dart';
9 import 'animated_component.dart'; 9 import 'animated_component.dart';
10 import 'basic.dart'; 10 import 'basic.dart';
(...skipping 10 matching lines...) Expand all
21 this.onChanged 21 this.onChanged
22 }) : super(key: key) { 22 }) : super(key: key) {
23 toggleAnimation = new AnimatedValue(value ? 1.0 : 0.0); 23 toggleAnimation = new AnimatedValue(value ? 1.0 : 0.0);
24 watch(toggleAnimation); 24 watch(toggleAnimation);
25 } 25 }
26 26
27 bool value; 27 bool value;
28 AnimatedValue toggleAnimation; 28 AnimatedValue toggleAnimation;
29 ValueChanged onChanged; 29 ValueChanged onChanged;
30 30
31 @override
31 void syncFields(Toggleable source) { 32 void syncFields(Toggleable source) {
32 onChanged = source.onChanged; 33 onChanged = source.onChanged;
33 if (value != source.value) { 34 if (value != source.value) {
34 value = source.value; 35 value = source.value;
35 double targetValue = value ? 1.0 : 0.0; 36 double targetValue = value ? 1.0 : 0.0;
36 double difference = (toggleAnimation.value - targetValue).abs(); 37 double difference = (toggleAnimation.value - targetValue).abs();
37 if (difference > 0) { 38 if (difference > 0) {
38 toggleAnimation.stop(); 39 toggleAnimation.stop();
39 double t = difference * duration; 40 double t = difference * duration;
40 Curve curve = targetValue > toggleAnimation.value ? curveUp : curveDown; 41 Curve curve = targetValue > toggleAnimation.value ? curveUp : curveDown;
(...skipping 10 matching lines...) Expand all
51 // Override these methods to draw yourself 52 // Override these methods to draw yourself
52 void customPaintCallback(sky.Canvas canvas, Size size) { 53 void customPaintCallback(sky.Canvas canvas, Size size) {
53 assert(false); 54 assert(false);
54 } 55 }
55 Size get size => Size.zero; 56 Size get size => Size.zero;
56 EdgeDims get margin => const EdgeDims.symmetric(horizontal: 5.0); 57 EdgeDims get margin => const EdgeDims.symmetric(horizontal: 5.0);
57 double get duration => 200.0; 58 double get duration => 200.0;
58 Curve get curveUp => easeIn; 59 Curve get curveUp => easeIn;
59 Curve get curveDown => easeOut; 60 Curve get curveDown => easeOut;
60 61
62 @override
61 Widget build() { 63 Widget build() {
62 return new Listener( 64 return new Listener(
63 child: new Container( 65 child: new Container(
64 margin: margin, 66 margin: margin,
65 width: size.width, 67 width: size.width,
66 height: size.height, 68 height: size.height,
67 child: new CustomPaint( 69 child: new CustomPaint(
68 token: toggleAnimation.value, 70 token: toggleAnimation.value,
69 callback: customPaintCallback 71 callback: customPaintCallback
70 ) 72 )
71 ), 73 ),
72 onGestureTap: _handleClick 74 onGestureTap: _handleClick
73 ); 75 );
74 } 76 }
75 } 77 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/widgets/theme.dart ('k') | sky/sdk/lib/widgets/tool_bar.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698