Re-work MaterialComponent

Instead of MaterialComponent being a base class, components that want material
behavior simply create a MaterialComponent during their render function. This
approach gives the component more flexibility as to its structure and gives
MaterialComponent more flexibility has to how the components it generates are
related to the existing children.

Also, I've improved some of the event delegation code. There's no reason to
attach event handlers to the root component you emit during |render| because
the framework already delegates events from your root component to you.

R=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/983903003
This commit is contained in:
Adam Barth
2015-03-11 10:17:54 -07:00
parent ceddf0e5f1
commit c62170006f

View File

@@ -1,6 +1,6 @@
part of stocksapp;
class StockRow extends Material {
class StockRow extends Component {
Stock stock;
@@ -62,9 +62,7 @@ class StockRow extends Material {
)
];
children.add(super.build());
return new Container(
return new Material(
style: _style,
children: children
);