From bfd2651acb477af6dcfe4aefcd037becc4280171 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Wed, 25 Mar 2015 10:42:19 -0700 Subject: [PATCH] Remove the |style| parameter from Material There's no reason for Material to take a |style| parameter anymore. Clients can simply use StyleNode instead. R=rafaelw@chromium.org Review URL: https://codereview.chromium.org/1030963005 --- framework/components/button.dart | 8 +++----- framework/components/drawer.dart | 14 +++++++------- framework/components/floating_action_button.dart | 12 +++--------- framework/components/material.dart | 13 ++++++------- framework/components/popup_menu.dart | 11 ++++++----- 5 files changed, 25 insertions(+), 33 deletions(-) diff --git a/framework/components/button.dart b/framework/components/button.dart index 0a80bbad1ae..bcaa0ad4867 100644 --- a/framework/components/button.dart +++ b/framework/components/button.dart @@ -25,10 +25,8 @@ class Button extends Component { Button({ Object key, this.content, this.level }) : super(key: key); Node build() { - return new Material( - style: _style, - children: [content], - level: level - ); + return new StyleNode( + new Material(children: [content], level: level), + _style); } } diff --git a/framework/components/drawer.dart b/framework/components/drawer.dart index 78b61b968a5..2c3cb3aabc0 100644 --- a/framework/components/drawer.dart +++ b/framework/components/drawer.dart @@ -134,13 +134,13 @@ class Drawer extends AnimatedComponent { onGestureFlingStart: controller.handleFlingStart ); - Material content = new Material( - key: 'Content', - style: _contentStyle, - inlineStyle: contentInlineStyle, - children: children, - level: level - ); + Node content = new StyleNode( + new Material( + key: 'Content', + inlineStyle: contentInlineStyle, + children: children, + level: level), + _contentStyle); return new EventTarget( new Container( diff --git a/framework/components/floating_action_button.dart b/framework/components/floating_action_button.dart index cb786d0742e..0fe36f3e466 100644 --- a/framework/components/floating_action_button.dart +++ b/framework/components/floating_action_button.dart @@ -3,8 +3,9 @@ // found in the LICENSE file. import '../fn.dart'; -import 'material.dart'; import '../theme/colors.dart'; +import 'ink_well.dart'; +import 'material.dart'; class FloatingActionButton extends Component { // TODO(abarth): We need a better way to become a container for absolutely @@ -41,15 +42,8 @@ class FloatingActionButton extends Component { children.add(content); return new Container( - key: "Container", style: level > 0 ? _style.extend(Material.shadowStyle[level]) : _style, - children: [ - new Material( - key: "Clip", - style: _clipStyle, - children: children - ) - ] + children: [new StyleNode(new InkWell(children: children), _clipStyle)] ); } } diff --git a/framework/components/material.dart b/framework/components/material.dart index 245394cae6c..38eeb583579 100644 --- a/framework/components/material.dart +++ b/framework/components/material.dart @@ -16,21 +16,20 @@ class Material extends Component { new Style('box-shadow: ${Shadow[5]}'), ]; - Style style; String inlineStyle; List children; int level; Material({ - Object key, - this.style, - this.inlineStyle, - this.children, - this.level: 0 }) : super(key: key); + Object key, + this.inlineStyle, + this.children, + this.level: 0 + }) : super(key: key); Node build() { return new StyleNode( new InkWell(inlineStyle: inlineStyle, children: children), - level > 0 ? style.extend(shadowStyle[level]) : style); + shadowStyle[level]); } } diff --git a/framework/components/popup_menu.dart b/framework/components/popup_menu.dart index c3bf1afb155..d5a2e89939d 100644 --- a/framework/components/popup_menu.dart +++ b/framework/components/popup_menu.dart @@ -87,10 +87,11 @@ class PopupMenu extends AnimatedComponent { return new PopupMenuItem(key: i++, children: item, opacity: opacity); })); - return new Material( - style: _style, - inlineStyle: _inlineStyle(), - children: children, - level: level); + return new StyleNode( + new Material( + inlineStyle: _inlineStyle(), + children: children, + level: level), + _style); } }