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

Side by Side Diff: sky/sdk/lib/widgets/ink_well.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/icon_button.dart ('k') | sky/sdk/lib/widgets/material.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:math' as math; 5 import 'dart:math' as math;
6 import 'dart:sky' as sky; 6 import 'dart:sky' as sky;
7 7
8 import '../animation/animated_value.dart'; 8 import '../animation/animated_value.dart';
9 import '../animation/curves.dart'; 9 import '../animation/curves.dart';
10 import '../rendering/box.dart'; 10 import '../rendering/box.dart';
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 54
55 void paint(PaintingCanvas canvas) { 55 void paint(PaintingCanvas canvas) {
56 int opacity = (_kSplashInitialOpacity * (1.0 - (_radius.value / _targetRadiu s))).floor(); 56 int opacity = (_kSplashInitialOpacity * (1.0 - (_radius.value / _targetRadiu s))).floor();
57 sky.Paint paint = new sky.Paint()..color = new sky.Color(opacity << 24); 57 sky.Paint paint = new sky.Paint()..color = new sky.Color(opacity << 24);
58 canvas.drawCircle(position, _radius.value, paint); 58 canvas.drawCircle(position, _radius.value, paint);
59 } 59 }
60 } 60 }
61 61
62 class RenderInkWell extends RenderProxyBox { 62 class RenderInkWell extends RenderProxyBox {
63 @override
63 bool get createNewDisplayList => true; 64 bool get createNewDisplayList => true;
64 65
65 RenderInkWell({ RenderBox child }) : super(child); 66 RenderInkWell({ RenderBox child }) : super(child);
66 67
67 final List<InkSplash> _splashes = new List<InkSplash>(); 68 final List<InkSplash> _splashes = new List<InkSplash>();
68 69
70 @override
69 void handleEvent(sky.Event event, BoxHitTestEntry entry) { 71 void handleEvent(sky.Event event, BoxHitTestEntry entry) {
70 if (event is sky.GestureEvent) { 72 if (event is sky.GestureEvent) {
71 switch (event.type) { 73 switch (event.type) {
72 case 'gesturetapdown': 74 case 'gesturetapdown':
73 _startSplash(event.primaryPointer, entry.localPosition); 75 _startSplash(event.primaryPointer, entry.localPosition);
74 break; 76 break;
75 case 'gesturetap': 77 case 'gesturetap':
76 _confirmSplash(event.primaryPointer); 78 _confirmSplash(event.primaryPointer);
77 break; 79 break;
78 } 80 }
79 } 81 }
80 } 82 }
81 83
82 void _startSplash(int pointer, Point position) { 84 void _startSplash(int pointer, Point position) {
83 _splashes.add(new InkSplash(pointer, position, this)); 85 _splashes.add(new InkSplash(pointer, position, this));
84 markNeedsPaint(); 86 markNeedsPaint();
85 } 87 }
86 88
87 void _confirmSplash(int pointer) { 89 void _confirmSplash(int pointer) {
88 _splashes.where((splash) => splash.pointer == pointer) 90 _splashes.where((splash) => splash.pointer == pointer)
89 .forEach((splash) { splash.confirm(); }); 91 .forEach((splash) { splash.confirm(); });
90 markNeedsPaint(); 92 markNeedsPaint();
91 } 93 }
92 94
95 @override
93 void paint(PaintingCanvas canvas, Offset offset) { 96 void paint(PaintingCanvas canvas, Offset offset) {
94 if (!_splashes.isEmpty) { 97 if (!_splashes.isEmpty) {
95 canvas.save(); 98 canvas.save();
96 canvas.translate(offset.dx, offset.dy); 99 canvas.translate(offset.dx, offset.dy);
97 canvas.clipRect(Point.origin & size); 100 canvas.clipRect(Point.origin & size);
98 for (InkSplash splash in _splashes) 101 for (InkSplash splash in _splashes)
99 splash.paint(canvas); 102 splash.paint(canvas);
100 canvas.restore(); 103 canvas.restore();
101 } 104 }
102 super.paint(canvas, offset); 105 super.paint(canvas, offset);
103 } 106 }
104 } 107 }
105 108
106 class InkWell extends OneChildRenderObjectWrapper { 109 class InkWell extends OneChildRenderObjectWrapper {
107 InkWell({ String key, Widget child }) 110 InkWell({ String key, Widget child })
108 : super(key: key, child: child); 111 : super(key: key, child: child);
109 112
113 @override
110 RenderInkWell get root => super.root; 114 RenderInkWell get root => super.root;
115
116 @override
111 RenderInkWell createNode() => new RenderInkWell(); 117 RenderInkWell createNode() => new RenderInkWell();
112 } 118 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/widgets/icon_button.dart ('k') | sky/sdk/lib/widgets/material.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698