Commit ce28a717 authored by Hixie's avatar Hixie

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.
parent 7c3e878d
...@@ -20,7 +20,7 @@ class Field extends Component { ...@@ -20,7 +20,7 @@ class Field extends Component {
final String placeholder; final String placeholder;
Widget build() { Widget build() {
return new Flex([ return new Row([
new Padding( new Padding(
padding: const EdgeDims.symmetric(horizontal: 16.0), padding: const EdgeDims.symmetric(horizontal: 16.0),
child: new Icon(type: icon, size: 24) child: new Icon(type: icon, size: 24)
...@@ -31,8 +31,7 @@ class Field extends Component { ...@@ -31,8 +31,7 @@ class Field extends Component {
placeholder: placeholder placeholder: placeholder
) )
) )
], ]
direction: FlexDirection.horizontal
); );
} }
} }
......
...@@ -148,14 +148,14 @@ class DemoList extends Component { ...@@ -148,14 +148,14 @@ class DemoList extends Component {
child: new InkWell( child: new InkWell(
child: new Container( child: new Container(
margin: const EdgeDims.only(top: 24.0, left: 24.0), margin: const EdgeDims.only(top: 24.0, left: 24.0),
child: new Flex([ child: new Column([
new Text(demo.name, style: demo.textTheme.title), new Text(demo.name, style: demo.textTheme.title),
new Flexible( new Flexible(
child: new Text(demo.description, style: demo.textTheme.subhead) child: new Text(demo.description, style: demo.textTheme.subhead)
) )
], ],
direction: FlexDirection.vertical, alignItems: FlexAlignItems.start
alignItems: FlexAlignItems.start) )
) )
) )
); );
......
...@@ -49,7 +49,7 @@ class DialogMenuItem extends ButtonBase { ...@@ -49,7 +49,7 @@ class DialogMenuItem extends ButtonBase {
child: new InkWell( child: new InkWell(
child: new Padding( child: new Padding(
padding: const EdgeDims.symmetric(horizontal: 16.0), padding: const EdgeDims.symmetric(horizontal: 16.0),
child: new Flex(children) child: new Row(children)
) )
) )
) )
...@@ -219,7 +219,7 @@ class FeedFragment extends StatefulComponent { ...@@ -219,7 +219,7 @@ class FeedFragment extends StatefulComponent {
if (userData.items.length == 0) if (userData.items.length == 0)
return new Material( return new Material(
type: MaterialType.canvas, type: MaterialType.canvas,
child: new Flex( child: new Row(
[new Text("No data yet.\nAdd some!", style: style)], [new Text("No data yet.\nAdd some!", style: style)],
justifyContent: FlexJustifyContent.center justifyContent: FlexJustifyContent.center
) )
......
...@@ -34,7 +34,7 @@ class MealRow extends FitnessItemRow { ...@@ -34,7 +34,7 @@ class MealRow extends FitnessItemRow {
) )
) )
]; ];
return new Flex( return new Row(
children, children,
alignItems: FlexAlignItems.baseline, alignItems: FlexAlignItems.baseline,
textBaseline: DefaultTextStyle.of(this).textBaseline textBaseline: DefaultTextStyle.of(this).textBaseline
......
...@@ -45,7 +45,7 @@ class MeasurementRow extends FitnessItemRow { ...@@ -45,7 +45,7 @@ class MeasurementRow extends FitnessItemRow {
) )
) )
]; ];
return new Flex( return new Row(
children, children,
alignItems: FlexAlignItems.baseline, alignItems: FlexAlignItems.baseline,
textBaseline: DefaultTextStyle.of(this).textBaseline textBaseline: DefaultTextStyle.of(this).textBaseline
......
...@@ -104,18 +104,17 @@ class SettingsFragment extends StatefulComponent { ...@@ -104,18 +104,17 @@ class SettingsFragment extends StatefulComponent {
child: new BlockBody([ child: new BlockBody([
new DrawerItem( new DrawerItem(
onPressed: () { _handleBackupChanged(!(userData.backupMode == BackupMode.enabled)); }, onPressed: () { _handleBackupChanged(!(userData.backupMode == BackupMode.enabled)); },
child: new Flex([ child: new Row([
new Flexible(child: new Text('Back up data to the cloud')), new Flexible(child: new Text('Back up data to the cloud')),
new Switch(value: userData.backupMode == BackupMode.enabled, onChanged: _handleBackupChanged), new Switch(value: userData.backupMode == BackupMode.enabled, onChanged: _handleBackupChanged),
]) ])
), ),
new DrawerItem( new DrawerItem(
onPressed: () => _handleGoalWeightPressed(), onPressed: () => _handleGoalWeightPressed(),
child: new Flex([ child: new Column([
new Text('Goal Weight'), new Text('Goal Weight'),
new Text(goalWeightText, style: Theme.of(this).text.caption), new Text(goalWeightText, style: Theme.of(this).text.caption),
], ],
direction: FlexDirection.vertical,
alignItems: FlexAlignItems.start alignItems: FlexAlignItems.start
) )
), ),
......
...@@ -118,7 +118,7 @@ class GameDemoApp extends App { ...@@ -118,7 +118,7 @@ class GameDemoApp extends App {
Widget _buildMainScene(navigator, route) { Widget _buildMainScene(navigator, route) {
return new Stack([ return new Stack([
new SpriteWidget(new MainScreenBackground(), SpriteBoxTransformMode.fixedWidth), new SpriteWidget(new MainScreenBackground(), SpriteBoxTransformMode.fixedWidth),
new Flex([ new Column([
new TextureButton( new TextureButton(
onPressed: () { onPressed: () {
_game = new GameDemoNode( _game = new GameDemoNode(
...@@ -143,8 +143,8 @@ class GameDemoApp extends App { ...@@ -143,8 +143,8 @@ class GameDemoApp extends App {
style: new TextStyle(fontSize:20.0) style: new TextStyle(fontSize:20.0)
) )
], ],
direction: FlexDirection.vertical, justifyContent: FlexJustifyContent.center
justifyContent: FlexJustifyContent.center) )
]); ]);
} }
} }
......
...@@ -96,7 +96,7 @@ class MineDiggerApp extends App { ...@@ -96,7 +96,7 @@ class MineDiggerApp extends App {
Widget buildBoard() { Widget buildBoard() {
bool hasCoveredCell = false; bool hasCoveredCell = false;
List<Flex> flexRows = <Flex>[]; List<Row> flexRows = <Row>[];
for (int iy = 0; iy != 9; iy++) { for (int iy = 0; iy != 9; iy++) {
List<Widget> row = <Widget>[]; List<Widget> row = <Widget>[];
for (int ix = 0; ix != 9; ix++) { for (int ix = 0; ix != 9; ix++) {
...@@ -139,9 +139,8 @@ class MineDiggerApp extends App { ...@@ -139,9 +139,8 @@ class MineDiggerApp extends App {
} }
} }
flexRows.add( flexRows.add(
new Flex( new Row(
row, row,
direction: FlexDirection.horizontal,
justifyContent: FlexJustifyContent.center, justifyContent: FlexJustifyContent.center,
key: new Key.stringify(iy) key: new Key.stringify(iy)
) )
...@@ -159,10 +158,7 @@ class MineDiggerApp extends App { ...@@ -159,10 +158,7 @@ class MineDiggerApp extends App {
padding: new EdgeDims.all(10.0), padding: new EdgeDims.all(10.0),
margin: new EdgeDims.all(10.0), margin: new EdgeDims.all(10.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFF6B6B6B)), decoration: new BoxDecoration(backgroundColor: const Color(0xFF6B6B6B)),
child: new Flex( child: new Column(flexRows)
flexRows,
direction: FlexDirection.vertical
)
); );
} }
......
...@@ -7,7 +7,8 @@ import 'dart:sky' as sky; ...@@ -7,7 +7,8 @@ import 'dart:sky' as sky;
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
void main() { void main() {
var root = new RenderBlock(children: [ var root = new RenderFlex(
children: [
new RenderPadding( new RenderPadding(
padding: new EdgeDims.all(10.0), padding: new EdgeDims.all(10.0),
child: new RenderConstrainedBox( child: new RenderConstrainedBox(
...@@ -69,6 +70,8 @@ void main() { ...@@ -69,6 +70,8 @@ void main() {
) )
) )
), ),
]); ],
direction: FlexDirection.vertical
);
new SkyBinding(root: root); new SkyBinding(root: root);
} }
...@@ -17,7 +17,9 @@ void main() { ...@@ -17,7 +17,9 @@ void main() {
Matrix4 transform = new Matrix4.identity(); Matrix4 transform = new Matrix4.identity();
RenderTransform spin = new RenderTransform( RenderTransform spin = new RenderTransform(
transform: transform, child: box); transform: transform,
child: box
);
spin.rotateZ(1.0); spin.rotateZ(1.0);
RenderFlex flex = new RenderFlex(); RenderFlex flex = new RenderFlex();
......
...@@ -136,7 +136,7 @@ class StockHome extends StatefulComponent { ...@@ -136,7 +136,7 @@ class StockHome extends StatefulComponent {
new DrawerItem( new DrawerItem(
icon: 'action/thumb_up', icon: 'action/thumb_up',
onPressed: () => _handleStockModeChange(StockMode.optimistic), onPressed: () => _handleStockModeChange(StockMode.optimistic),
child: new Flex([ child: new Row([
new Flexible(child: new Text('Optimistic')), new Flexible(child: new Text('Optimistic')),
new Radio(value: StockMode.optimistic, groupValue: stockMode, onChanged: _handleStockModeChange) new Radio(value: StockMode.optimistic, groupValue: stockMode, onChanged: _handleStockModeChange)
]) ])
...@@ -144,7 +144,7 @@ class StockHome extends StatefulComponent { ...@@ -144,7 +144,7 @@ class StockHome extends StatefulComponent {
new DrawerItem( new DrawerItem(
icon: 'action/thumb_down', icon: 'action/thumb_down',
onPressed: () => _handleStockModeChange(StockMode.pessimistic), onPressed: () => _handleStockModeChange(StockMode.pessimistic),
child: new Flex([ child: new Row([
new Flexible(child: new Text('Pessimistic')), new Flexible(child: new Text('Pessimistic')),
new Radio(value: StockMode.pessimistic, groupValue: stockMode, onChanged: _handleStockModeChange) new Radio(value: StockMode.pessimistic, groupValue: stockMode, onChanged: _handleStockModeChange)
]) ])
......
...@@ -33,7 +33,7 @@ class StockMenu extends Component { ...@@ -33,7 +33,7 @@ class StockMenu extends Component {
new PopupMenuItem(child: new Text('Remove stock')), new PopupMenuItem(child: new Text('Remove stock')),
new PopupMenuItem( new PopupMenuItem(
onPressed: () => onAutorefreshChanged(!autorefresh), onPressed: () => onAutorefreshChanged(!autorefresh),
child: new Flex([new Flexible(child: new Text('Autorefresh')), checkbox]) child: new Row([new Flexible(child: new Text('Autorefresh')), checkbox])
), ),
], ],
level: 4, level: 4,
......
...@@ -46,13 +46,13 @@ class StockRow extends Component { ...@@ -46,13 +46,13 @@ class StockRow extends Component {
bottom: new BorderSide(color: Theme.of(this).dividerColor) bottom: new BorderSide(color: Theme.of(this).dividerColor)
) )
), ),
child: new Flex([ child: new Row([
new Container( new Container(
child: new StockArrow(percentChange: stock.percentChange), child: new StockArrow(percentChange: stock.percentChange),
margin: const EdgeDims.only(right: 5.0) margin: const EdgeDims.only(right: 5.0)
), ),
new Flexible( new Flexible(
child: new Flex( child: new Row(
children, children,
alignItems: FlexAlignItems.baseline, alignItems: FlexAlignItems.baseline,
textBaseline: DefaultTextStyle.of(this).textBaseline textBaseline: DefaultTextStyle.of(this).textBaseline
......
...@@ -102,7 +102,7 @@ class StockSettings extends StatefulComponent { ...@@ -102,7 +102,7 @@ class StockSettings extends StatefulComponent {
new DrawerItem( new DrawerItem(
icon: 'action/thumb_up', icon: 'action/thumb_up',
onPressed: () => _confirmOptimismChange(), onPressed: () => _confirmOptimismChange(),
child: new Flex([ child: new Row([
new Flexible(child: new Text('Everything is awesome')), new Flexible(child: new Text('Everything is awesome')),
new Checkbox(value: optimism == StockMode.optimistic, onChanged: (_) => _confirmOptimismChange()), new Checkbox(value: optimism == StockMode.optimistic, onChanged: (_) => _confirmOptimismChange()),
]) ])
...@@ -110,7 +110,7 @@ class StockSettings extends StatefulComponent { ...@@ -110,7 +110,7 @@ class StockSettings extends StatefulComponent {
new DrawerItem( new DrawerItem(
icon: 'action/backup', icon: 'action/backup',
onPressed: () { _handleBackupChanged(!(backup == BackupMode.enabled)); }, onPressed: () { _handleBackupChanged(!(backup == BackupMode.enabled)); },
child: new Flex([ child: new Row([
new Flexible(child: new Text('Back up stock list to the cloud')), new Flexible(child: new Text('Back up stock list to the cloud')),
new Switch(value: backup == BackupMode.enabled, onChanged: _handleBackupChanged), new Switch(value: backup == BackupMode.enabled, onChanged: _handleBackupChanged),
]) ])
......
...@@ -85,7 +85,7 @@ class CardCollectionApp extends App { ...@@ -85,7 +85,7 @@ class CardCollectionApp extends App {
child: new Container( child: new Container(
height: cardModel.height, height: cardModel.height,
decoration: new BoxDecoration(backgroundColor: Theme.of(this).primaryColor), decoration: new BoxDecoration(backgroundColor: Theme.of(this).primaryColor),
child: new Flex([ child: new Row([
new Icon(type: 'navigation/arrow_back', size: 36), new Icon(type: 'navigation/arrow_back', size: 36),
new Flexible(child: backgroundText), new Flexible(child: backgroundText),
new Icon(type: 'navigation/arrow_forward', size: 36) new Icon(type: 'navigation/arrow_forward', size: 36)
......
...@@ -6,7 +6,7 @@ import 'package:sky/widgets.dart'; ...@@ -6,7 +6,7 @@ import 'package:sky/widgets.dart';
class ContainerApp extends App { class ContainerApp extends App {
Widget build() { Widget build() {
return new Flex([ return new Column([
new Container( new Container(
padding: new EdgeDims.all(10.0), padding: new EdgeDims.all(10.0),
margin: new EdgeDims.all(10.0), margin: new EdgeDims.all(10.0),
...@@ -20,7 +20,7 @@ class ContainerApp extends App { ...@@ -20,7 +20,7 @@ class ContainerApp extends App {
new Container( new Container(
decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFF00)), decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFF00)),
padding: new EdgeDims.symmetric(horizontal: 50.0, vertical: 75.0), padding: new EdgeDims.symmetric(horizontal: 50.0, vertical: 75.0),
child: new Flex([ child: new Row([
new RaisedButton( new RaisedButton(
child: new Text('PRESS ME'), child: new Text('PRESS ME'),
onPressed: () => print("Hello World") onPressed: () => print("Hello World")
...@@ -38,7 +38,6 @@ class ContainerApp extends App { ...@@ -38,7 +38,6 @@ class ContainerApp extends App {
) )
), ),
], ],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.spaceBetween justifyContent: FlexJustifyContent.spaceBetween
); );
} }
......
...@@ -105,7 +105,7 @@ class DragAndDropApp extends App { ...@@ -105,7 +105,7 @@ class DragAndDropApp extends App {
Widget build() { Widget build() {
List<Widget> layers = <Widget>[ List<Widget> layers = <Widget>[
new Flex([ new Row([
new ExampleDragTarget(), new ExampleDragTarget(),
new ExampleDragTarget(), new ExampleDragTarget(),
new ExampleDragTarget(), new ExampleDragTarget(),
......
...@@ -41,9 +41,11 @@ class HorizontalScrollingApp extends App { ...@@ -41,9 +41,11 @@ class HorizontalScrollingApp extends App {
return new Center( return new Center(
child: new Container( child: new Container(
height: 50.0, height: 50.0,
child: new Flex([ child: new Row([
new Block(circles, scrollDirection: ScrollDirection.horizontal) new Block(circles, scrollDirection: ScrollDirection.horizontal)
], justifyContent: FlexJustifyContent.end) ],
justifyContent: FlexJustifyContent.end
)
) )
); );
} }
......
...@@ -57,10 +57,10 @@ class MixedViewportApp extends App { ...@@ -57,10 +57,10 @@ class MixedViewportApp extends App {
center: new Text('Block Viewport Demo')), center: new Text('Block Viewport Demo')),
body: new Material( body: new Material(
type: MaterialType.canvas, type: MaterialType.canvas,
child: new Flex([ child: new Column([
new Container( new Container(
padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0), padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0),
child: new Flex([ child: new Row([
new RaisedButton( new RaisedButton(
enabled: enabledAdd, enabled: enabledAdd,
child: new Text('ADD'), child: new Text('ADD'),
...@@ -96,7 +96,6 @@ class MixedViewportApp extends App { ...@@ -96,7 +96,6 @@ class MixedViewportApp extends App {
) )
), ),
], ],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.spaceBetween justifyContent: FlexJustifyContent.spaceBetween
) )
) )
......
...@@ -10,7 +10,7 @@ List<Route> routes = [ ...@@ -10,7 +10,7 @@ List<Route> routes = [
builder: (navigator, route) => new Container( builder: (navigator, route) => new Container(
padding: const EdgeDims.all(30.0), padding: const EdgeDims.all(30.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)), decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)),
child: new Flex([ child: new Column([
new Text("You are at home"), new Text("You are at home"),
new RaisedButton( new RaisedButton(
child: new Text('GO SHOPPING'), child: new Text('GO SHOPPING'),
...@@ -20,7 +20,6 @@ List<Route> routes = [ ...@@ -20,7 +20,6 @@ List<Route> routes = [
child: new Text('START ADVENTURE'), child: new Text('START ADVENTURE'),
onPressed: () => navigator.pushNamed('adventure') onPressed: () => navigator.pushNamed('adventure')
)], )],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.center justifyContent: FlexJustifyContent.center
) )
) )
...@@ -30,7 +29,7 @@ List<Route> routes = [ ...@@ -30,7 +29,7 @@ List<Route> routes = [
builder: (navigator, route) => new Container( builder: (navigator, route) => new Container(
padding: const EdgeDims.all(20.0), padding: const EdgeDims.all(20.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFBF5FFF)), decoration: new BoxDecoration(backgroundColor: const Color(0xFFBF5FFF)),
child: new Flex([ child: new Column([
new Text("Village Shop"), new Text("Village Shop"),
new RaisedButton( new RaisedButton(
child: new Text('RETURN HOME'), child: new Text('RETURN HOME'),
...@@ -40,7 +39,6 @@ List<Route> routes = [ ...@@ -40,7 +39,6 @@ List<Route> routes = [
child: new Text('GO TO DUNGEON'), child: new Text('GO TO DUNGEON'),
onPressed: () => navigator.push(routes[2]) onPressed: () => navigator.push(routes[2])
)], )],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.center justifyContent: FlexJustifyContent.center
) )
) )
...@@ -50,13 +48,12 @@ List<Route> routes = [ ...@@ -50,13 +48,12 @@ List<Route> routes = [
builder: (navigator, route) => new Container( builder: (navigator, route) => new Container(
padding: const EdgeDims.all(20.0), padding: const EdgeDims.all(20.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFDC143C)), decoration: new BoxDecoration(backgroundColor: const Color(0xFFDC143C)),
child: new Flex([ child: new Column([
new Text("Monster's Lair"), new Text("Monster's Lair"),
new RaisedButton( new RaisedButton(
child: new Text('RUN!!!'), child: new Text('RUN!!!'),
onPressed: () => navigator.pop() onPressed: () => navigator.pop()
)], )],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.center justifyContent: FlexJustifyContent.center
) )
) )
...@@ -77,7 +74,7 @@ class NavigationExampleApp extends App { ...@@ -77,7 +74,7 @@ class NavigationExampleApp extends App {
} }
Widget build() { Widget build() {
return new Flex([new Navigator(_navState)]); return new Row([new Navigator(_navState)]);
} }
} }
......
...@@ -88,10 +88,7 @@ class PianoApp extends App { ...@@ -88,10 +88,7 @@ class PianoApp extends App {
); );
} }
return new Flex( return new Column(children);
children,
direction: FlexDirection.vertical
);
} }
} }
......
...@@ -64,11 +64,10 @@ class ProgressIndicatorApp extends App { ...@@ -64,11 +64,10 @@ class ProgressIndicatorApp extends App {
child: new CircularProgressIndicator(value: valueAnimation.value) child: new CircularProgressIndicator(value: valueAnimation.value)
) )
]; ];
return new Flex( return new Column(
indicators indicators
.map((c) => new Container(child: c, margin: const EdgeDims.symmetric(vertical: 20.0))) .map((c) => new Container(child: c, margin: const EdgeDims.symmetric(vertical: 20.0)))
.toList(), .toList(),
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.center justifyContent: FlexJustifyContent.center
); );
} }
......
...@@ -66,14 +66,14 @@ class SectorApp extends App { ...@@ -66,14 +66,14 @@ class SectorApp extends App {
Widget buildBody() { Widget buildBody() {
return new Material( return new Material(
type: MaterialType.canvas, type: MaterialType.canvas,
child: new Flex([ child: new Column([
new Container( new Container(
padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0), padding: new EdgeDims.symmetric(horizontal: 8.0, vertical: 25.0),
child: new Flex([ child: new Row([
new RaisedButton( new RaisedButton(
enabled: enabledAdd, enabled: enabledAdd,
child: new ShrinkWrapWidth( child: new ShrinkWrapWidth(
child: new Flex([ child: new Row([
new Container( new Container(
padding: new EdgeDims.all(4.0), padding: new EdgeDims.all(4.0),
margin: new EdgeDims.only(right: 10.0), margin: new EdgeDims.only(right: 10.0),
...@@ -87,7 +87,7 @@ class SectorApp extends App { ...@@ -87,7 +87,7 @@ class SectorApp extends App {
new RaisedButton( new RaisedButton(
enabled: enabledRemove, enabled: enabledRemove,
child: new ShrinkWrapWidth( child: new ShrinkWrapWidth(
child: new Flex([ child: new Row([
new Container( new Container(
padding: new EdgeDims.all(4.0), padding: new EdgeDims.all(4.0),
margin: new EdgeDims.only(right: 10.0), margin: new EdgeDims.only(right: 10.0),
...@@ -113,7 +113,6 @@ class SectorApp extends App { ...@@ -113,7 +113,6 @@ class SectorApp extends App {
) )
), ),
], ],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.spaceBetween justifyContent: FlexJustifyContent.spaceBetween
) )
); );
......
...@@ -31,14 +31,16 @@ class Rectangle extends Component { ...@@ -31,14 +31,16 @@ class Rectangle extends Component {
} }
Widget builder() { Widget builder() {
return new Flex([ return new Container(
height: 300.0,
child: new Column([
new Rectangle(const Color(0xFF00FFFF)), new Rectangle(const Color(0xFF00FFFF)),
new Container( new Container(
padding: new EdgeDims.all(10.0), padding: new EdgeDims.all(10.0),
margin: new EdgeDims.all(10.0), margin: new EdgeDims.all(10.0),
decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)), decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)),
child: new RaisedButton( child: new RaisedButton(
child: new Flex([ child: new Row([
new NetworkImage(src: "https://www.dartlang.org/logos/dart-logo.png"), new NetworkImage(src: "https://www.dartlang.org/logos/dart-logo.png"),
new Text('PRESS ME'), new Text('PRESS ME'),
]), ]),
...@@ -47,8 +49,8 @@ Widget builder() { ...@@ -47,8 +49,8 @@ Widget builder() {
), ),
new Rectangle(const Color(0xFFFFFF00)), new Rectangle(const Color(0xFFFFFF00)),
], ],
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.spaceBetween justifyContent: FlexJustifyContent.spaceBetween
)
); );
} }
...@@ -75,11 +77,10 @@ void main() { ...@@ -75,11 +77,10 @@ void main() {
// want a renderViewOverride. // want a renderViewOverride.
WidgetSkyBinding.initWidgetSkyBinding(); WidgetSkyBinding.initWidgetSkyBinding();
RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical);
RenderProxyBox proxy = new RenderProxyBox(); RenderProxyBox proxy = new RenderProxyBox();
new RenderBoxToWidgetAdapter(proxy, builder); // adds itself to proxy new RenderBoxToWidgetAdapter(proxy, builder); // adds itself to proxy
RenderFlex flexRoot = new RenderFlex(direction: FlexDirection.vertical);
addFlexChildSolidColor(flexRoot, const sky.Color(0xFFFF00FF), flex: 1); addFlexChildSolidColor(flexRoot, const sky.Color(0xFFFF00FF), flex: 1);
flexRoot.add(proxy); flexRoot.add(proxy);
addFlexChildSolidColor(flexRoot, const sky.Color(0xFF0000FF), flex: 1); addFlexChildSolidColor(flexRoot, const sky.Color(0xFF0000FF), flex: 1);
......
...@@ -85,8 +85,7 @@ HAL: This mission is too important for me to allow you to jeopardize it.'''; ...@@ -85,8 +85,7 @@ HAL: This mission is too important for me to allow you to jeopardize it.''';
Container body = new Container( Container body = new Container(
padding: new EdgeDims.symmetric(horizontal: 8.0), padding: new EdgeDims.symmetric(horizontal: 8.0),
child: new Flex(children, child: new Column(children,
direction: FlexDirection.vertical,
justifyContent: FlexJustifyContent.center, justifyContent: FlexJustifyContent.center,
alignItems: FlexAlignItems.start alignItems: FlexAlignItems.start
) )
......
...@@ -105,6 +105,6 @@ class EditableText extends StatefulComponent { ...@@ -105,6 +105,6 @@ class EditableText extends StatefulComponent {
child: new CustomPaint(callback: _paintCursor, token: _showCursor) child: new CustomPaint(callback: _paintCursor, token: _showCursor)
); );
return new Flex([text, cursor]); return new Row([text, cursor]);
} }
} }
...@@ -387,7 +387,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl ...@@ -387,7 +387,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
crossSize = math.max(crossSize, _getCrossSize(child)); crossSize = math.max(crossSize, _getCrossSize(child));
} }
if (alignItems == FlexAlignItems.baseline) { if (alignItems == FlexAlignItems.baseline) {
assert(textBaseline != null); assert(textBaseline != null && 'To use FlexAlignItems.baseline, you must also specify which baseline to use using the "baseline" argument.' is String);
double distance = child.getDistanceToBaseline(textBaseline, onlyReal: true); double distance = child.getDistanceToBaseline(textBaseline, onlyReal: true);
if (distance != null) if (distance != null)
maxBaselineDistance = math.max(maxBaselineDistance, distance); maxBaselineDistance = math.max(maxBaselineDistance, distance);
......
...@@ -28,7 +28,7 @@ export 'package:sky/base/hit_test.dart' show EventDisposition, combineEventDispo ...@@ -28,7 +28,7 @@ export 'package:sky/base/hit_test.dart' show EventDisposition, combineEventDispo
export 'package:sky/painting/text_style.dart'; export 'package:sky/painting/text_style.dart';
export 'package:sky/rendering/block.dart' show BlockDirection; export 'package:sky/rendering/block.dart' show BlockDirection;
export 'package:sky/rendering/box.dart' show BoxConstraints; export 'package:sky/rendering/box.dart' show BoxConstraints;
export 'package:sky/rendering/flex.dart' show FlexDirection, FlexJustifyContent, FlexAlignItems; export 'package:sky/rendering/flex.dart' show FlexJustifyContent, FlexAlignItems, FlexDirection;
export 'package:sky/rendering/object.dart' show Point, Offset, Size, Rect, Color, Paint, Path; export 'package:sky/rendering/object.dart' show Point, Offset, Size, Rect, Color, Paint, Path;
export 'package:sky/rendering/proxy_box.dart' show BackgroundImage, BoxDecoration, BoxDecorationPosition, BoxShadow, Border, BorderSide, EdgeDims, Shape; export 'package:sky/rendering/proxy_box.dart' show BackgroundImage, BoxDecoration, BoxDecorationPosition, BoxShadow, Border, BorderSide, EdgeDims, Shape;
export 'package:sky/rendering/toggleable.dart' show ValueChanged; export 'package:sky/rendering/toggleable.dart' show ValueChanged;
...@@ -494,7 +494,7 @@ class Row extends Flex { ...@@ -494,7 +494,7 @@ class Row extends Flex {
justifyContent: FlexJustifyContent.start, justifyContent: FlexJustifyContent.start,
alignItems: FlexAlignItems.center, alignItems: FlexAlignItems.center,
textBaseline textBaseline
}) : super(children, key: key, direction: FlexDirection.horizontal, justifyContent: justifyContent, alignItems: alignItems); }) : super(children, key: key, direction: FlexDirection.horizontal, justifyContent: justifyContent, alignItems: alignItems, textBaseline: textBaseline);
} }
class Column extends Flex { class Column extends Flex {
...@@ -503,7 +503,7 @@ class Column extends Flex { ...@@ -503,7 +503,7 @@ class Column extends Flex {
justifyContent: FlexJustifyContent.start, justifyContent: FlexJustifyContent.start,
alignItems: FlexAlignItems.center, alignItems: FlexAlignItems.center,
textBaseline textBaseline
}) : super(children, key: key, direction: FlexDirection.vertical, justifyContent: justifyContent, alignItems: alignItems); }) : super(children, key: key, direction: FlexDirection.vertical, justifyContent: justifyContent, alignItems: alignItems, textBaseline: textBaseline);
} }
class Flexible extends ParentDataNode { class Flexible extends ParentDataNode {
......
...@@ -16,7 +16,6 @@ import 'package:sky/rendering/view.dart'; ...@@ -16,7 +16,6 @@ import 'package:sky/rendering/view.dart';
export 'package:sky/base/hit_test.dart' show EventDisposition, combineEventDispositions; export 'package:sky/base/hit_test.dart' show EventDisposition, combineEventDispositions;
export 'package:sky/rendering/box.dart' show BoxConstraints, BoxDecoration, Border, BorderSide, EdgeDims; export 'package:sky/rendering/box.dart' show BoxConstraints, BoxDecoration, Border, BorderSide, EdgeDims;
export 'package:sky/rendering/flex.dart' show FlexDirection;
export 'package:sky/rendering/object.dart' show Point, Offset, Size, Rect, Color, Paint, Path; export 'package:sky/rendering/object.dart' show Point, Offset, Size, Rect, Color, Paint, Path;
final bool _shouldLogRenderDuration = false; // see also 'enableProfilingLoop' argument to runApp() final bool _shouldLogRenderDuration = false; // see also 'enableProfilingLoop' argument to runApp()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment