提交 65926f65 编写于 作者: H Hans Muller

Added a key: parameter to ParentDataNode, ContentDataNode

The FlexExpandingChild flex parameter is now a keyword as
well, which adds a small readability benefit.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1172503004.
上级 2368f9b9
......@@ -130,7 +130,7 @@ class StocksApp extends App {
icon: 'action/thumb_up',
onGestureTap: (event) => _handleStockModeChange(StockMode.optimistic),
children: [
new FlexExpandingChild(new Text('Optimistic'), 1),
new FlexExpandingChild(new Text('Optimistic'), flex: 1),
new Radio(key: 'optimistic-radio', value: StockMode.optimistic, groupValue: _stockMode, onChanged: _handleStockModeChange)
]),
new MenuItem(
......@@ -138,7 +138,7 @@ class StocksApp extends App {
icon: 'action/thumb_down',
onGestureTap: (event) => _handleStockModeChange(StockMode.pessimistic),
children: [
new FlexExpandingChild(new Text('Pessimistic'), 1),
new FlexExpandingChild(new Text('Pessimistic'), flex: 1),
new Radio(key: 'pessimistic-radio', value: StockMode.pessimistic, groupValue: _stockMode, onChanged: _handleStockModeChange)
]),
new MenuDivider(key: 'div2'),
......
......@@ -11,7 +11,7 @@ class MenuItem extends ButtonBase {
static const BoxDecoration highlightDecoration = const BoxDecoration(
backgroundColor: const Color.fromARGB(102, 153, 153, 153)
);
);
List<UINode> children;
String icon;
......@@ -36,7 +36,7 @@ class MenuItem extends ButtonBase {
),
padding: const EdgeDims.symmetric(horizontal: 16.0)
),
1
flex: 1
)
]
),
......
......@@ -154,7 +154,7 @@ abstract class UINode {
abstract class ContentNode extends UINode {
UINode content;
ContentNode(UINode content) : this.content = content, super(key: content._key);
ContentNode(UINode content, { Object key }) : this.content = content, super(key: key);
void _sync(UINode old, dynamic slot) {
UINode oldContent = old == null ? null : (old as ContentNode).content;
......@@ -173,7 +173,7 @@ abstract class ContentNode extends UINode {
class ParentDataNode extends ContentNode {
final ParentData parentData;
ParentDataNode(UINode content, this.parentData): super(content);
ParentDataNode(UINode content, this.parentData, { Object key }): super(content, key: key);
}
typedef void GestureEventListener(sky.GestureEvent e);
......@@ -754,8 +754,8 @@ class FlexContainer extends MultiChildRenderObjectWrapper {
}
class FlexExpandingChild extends ParentDataNode {
FlexExpandingChild(UINode content, [int flex = 1])
: super(content, new FlexBoxParentData()..flex = flex);
FlexExpandingChild(UINode content, { int flex: 1, Object key })
: super(content, new FlexBoxParentData()..flex = flex, key: key);
}
class Image extends RenderObjectWrapper {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册