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

Side by Side Diff: sky/framework/components/material.dart

Issue 1019633004: Change how events are handled in Effen (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: cr changes Created 5 years, 9 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
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 '../fn.dart'; 5 import '../fn.dart';
6 import '../theme/shadows.dart'; 6 import '../theme/shadows.dart';
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:sky' as sky; 8 import 'dart:sky' as sky;
9 import 'ink_splash.dart'; 9 import 'ink_splash.dart';
10 10
(...skipping 12 matching lines...) Expand all
23 Style style; 23 Style style;
24 String inlineStyle; 24 String inlineStyle;
25 List<Node> children; 25 List<Node> children;
26 int level; 26 int level;
27 27
28 Material({ 28 Material({
29 Object key, 29 Object key,
30 this.style, 30 this.style,
31 this.inlineStyle, 31 this.inlineStyle,
32 this.children, 32 this.children,
33 this.level: 0 }) : super(key: key) { 33 this.level: 0 }) : super(key: key);
34 events.listen('gesturescrollstart', _cancelSplashes);
35 events.listen('wheel', _cancelSplashes);
36 events.listen('pointerdown', _startSplash);
37 }
38 34
39 Node build() { 35 Node build() {
40 List<Node> childrenIncludingSplashes = []; 36 List<Node> childrenIncludingSplashes = [];
41 37
42 if (_splashes != null) { 38 if (_splashes != null) {
43 childrenIncludingSplashes.addAll( 39 childrenIncludingSplashes.addAll(
44 _splashes.map((s) => new InkSplash(s.onStyleChanged))); 40 _splashes.map((s) => new InkSplash(s.onStyleChanged)));
45 } 41 }
46 42
47 if (children != null) 43 if (children != null)
48 childrenIncludingSplashes.addAll(children); 44 childrenIncludingSplashes.addAll(children);
49 45
50 return new Container( 46 return new EventTarget(
51 style: level > 0 ? style.extend(shadowStyle[level]) : style, 47 new Container(
52 inlineStyle: inlineStyle, 48 style: level > 0 ? style.extend(shadowStyle[level]) : style,
53 children: childrenIncludingSplashes); 49 inlineStyle: inlineStyle,
50 children: childrenIncludingSplashes),
51 onGestureScrollStart: _cancelSplashes,
52 onWheel: _cancelSplashes,
53 onPointerDown: _startSplash
54 );
54 } 55 }
55 56
56 sky.ClientRect _getBoundingRect() => (getRoot() as sky.Element).getBoundingCli entRect(); 57 sky.ClientRect _getBoundingRect() => (getRoot() as sky.Element).getBoundingCli entRect();
57 58
58 void _startSplash(sky.PointerEvent event) { 59 void _startSplash(sky.PointerEvent event) {
59 setState(() { 60 setState(() {
60 if (_splashes == null) { 61 if (_splashes == null) {
61 _splashes = new LinkedHashSet<SplashAnimation>(); 62 _splashes = new LinkedHashSet<SplashAnimation>();
62 } 63 }
63 64
(...skipping 27 matching lines...) Expand all
91 } 92 }
92 93
93 setState(() { 94 setState(() {
94 _splashes.remove(splash); 95 _splashes.remove(splash);
95 if (_splashes.length == 0) { 96 if (_splashes.length == 0) {
96 _splashes = null; 97 _splashes = null;
97 } 98 }
98 }); 99 });
99 } 100 }
100 } 101 }
OLDNEW
« no previous file with comments | « sky/framework/components/fixed_height_scrollable.dart ('k') | sky/framework/components/menu_item.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698