| OLD | NEW |
| 1 part of widgets; | 1 part of widgets; |
| 2 | 2 |
| 3 abstract class MaterialComponent extends Component { | 3 abstract class MaterialComponent extends Component { |
| 4 | 4 |
| 5 static const _splashesKey = const Object(); | 5 static const _splashesKey = const Object(); |
| 6 | 6 |
| 7 static Style _style = new Style(''' | 7 static Style _style = new Style(''' |
| 8 transform: translateX(0); | 8 transform: translateX(0); |
| 9 position: absolute; | 9 position: absolute; |
| 10 top: 0; | 10 top: 0; |
| 11 left: 0; | 11 left: 0; |
| 12 right: 0; | 12 right: 0; |
| 13 bottom: 0''' | 13 bottom: 0''' |
| 14 ); | 14 ); |
| 15 | 15 |
| 16 LinkedHashSet<SplashAnimation> _splashes; | 16 LinkedHashSet<SplashAnimation> _splashes; |
| 17 | 17 |
| 18 MaterialComponent({ Object key }) : super(key: key); | 18 MaterialComponent({ Object key }) : super(key: key); |
| 19 | 19 |
| 20 Node render() { | 20 Node render() { |
| 21 List<Node> children = []; | 21 List<Node> children = []; |
| 22 | 22 |
| 23 if (_splashes != null) { | 23 if (_splashes != null) { |
| 24 children.addAll(_splashes.map((s) => new InkSplash(s.onStyleChanged))); | 24 children.addAll(_splashes.map((s) => new InkSplash(s.onStyleChanged))); |
| 25 } | 25 } |
| 26 | 26 |
| 27 return new Container( | 27 return new Container( |
| 28 style: _style, | 28 style: _style, |
| 29 onScrollStart: _cancelSplashes, | |
| 30 onWheel: _cancelSplashes, | |
| 31 onPointerDown: _startSplash, | |
| 32 children: children, | 29 children: children, |
| 33 key: _splashesKey | 30 key: _splashesKey |
| 34 ); | 31 )..events.listen('gesturescrollstart', _cancelSplashes) |
| 32 ..events.listen('wheel', _cancelSplashes) |
| 33 ..events.listen('pointerdown', _startSplash); |
| 35 } | 34 } |
| 36 | 35 |
| 37 sky.ClientRect _getBoundingRect() => getRoot().getBoundingClientRect(); | 36 sky.ClientRect _getBoundingRect() => getRoot().getBoundingClientRect(); |
| 38 | 37 |
| 39 void _startSplash(sky.Event event) { | 38 void _startSplash(sky.Event event) { |
| 40 setState(() { | 39 setState(() { |
| 41 if (_splashes == null) { | 40 if (_splashes == null) { |
| 42 _splashes = new LinkedHashSet<SplashAnimation>(); | 41 _splashes = new LinkedHashSet<SplashAnimation>(); |
| 43 } | 42 } |
| 44 | 43 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 72 } | 71 } |
| 73 | 72 |
| 74 setState(() { | 73 setState(() { |
| 75 _splashes.remove(splash); | 74 _splashes.remove(splash); |
| 76 if (_splashes.length == 0) { | 75 if (_splashes.length == 0) { |
| 77 _splashes = null; | 76 _splashes = null; |
| 78 } | 77 } |
| 79 }); | 78 }); |
| 80 } | 79 } |
| 81 } | 80 } |
| OLD | NEW |