| OLD | NEW |
| 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 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'dart:sky' as sky; | 7 import 'dart:sky' as sky; |
| 8 import 'ink_splash.dart'; | 8 import 'ink_splash.dart'; |
| 9 | 9 |
| 10 class InkWell extends Component { | 10 class InkWell extends Component { |
| 11 static final Style _containmentStyleHack = new Style(''' | 11 static final Style _containmentStyleHack = new Style(''' |
| 12 transform: translateX(0);'''); | 12 transform: translateX(0);'''); |
| 13 | 13 |
| 14 LinkedHashSet<SplashController> _splashes; | 14 LinkedHashSet<SplashController> _splashes; |
| 15 | 15 |
| 16 String inlineStyle; | 16 String inlineStyle; |
| 17 List<Node> children; | 17 List<UINode> children; |
| 18 | 18 |
| 19 InkWell({ Object key, this.inlineStyle, this.children }) | 19 InkWell({ Object key, this.inlineStyle, this.children }) |
| 20 : super(key: key) { | 20 : super(key: key) { |
| 21 onDidUnmount(() { | 21 onDidUnmount(() { |
| 22 _cancelSplashes(null); | 22 _cancelSplashes(null); |
| 23 }); | 23 }); |
| 24 } | 24 } |
| 25 | 25 |
| 26 Node build() { | 26 UINode build() { |
| 27 List<Node> childrenIncludingSplashes = []; | 27 List<UINode> childrenIncludingSplashes = []; |
| 28 | 28 |
| 29 if (_splashes != null) { | 29 if (_splashes != null) { |
| 30 childrenIncludingSplashes.addAll( | 30 childrenIncludingSplashes.addAll( |
| 31 _splashes.map((s) => new InkSplash(s.onStyleChanged))); | 31 _splashes.map((s) => new InkSplash(s.onStyleChanged))); |
| 32 } | 32 } |
| 33 | 33 |
| 34 if (children != null) | 34 if (children != null) |
| 35 childrenIncludingSplashes.addAll(children); | 35 childrenIncludingSplashes.addAll(children); |
| 36 | 36 |
| 37 return new EventTarget( | 37 return new EventListenerNode( |
| 38 new Container( | 38 new Container( |
| 39 style: _containmentStyleHack, | 39 style: _containmentStyleHack, |
| 40 inlineStyle: inlineStyle, | 40 inlineStyle: inlineStyle, |
| 41 children: childrenIncludingSplashes), | 41 children: childrenIncludingSplashes), |
| 42 onGestureTapDown: _startSplash, | 42 onGestureTapDown: _startSplash, |
| 43 onGestureTap: _confirmSplash | 43 onGestureTap: _confirmSplash |
| 44 ); | 44 ); |
| 45 } | 45 } |
| 46 | 46 |
| 47 sky.ClientRect _getBoundingRect() => (getRoot() as sky.Element).getBoundingCli
entRect(); | 47 sky.ClientRect _getBoundingRect() => (getRoot() as sky.Element).getBoundingCli
entRect(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 78 void _splashDone(SplashController splash) { | 78 void _splashDone(SplashController splash) { |
| 79 if (_splashes == null) | 79 if (_splashes == null) |
| 80 return; | 80 return; |
| 81 setState(() { | 81 setState(() { |
| 82 _splashes.remove(splash); | 82 _splashes.remove(splash); |
| 83 if (_splashes.length == 0) | 83 if (_splashes.length == 0) |
| 84 _splashes = null; | 84 _splashes = null; |
| 85 }); | 85 }); |
| 86 } | 86 } |
| 87 } | 87 } |
| OLD | NEW |