Index: sky/examples/stocks-fn/stockrow.dart |
diff --git a/sky/examples/stocks-fn/stockrow.dart b/sky/examples/stocks-fn/stockrow.dart |
index a5681f1f48fa670d05d426d9c1670e6135bb25c7..647571f108dd203de8eb813d974e8eba8e5f34bf 100644 |
--- a/sky/examples/stocks-fn/stockrow.dart |
+++ b/sky/examples/stocks-fn/stockrow.dart |
@@ -1,9 +1,8 @@ |
part of stocksapp; |
-class StockRow extends Component { |
+class StockRow extends MaterialComponent { |
Stock stock; |
- LinkedHashSet<SplashAnimation> _splashes; |
static Style _style = new Style(''' |
transform: translateX(0); |
@@ -64,61 +63,11 @@ class StockRow extends Component { |
) |
]; |
- if (_splashes != null) { |
- children.addAll(_splashes.map((s) => new InkSplash(s.onStyleChanged))); |
- } |
+ children.add(super.render()); |
return new Container( |
style: _style, |
- onScrollStart: _cancelSplashes, |
- onWheel: _cancelSplashes, |
- onPointerDown: _handlePointerDown, |
children: children |
); |
} |
- |
- sky.ClientRect _getBoundingRect() => getRoot().getBoundingClientRect(); |
- |
- void _handlePointerDown(sky.Event event) { |
- setState(() { |
- if (_splashes == null) { |
- _splashes = new LinkedHashSet<SplashAnimation>(); |
- } |
- |
- var splash; |
- splash = new SplashAnimation(_getBoundingRect(), event.x, event.y, |
- onDone: () { _splashDone(splash); }); |
- |
- _splashes.add(splash); |
- }); |
- } |
- |
- void _cancelSplashes(sky.Event event) { |
- if (_splashes == null) { |
- return; |
- } |
- |
- setState(() { |
- var splashes = _splashes; |
- _splashes = null; |
- splashes.forEach((s) { s.cancel(); }); |
- }); |
- } |
- |
- void willUnmount() { |
- _cancelSplashes(null); |
- } |
- |
- void _splashDone(SplashAnimation splash) { |
- if (_splashes == null) { |
- return; |
- } |
- |
- setState(() { |
- _splashes.remove(splash); |
- if (_splashes.length == 0) { |
- _splashes = null; |
- } |
- }); |
- } |
} |