Replace Flex to Row and Column in tests and examples.

This still leaves Flex and FlexDirection available. At some point once
people have transitioned to Row/Column we should rename Flex to _Flex
and stop reexporting FlexDirection from basic.dart.
This commit is contained in:
Hixie
2015-08-25 10:18:36 -07:00
parent 7c3e878df3
commit ce28a7176e
29 changed files with 160 additions and 170 deletions

View File

@@ -85,7 +85,7 @@ class CardCollectionApp extends App {
child: new Container(
height: cardModel.height,
decoration: new BoxDecoration(backgroundColor: Theme.of(this).primaryColor),
child: new Flex([
child: new Row([
new Icon(type: 'navigation/arrow_back', size: 36),
new Flexible(child: backgroundText),
new Icon(type: 'navigation/arrow_forward', size: 36)

View File

@@ -6,7 +6,7 @@ import 'package:sky/widgets.dart';
class ContainerApp extends App {
Widget build() {
return new Flex([
return new Column([
new Container(
padding: new EdgeDims.all(10.0),
margin: new EdgeDims.all(10.0),
@@ -20,7 +20,7 @@ class ContainerApp extends App {
new Container(
decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFF00)),
padding: new EdgeDims.symmetric(horizontal: 50.0, vertical: 75.0),
child: new Flex([
child: new Row([
new RaisedButton(
child: new Text('PRESS ME'),
onPressed: () => print("Hello World")
@@ -38,7 +38,6 @@ class ContainerApp extends App {
)
),
],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.spaceBetween
);
}

View File

@@ -105,7 +105,7 @@ class DragAndDropApp extends App {
Widget build() {
List<Widget> layers = <Widget>[
new Flex([
new Row([
new ExampleDragTarget(),
new ExampleDragTarget(),
new ExampleDragTarget(),

View File

@@ -41,9 +41,11 @@ class HorizontalScrollingApp extends App {
return new Center(
child: new Container(
height: 50.0,
child: new Flex([
new Block(circles, scrollDirection: ScrollDirection.horizontal)
], justifyContent: FlexJustifyContent.end)
child: new Row([
new Block(circles, scrollDirection: ScrollDirection.horizontal)
],
justifyContent: FlexJustifyContent.end
)
)
);
}

View File

@@ -57,10 +57,10 @@ class MixedViewportApp extends App {
center: new Text('Block Viewport Demo')),
body: new Material(
type: MaterialType.canvas,
child: new Flex([
child: new Column([
new Container(
padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0),
child: new Flex([
child: new Row([
new RaisedButton(
enabled: enabledAdd,
child: new Text('ADD'),
@@ -96,7 +96,6 @@ class MixedViewportApp extends App {
)
),
],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.spaceBetween
)
)

View File

@@ -10,7 +10,7 @@ List<Route> routes = [
builder: (navigator, route) => new Container(
padding: const EdgeDims.all(30.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)),
child: new Flex([
child: new Column([
new Text("You are at home"),
new RaisedButton(
child: new Text('GO SHOPPING'),
@@ -20,7 +20,6 @@ List<Route> routes = [
child: new Text('START ADVENTURE'),
onPressed: () => navigator.pushNamed('adventure')
)],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.center
)
)
@@ -30,7 +29,7 @@ List<Route> routes = [
builder: (navigator, route) => new Container(
padding: const EdgeDims.all(20.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFBF5FFF)),
child: new Flex([
child: new Column([
new Text("Village Shop"),
new RaisedButton(
child: new Text('RETURN HOME'),
@@ -40,7 +39,6 @@ List<Route> routes = [
child: new Text('GO TO DUNGEON'),
onPressed: () => navigator.push(routes[2])
)],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.center
)
)
@@ -50,13 +48,12 @@ List<Route> routes = [
builder: (navigator, route) => new Container(
padding: const EdgeDims.all(20.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFDC143C)),
child: new Flex([
child: new Column([
new Text("Monster's Lair"),
new RaisedButton(
child: new Text('RUN!!!'),
onPressed: () => navigator.pop()
)],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.center
)
)
@@ -77,7 +74,7 @@ class NavigationExampleApp extends App {
}
Widget build() {
return new Flex([new Navigator(_navState)]);
return new Row([new Navigator(_navState)]);
}
}

View File

@@ -88,10 +88,7 @@ class PianoApp extends App {
);
}
return new Flex(
children,
direction: FlexDirection.vertical
);
return new Column(children);
}
}

View File

@@ -64,11 +64,10 @@ class ProgressIndicatorApp extends App {
child: new CircularProgressIndicator(value: valueAnimation.value)
)
];
return new Flex(
return new Column(
indicators
.map((c) => new Container(child: c, margin: const EdgeDims.symmetric(vertical: 20.0)))
.toList(),
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.center
);
}

View File

@@ -66,14 +66,14 @@ class SectorApp extends App {
Widget buildBody() {
return new Material(
type: MaterialType.canvas,
child: new Flex([
child: new Column([
new Container(
padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0),
child: new Flex([
child: new Row([
new RaisedButton(
enabled: enabledAdd,
child: new ShrinkWrapWidth(
child: new Flex([
child: new Row([
new Container(
padding: new EdgeDims.all(4.0),
margin: new EdgeDims.only(right: 10.0),
@@ -87,7 +87,7 @@ class SectorApp extends App {
new RaisedButton(
enabled: enabledRemove,
child: new ShrinkWrapWidth(
child: new Flex([
child: new Row([
new Container(
padding: new EdgeDims.all(4.0),
margin: new EdgeDims.only(right: 10.0),
@@ -113,7 +113,6 @@ class SectorApp extends App {
)
),
],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.spaceBetween
)
);

View File

@@ -31,24 +31,26 @@ class Rectangle extends Component {
}
Widget builder() {
return new Flex([
new Rectangle(const Color(0xFF00FFFF)),
new Container(
padding: new EdgeDims.all(10.0),
margin: new EdgeDims.all(10.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)),
child: new RaisedButton(
child: new Flex([
new NetworkImage(src: "https://www.dartlang.org/logos/dart-logo.png"),
new Text('PRESS ME'),
]),
onPressed: () => print("Hello World")
)
),
new Rectangle(const Color(0xFFFFFF00)),
],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.spaceBetween
return new Container(
height: 300.0,
child: new Column([
new Rectangle(const Color(0xFF00FFFF)),
new Container(
padding: new EdgeDims.all(10.0),
margin: new EdgeDims.all(10.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)),
child: new RaisedButton(
child: new Row([
new NetworkImage(src: "https://www.dartlang.org/logos/dart-logo.png"),
new Text('PRESS ME'),
]),
onPressed: () => print("Hello World")
)
),
new Rectangle(const Color(0xFFFFFF00)),
],
justifyContent: FlexJustifyContent.spaceBetween
)
);
}
@@ -75,11 +77,10 @@ void main() {
// want a renderViewOverride.
WidgetSkyBinding.initWidgetSkyBinding();
RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical);
RenderProxyBox proxy = new RenderProxyBox();
new RenderBoxToWidgetAdapter(proxy, builder); // adds itself to proxy
RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical);
addFlexChildSolidColor(flexRoot, const sky.Color(0xFFFF00FF), flex: 1);
flexRoot.add(proxy);
addFlexChildSolidColor(flexRoot, const sky.Color(0xFF0000FF), flex: 1);

View File

@@ -85,8 +85,7 @@ HAL: This mission is too important for me to allow you to jeopardize it.''';
Container body = new Container(
padding: new EdgeDims.symmetric(horizontal: 8.0),
child: new Flex(children,
direction: FlexDirection.vertical,
child: new Column(children,
justifyContent: FlexJustifyContent.center,
alignItems: FlexAlignItems.start
)