提交 358a22c9 编写于 作者: A Adam Barth

Rename BlockContainer, StackContainer, and FlexContainer

These are now called Block, Stack, and Flex, respectively. Less verbose.

R=jackson@google.com, ianh@google.com

Review URL: https://codereview.chromium.org/1181533002.
上级 df5e4833
......@@ -20,23 +20,22 @@ class Rectangle extends RenderObjectWrapper {
class ContainerApp extends App {
UINode build() {
return new EventListenerNode(
new BlockContainer(children: [
new Block([
new Container(
padding: new EdgeDims.all(10.0),
margin: new EdgeDims.all(10.0),
height: 100.0,
decoration: new BoxDecoration(backgroundColor: const sky.Color(0xFF00FF00)),
child: new BlockContainer(
children: [
new Container(
decoration: new BoxDecoration(backgroundColor: const sky.Color(0xFFFFFF00)),
height: 20.0,
),
new Image(src: "https://www.dartlang.org/logos/dart-logo.png",
size: new sky.Size(300.0, 300.0),
key: 1
),
])),
child: new Block([
new Container(
decoration: new BoxDecoration(backgroundColor: const sky.Color(0xFFFFFF00)),
height: 20.0,
),
new Image(src: "https://www.dartlang.org/logos/dart-logo.png",
size: new sky.Size(300.0, 300.0),
key: 1
),
])),
]),
onPointerDown: _handlePointerDown,
onGestureTap: _handleGestureTap);
......
......@@ -212,7 +212,7 @@ class StocksApp extends App {
),
];
addMenuToOverlays(overlays);
return new StackContainer(children: overlays);
return new Stack(overlays);
}
}
......
......@@ -44,7 +44,7 @@ class StockRow extends Component {
decoration: const BoxDecoration(
border: const Border(
bottom: const BorderSide(color: const sky.Color(0xFFF4F4F4)))),
child: new FlexContainer(children: children)
child: new Flex(children)
)
]);
}
......
......@@ -150,13 +150,11 @@ class Drawer extends AnimatedComponent {
boxShadow: Shadow[level]),
width: _kWidth,
transform: transform,
child: new BlockContainer(children: children)
child: new Block(children)
);
return new EventListenerNode(
new StackContainer(
children: [ mask, content ]
),
new Stack([ mask, content ]),
onPointerDown: controller.handlePointerDown,
onPointerMove: controller.handlePointerMove,
onPointerUp: controller.handlePointerUp,
......
......@@ -14,7 +14,6 @@ class DrawerHeader extends Component {
UINode build() {
return new Container(
key: 'drawer-header-outside',
height: kStatusBarHeight + kMaterialDrawerHeight,
decoration: new BoxDecoration(
backgroundColor: BlueGrey[50],
......@@ -27,20 +26,14 @@ class DrawerHeader extends Component {
),
padding: const EdgeDims.only(bottom: 7.0),
margin: const EdgeDims.only(bottom: 8.0),
child: new FlexContainer(
key: 'drawer-header-inside',
direction: FlexDirection.vertical,
children: [
new FlexExpandingChild(new Container(key: 'drawer-header-spacer')),
new Container(
key: 'drawer-header-label',
padding: const EdgeDims.symmetric(horizontal: 16.0),
child: new FlexContainer(
direction: FlexDirection.horizontal,
children: children
)
)
]
child: new Flex([
new FlexExpandingChild(new Container(key: 'drawer-header-spacer')),
new Container(
key: 'drawer-header-label',
padding: const EdgeDims.symmetric(horizontal: 16.0),
child: new Flex(children, direction: FlexDirection.horizontal)
)],
direction: FlexDirection.vertical
)
);
}
......
......@@ -75,8 +75,7 @@ abstract class FixedHeightScrollable extends Scrollable {
),
child: new Transform(
transform: transform,
child: new BlockContainer(
children: buildItems(itemShowIndex, itemShowCount))
child: new Block(buildItems(itemShowIndex, itemShowCount))
)
)
)
......
......@@ -116,10 +116,10 @@ class InkWell extends Component {
UINode build() {
return new InkWellWrapper(
child: new FlexContainer(
child: new Flex(
children,
direction: FlexDirection.horizontal,
justifyContent: FlexJustifyContent.center,
children: children
justifyContent: FlexJustifyContent.center
)
);
}
......
......@@ -89,12 +89,9 @@ class Input extends Component {
children.add(new EditableText(value: _editableValue, focused: focused));
return new EventListenerNode(
new FlexContainer(
direction: FlexDirection.vertical,
// style: _style,
// inlineStyle: focused ? _focusedInlineStyle : null,
children: children
),
// style: _style,
// inlineStyle: focused ? _focusedInlineStyle : null,
new Flex(children, direction: FlexDirection.vertical),
onPointerDown: (sky.Event e) => keyboard.showByRequest()
);
}
......
......@@ -46,10 +46,7 @@ class MenuItem extends ButtonBase {
),
new FlexExpandingChild(
new Padding(
child: new FlexContainer(
direction: FlexDirection.horizontal,
children: children
),
child: new Flex(children, direction: FlexDirection.horizontal),
padding: const EdgeDims.symmetric(horizontal: 16.0)
),
flex: 1
......
......@@ -20,7 +20,7 @@ class ModalOverlay extends Component {
UINode build() {
return new EventListenerNode(
new StackContainer(children: children),
new Stack(children),
onGestureTap: onDismiss);
}
......
......@@ -121,7 +121,7 @@ class PopupMenu extends AnimatedComponent {
backgroundColor: Grey[50],
borderRadius: 2.0,
boxShadow: Shadow[level]),
child: new BlockContainer(children: children)
child: new Block(children)
)
);
}
......
......@@ -16,7 +16,7 @@ class PopupMenuItem extends Component {
constraints: const BoxConstraints(minWidth: 112.0),
padding: const EdgeDims.all(16.0),
// TODO(abarth): opacity: opacity,
child: new FlexContainer(children: children)
child: new Flex(children)
);
}
}
......@@ -35,13 +35,12 @@ class ToolBar extends Component {
if (right != null)
children.addAll(right);
// TODO(hansmuller): use align-items:flex-end when FlexContainer supports it.
UINode bottomJustifiedChild = new FlexContainer(
// TODO(hansmuller): use align-items:flex-end when Flex supports it.
UINode bottomJustifiedChild = new Flex([
new Container(child: new Flex(children), height: kToolBarHeight)
],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.flexEnd,
children: [new Container(
child: new FlexContainer(children: children),
height: kToolBarHeight)]);
justifyContent: FlexJustifyContent.flexEnd);
return new Container(
child: bottomJustifiedChild,
......
......@@ -717,9 +717,9 @@ abstract class MultiChildRenderObjectWrapper extends RenderObjectWrapper {
}
class BlockContainer extends MultiChildRenderObjectWrapper {
class Block extends MultiChildRenderObjectWrapper {
BlockContainer({ Object key, List<UINode> children })
Block(List<UINode> children, { Object key })
: super(key: key, children: children);
RenderBlock get root { RenderBlock result = super.root; return result; }
......@@ -727,9 +727,9 @@ class BlockContainer extends MultiChildRenderObjectWrapper {
}
class StackContainer extends MultiChildRenderObjectWrapper {
class Stack extends MultiChildRenderObjectWrapper {
StackContainer({ Object key, List<UINode> children })
Stack(List<UINode> children, { Object key })
: super(key: key, children: children);
RenderStack get root { RenderStack result = super.root; return result; }
......@@ -767,11 +767,10 @@ class Paragraph extends RenderObjectWrapper {
}
class FlexContainer extends MultiChildRenderObjectWrapper {
class Flex extends MultiChildRenderObjectWrapper {
FlexContainer({
Flex(List<UINode> children, {
Object key,
List<UINode> children,
this.direction: FlexDirection.horizontal,
this.justifyContent: FlexJustifyContent.flexStart
}) : super(key: key, children: children);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册