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

Side by Side Diff: sky/sdk/lib/widgets/popup_menu.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/navigator.dart ('k') | sky/sdk/lib/widgets/popup_menu_item.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:async'; 5 import 'dart:async';
6 import 'dart:math' as math; 6 import 'dart:math' as math;
7 import 'dart:sky' as sky; 7 import 'dart:sky' as sky;
8 8
9 import '../animation/animated_value.dart'; 9 import '../animation/animated_value.dart';
10 import '../painting/box_painter.dart'; 10 import '../painting/box_painter.dart';
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 backgroundColor: Grey[50], 66 backgroundColor: Grey[50],
67 borderRadius: 2.0, 67 borderRadius: 2.0,
68 boxShadow: shadows[level])); 68 boxShadow: shadows[level]));
69 watch(controller.position); 69 watch(controller.position);
70 } 70 }
71 71
72 PopupMenuController controller; 72 PopupMenuController controller;
73 List<PopupMenuItem> items; 73 List<PopupMenuItem> items;
74 int level; 74 int level;
75 75
76 @override
76 void syncFields(PopupMenu source) { 77 void syncFields(PopupMenu source) {
77 controller = source.controller; 78 controller = source.controller;
78 items = source.items; 79 items = source.items;
79 level = source.level; 80 level = source.level;
80 _painter = source._painter; 81 _painter = source._painter;
81 super.syncFields(source); 82 super.syncFields(source);
82 } 83 }
83 84
84 BoxPainter _painter; 85 BoxPainter _painter;
85 86
86 double _opacityFor(int i) { 87 double _opacityFor(int i) {
87 assert(controller.position.value != null); 88 assert(controller.position.value != null);
88 if (controller.position.value == null || controller.position.value == 1.0) 89 if (controller.position.value == null || controller.position.value == 1.0)
89 return 1.0; 90 return 1.0;
90 double unit = 1.0 / items.length; 91 double unit = 1.0 / items.length;
91 double duration = 1.5 * unit; 92 double duration = 1.5 * unit;
92 double start = i * unit; 93 double start = i * unit;
93 return math.max(0.0, math.min(1.0, (controller.position.value - start) / dur ation)); 94 return math.max(0.0, math.min(1.0, (controller.position.value - start) / dur ation));
94 } 95 }
95 96
97 @override
96 Widget build() { 98 Widget build() {
97 int i = 0; 99 int i = 0;
98 List<Widget> children = new List.from(items.map((Widget item) { 100 List<Widget> children = new List.from(items.map((Widget item) {
99 double opacity = _opacityFor(i); 101 double opacity = _opacityFor(i);
100 return new PopupMenuItem(child: item, opacity: opacity); 102 return new PopupMenuItem(child: item, opacity: opacity);
101 })); 103 }));
102 104
103 return new Opacity( 105 return new Opacity(
104 opacity: math.min(1.0, controller.position.value * 3.0), 106 opacity: math.min(1.0, controller.position.value * 3.0),
105 child: new Container( 107 child: new Container(
(...skipping 19 matching lines...) Expand all
125 child: new Block(children) 127 child: new Block(children)
126 ) 128 )
127 ) 129 )
128 ) 130 )
129 ) 131 )
130 ) 132 )
131 ); 133 );
132 } 134 }
133 135
134 } 136 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/widgets/navigator.dart ('k') | sky/sdk/lib/widgets/popup_menu_item.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698