Commit 05676641 authored by Adam Barth's avatar Adam Barth

Use a named argument for Widget children

Previously we used a positional argument for widgets that had multiple
children. Now we use a named argument that defaults to an empty list.

Fixes #241
parent 26db7a2d
...@@ -17,7 +17,8 @@ class Field extends StatelessComponent { ...@@ -17,7 +17,8 @@ class Field extends StatelessComponent {
final String placeholder; final String placeholder;
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Row(<Widget>[ return new Row(
children: <Widget>[
new Padding( new Padding(
padding: const EdgeDims.symmetric(horizontal: 16.0), padding: const EdgeDims.symmetric(horizontal: 16.0),
child: new Icon(icon: icon) child: new Icon(icon: icon)
......
...@@ -35,7 +35,7 @@ class DialogMenuItem extends StatelessComponent { ...@@ -35,7 +35,7 @@ class DialogMenuItem extends StatelessComponent {
onTap: onPressed, onTap: onPressed,
child: new Padding( child: new Padding(
padding: const EdgeDims.symmetric(horizontal: 16.0), padding: const EdgeDims.symmetric(horizontal: 16.0),
child: new Row(children) child: new Row(children: children)
) )
) )
); );
...@@ -163,7 +163,7 @@ class FeedFragmentState extends State<FeedFragment> { ...@@ -163,7 +163,7 @@ class FeedFragmentState extends State<FeedFragment> {
return new Container(); return new Container();
if (config.userData.items.length == 0) { if (config.userData.items.length == 0) {
return new Row( return new Row(
<Widget>[new Text("No data yet.\nAdd some!", style: style)], children: <Widget>[new Text("No data yet.\nAdd some!", style: style)],
justifyContent: FlexJustifyContent.center justifyContent: FlexJustifyContent.center
); );
} }
......
...@@ -35,7 +35,7 @@ class MealRow extends FitnessItemRow { ...@@ -35,7 +35,7 @@ class MealRow extends FitnessItemRow {
) )
]; ];
return new Row( return new Row(
children, children: children,
alignItems: FlexAlignItems.baseline, alignItems: FlexAlignItems.baseline,
textBaseline: DefaultTextStyle.of(context).textBaseline textBaseline: DefaultTextStyle.of(context).textBaseline
); );
......
...@@ -47,7 +47,7 @@ class MeasurementRow extends FitnessItemRow { ...@@ -47,7 +47,7 @@ class MeasurementRow extends FitnessItemRow {
) )
]; ];
return new Row( return new Row(
children, children: children,
alignItems: FlexAlignItems.baseline, alignItems: FlexAlignItems.baseline,
textBaseline: DefaultTextStyle.of(context).textBaseline textBaseline: DefaultTextStyle.of(context).textBaseline
); );
...@@ -124,24 +124,30 @@ class MeasurementFragmentState extends State<MeasurementFragment> { ...@@ -124,24 +124,30 @@ class MeasurementFragmentState extends State<MeasurementFragment> {
// TODO(jackson): Revisit the layout of this pane to be more maintainable // TODO(jackson): Revisit the layout of this pane to be more maintainable
return new Container( return new Container(
padding: const EdgeDims.all(20.0), padding: const EdgeDims.all(20.0),
child: new Column(<Widget>[ child: new Column(
new GestureDetector( children: <Widget>[
onTap: _handleDatePressed, new GestureDetector(
child: new Container( onTap: _handleDatePressed,
height: 50.0, child: new Container(
child: new Column(<Widget>[ height: 50.0,
new Text('Measurement Date'), child: new Column(
new Text(measurement.displayDate, style: Theme.of(context).text.caption), children: <Widget>[
], alignItems: FlexAlignItems.start) new Text('Measurement Date'),
) new Text(measurement.displayDate, style: Theme.of(context).text.caption),
), ],
new Input( alignItems: FlexAlignItems.start
key: weightKey, )
placeholder: 'Enter weight', )
keyboardType: KeyboardType.NUMBER, ),
onChanged: _handleWeightChanged new Input(
), key: weightKey,
], alignItems: FlexAlignItems.stretch) placeholder: 'Enter weight',
keyboardType: KeyboardType.NUMBER,
onChanged: _handleWeightChanged
),
],
alignItems: FlexAlignItems.stretch
)
); );
} }
......
...@@ -89,14 +89,17 @@ class SettingsFragmentState extends State<SettingsFragment> { ...@@ -89,14 +89,17 @@ class SettingsFragmentState extends State<SettingsFragment> {
return new Block(<Widget>[ return new Block(<Widget>[
new DrawerItem( new DrawerItem(
onPressed: () { _handleBackupChanged(!(config.userData.backupMode == BackupMode.enabled)); }, onPressed: () { _handleBackupChanged(!(config.userData.backupMode == BackupMode.enabled)); },
child: new Row(<Widget>[ child: new Row(
new Flexible(child: new Text('Back up data to the cloud')), children: <Widget>[
new Switch(value: config.userData.backupMode == BackupMode.enabled, onChanged: _handleBackupChanged), new Flexible(child: new Text('Back up data to the cloud')),
]) new Switch(value: config.userData.backupMode == BackupMode.enabled, onChanged: _handleBackupChanged),
]
)
), ),
new DrawerItem( new DrawerItem(
onPressed: () => _handleGoalWeightPressed(), onPressed: () => _handleGoalWeightPressed(),
child: new Column(<Widget>[ child: new Column(
children: <Widget>[
new Text('Goal Weight'), new Text('Goal Weight'),
new Text(goalWeightText, style: Theme.of(context).text.caption), new Text(goalWeightText, style: Theme.of(context).text.caption),
], ],
......
...@@ -31,13 +31,16 @@ class _DatePickerDemoState extends State<DatePickerDemo> { ...@@ -31,13 +31,16 @@ class _DatePickerDemoState extends State<DatePickerDemo> {
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Column([ return new Column(
new Text(new DateFormat.yMMMd().format(_selectedDate)), children: <Widget>[
new RaisedButton( new Text(new DateFormat.yMMMd().format(_selectedDate)),
onPressed: _handleSelectDate, new RaisedButton(
child: new Text('SELECT DATE') onPressed: _handleSelectDate,
), child: new Text('SELECT DATE')
], justifyContent: FlexJustifyContent.center); ),
],
justifyContent: FlexJustifyContent.center
);
} }
} }
......
...@@ -65,31 +65,35 @@ class TabViewDemo extends StatelessComponent { ...@@ -65,31 +65,35 @@ class TabViewDemo extends StatelessComponent {
values: _iconNames, values: _iconNames,
child: new Builder( child: new Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
return new Column([ return new Column(
new Container( children: <Widget>[
margin: const EdgeDims.only(top: 16.0), new Container(
child: new Row(<Widget>[ margin: const EdgeDims.only(top: 16.0),
new IconButton( child: new Row(
icon: "navigation/arrow_back", children: <Widget>[
onPressed: () { _handleArrowButtonPress(context, -1); } new IconButton(
), icon: "navigation/arrow_back",
new Row( onPressed: () { _handleArrowButtonPress(context, -1); }
_iconNames.map((String name) => _buildTabIndicator(context, name)).toList(), ),
justifyContent: FlexJustifyContent.collapse new Row(
), children: _iconNames.map((String name) => _buildTabIndicator(context, name)).toList(),
new IconButton( justifyContent: FlexJustifyContent.collapse
icon: "navigation/arrow_forward", ),
onPressed: () { _handleArrowButtonPress(context, 1); } new IconButton(
)], icon: "navigation/arrow_forward",
justifyContent: FlexJustifyContent.spaceBetween onPressed: () { _handleArrowButtonPress(context, 1); }
)
],
justifyContent: FlexJustifyContent.spaceBetween
)
),
new Flexible(
child: new TabBarView(
children: _iconNames.map(_buildTabView).toList()
)
) )
), ]
new Flexible( );
child: new TabBarView(
children: _iconNames.map(_buildTabView).toList()
)
)
]);
} }
) )
); );
......
...@@ -34,28 +34,43 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> { ...@@ -34,28 +34,43 @@ class _SelectionControlsDemoState extends State<SelectionControlsDemo> {
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Column(<Widget>[ return new Column(
new Row(<Widget>[ children: <Widget>[
new Checkbox(value: _checkboxValue, onChanged: _setCheckboxValue), new Row(
new Checkbox(value: false), // Disabled children: <Widget>[
new Checkbox(value: true), // Disabled new Checkbox(value: _checkboxValue, onChanged: _setCheckboxValue),
], justifyContent: FlexJustifyContent.spaceAround), new Checkbox(value: false), // Disabled
new Row(<int>[0, 1, 2].map((int i) { new Checkbox(value: true), // Disabled
return new Radio<int>( ],
value: i, justifyContent: FlexJustifyContent.spaceAround
groupValue: _radioValue, ),
onChanged: _setRadioValue new Row(
); children: <int>[0, 1, 2].map((int i) {
}).toList(), justifyContent: FlexJustifyContent.spaceAround), return new Radio<int>(
new Row(<int>[0, 1].map((int i) { value: i,
return new Radio<int>(value: i, groupValue: 0); // Disabled groupValue: _radioValue,
}).toList(), justifyContent: FlexJustifyContent.spaceAround), onChanged: _setRadioValue
new Row(<Widget>[ );
new Switch(value: _switchValue, onChanged: _setSwitchValue), }).toList(),
new Switch(value: false), // Disabled justifyContent: FlexJustifyContent.spaceAround
new Switch(value: true), // Disabled ),
], justifyContent: FlexJustifyContent.spaceAround), new Row(
], justifyContent: FlexJustifyContent.spaceAround); children: <int>[0, 1].map((int i) {
return new Radio<int>(value: i, groupValue: 0); // Disabled
}).toList(),
justifyContent: FlexJustifyContent.spaceAround
),
new Row(
children: <Widget>[
new Switch(value: _switchValue, onChanged: _setSwitchValue),
new Switch(value: false), // Disabled
new Switch(value: true), // Disabled
],
justifyContent: FlexJustifyContent.spaceAround
),
],
justifyContent: FlexJustifyContent.spaceAround
);
} }
} }
......
...@@ -18,35 +18,41 @@ class _SliderDemoState extends State<SliderDemo> { ...@@ -18,35 +18,41 @@ class _SliderDemoState extends State<SliderDemo> {
new Container( new Container(
height: 100.0, height: 100.0,
child: new Center( child: new Center(
child: new Row([ child: new Row(
new Slider( children: <Widget>[
value: _value, new Slider(
min: 0.0, value: _value,
max: 100.0, min: 0.0,
onChanged: (double value) { max: 100.0,
setState(() { onChanged: (double value) {
_value = value; setState(() {
}); _value = value;
} });
), }
new Container( ),
padding: const EdgeDims.symmetric(horizontal: 16.0), new Container(
child: new Text(_value.round().toString().padLeft(3, '0')) padding: const EdgeDims.symmetric(horizontal: 16.0),
), child: new Text(_value.round().toString().padLeft(3, '0'))
], justifyContent: FlexJustifyContent.collapse) ),
],
justifyContent: FlexJustifyContent.collapse
)
) )
), ),
new Container( new Container(
height: 100.0, height: 100.0,
child: new Center( child: new Center(
child: new Row([ child: new Row(
// Disabled, but tracking the slider above. children: <Widget>[
new Slider(value: _value / 100.0), // Disabled, but tracking the slider above.
new Container( new Slider(value: _value / 100.0),
padding: const EdgeDims.symmetric(horizontal: 16.0), new Container(
child: new Text((_value / 100.0).toStringAsFixed(2)) padding: const EdgeDims.symmetric(horizontal: 16.0),
), child: new Text((_value / 100.0).toStringAsFixed(2))
], justifyContent: FlexJustifyContent.collapse) ),
],
justifyContent: FlexJustifyContent.collapse
)
) )
) )
......
...@@ -28,13 +28,16 @@ class _TimePickerDemoState extends State<TimePickerDemo> { ...@@ -28,13 +28,16 @@ class _TimePickerDemoState extends State<TimePickerDemo> {
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Column([ return new Column(
new Text('$_selectedTime'), children: <Widget>[
new RaisedButton( new Text('$_selectedTime'),
onPressed: _handleSelectTime, new RaisedButton(
child: new Text('SELECT TIME') onPressed: _handleSelectTime,
), child: new Text('SELECT TIME')
], justifyContent: FlexJustifyContent.center); ),
],
justifyContent: FlexJustifyContent.center
);
} }
} }
......
...@@ -33,17 +33,19 @@ class _GalleryPageState extends State<GalleryPage> { ...@@ -33,17 +33,19 @@ class _GalleryPageState extends State<GalleryPage> {
// TODO(eseidel): We should make this into a shared DrawerFooter. // TODO(eseidel): We should make this into a shared DrawerFooter.
items.add(new DrawerDivider()); items.add(new DrawerDivider());
items.add(new DrawerItem(child: new Flex([ items.add(new DrawerItem(child: new Flex(
new Text("Made with Flutter "), children: <Widget>[
new Container( new Text("Made with Flutter "),
margin: const EdgeDims.symmetric(horizontal: 5.0), new Container(
child: new AssetImage( margin: const EdgeDims.symmetric(horizontal: 5.0),
name: 'assets/flutter_logo.png', child: new AssetImage(
height: 16.0, name: 'assets/flutter_logo.png',
fit: ImageFit.contain height: 16.0,
fit: ImageFit.contain
)
) )
) ]
]))); )));
return new Drawer(child: new Block(items)); return new Drawer(child: new Block(items));
} }
......
...@@ -139,7 +139,7 @@ class MineDiggerState extends State<MineDigger> { ...@@ -139,7 +139,7 @@ class MineDiggerState extends State<MineDigger> {
} }
flexRows.add( flexRows.add(
new Row( new Row(
row, children: row,
justifyContent: FlexJustifyContent.center, justifyContent: FlexJustifyContent.center,
key: new ValueKey<int>(iy) key: new ValueKey<int>(iy)
) )
...@@ -157,7 +157,7 @@ class MineDiggerState extends State<MineDigger> { ...@@ -157,7 +157,7 @@ class MineDiggerState extends State<MineDigger> {
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 Column(flexRows) child: new Column(children: flexRows)
); );
} }
......
...@@ -114,18 +114,22 @@ class StockHomeState extends State<StockHome> { ...@@ -114,18 +114,22 @@ class StockHomeState extends State<StockHome> {
new DrawerItem( new DrawerItem(
icon: 'action/thumb_up', icon: 'action/thumb_up',
onPressed: () => _handleStockModeChange(StockMode.optimistic), onPressed: () => _handleStockModeChange(StockMode.optimistic),
child: new Row(<Widget>[ child: new Row(
new Flexible(child: new Text('Optimistic')), children: <Widget>[
new Radio<StockMode>(value: StockMode.optimistic, groupValue: config.configuration.stockMode, onChanged: _handleStockModeChange) new Flexible(child: new Text('Optimistic')),
]) new Radio<StockMode>(value: StockMode.optimistic, groupValue: config.configuration.stockMode, onChanged: _handleStockModeChange)
]
)
), ),
new DrawerItem( new DrawerItem(
icon: 'action/thumb_down', icon: 'action/thumb_down',
onPressed: () => _handleStockModeChange(StockMode.pessimistic), onPressed: () => _handleStockModeChange(StockMode.pessimistic),
child: new Row(<Widget>[ child: new Row(
new Flexible(child: new Text('Pessimistic')), children: <Widget>[
new Radio<StockMode>(value: StockMode.pessimistic, groupValue: config.configuration.stockMode, onChanged: _handleStockModeChange) new Flexible(child: new Text('Pessimistic')),
]) new Radio<StockMode>(value: StockMode.pessimistic, groupValue: config.configuration.stockMode, onChanged: _handleStockModeChange)
]
)
), ),
new DrawerDivider(), new DrawerDivider(),
new DrawerItem( new DrawerItem(
...@@ -241,12 +245,14 @@ class StockHomeState extends State<StockHome> { ...@@ -241,12 +245,14 @@ class StockHomeState extends State<StockHome> {
// TODO(ianh): Fill this out. // TODO(ianh): Fill this out.
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return new Column([ return new Column(
new Input( children: <Widget>[
key: companyNameKey, new Input(
placeholder: 'Company Name' key: companyNameKey,
), placeholder: 'Company Name'
]); ),
]
);
} }
); );
} }
......
...@@ -19,7 +19,8 @@ Future showStockMenu({BuildContext context, bool autorefresh, ValueChanged<bool> ...@@ -19,7 +19,8 @@ Future showStockMenu({BuildContext context, bool autorefresh, ValueChanged<bool>
items: <PopupMenuItem>[ items: <PopupMenuItem>[
new PopupMenuItem( new PopupMenuItem(
value: _MenuItems.autorefresh, value: _MenuItems.autorefresh,
child: new Row(<Widget>[ child: new Row(
children: <Widget>[
new Flexible(child: new Text('Autorefresh')), new Flexible(child: new Text('Autorefresh')),
new StatefulBuilder( new StatefulBuilder(
builder: (BuildContext context, StateSetter setState) { builder: (BuildContext context, StateSetter setState) {
...@@ -75,16 +76,18 @@ Future showStockMenu({BuildContext context, bool autorefresh, ValueChanged<bool> ...@@ -75,16 +76,18 @@ Future showStockMenu({BuildContext context, bool autorefresh, ValueChanged<bool>
content: new Text('This feature has not yet been implemented.'), content: new Text('This feature has not yet been implemented.'),
actions: <Widget>[ actions: <Widget>[
new FlatButton( new FlatButton(
child: new Row(<Widget>[ child: new Row(
new Icon( children: <Widget>[
icon: 'device/dvr', new Icon(
size: IconSize.s18 icon: 'device/dvr',
), size: IconSize.s18
new Container( ),
width: 8.0 new Container(
), width: 8.0
new Text('DUMP APP TO CONSOLE'), ),
]), new Text('DUMP APP TO CONSOLE'),
]
),
onPressed: () { debugDumpApp(); } onPressed: () { debugDumpApp(); }
), ),
new FlatButton( new FlatButton(
......
...@@ -67,7 +67,8 @@ class StockRow extends StatelessComponent { ...@@ -67,7 +67,8 @@ class StockRow extends StatelessComponent {
bottom: new BorderSide(color: Theme.of(context).dividerColor) bottom: new BorderSide(color: Theme.of(context).dividerColor)
) )
), ),
child: new Row(<Widget>[ child: new Row(
children: <Widget>[
new Container( new Container(
margin: const EdgeDims.only(right: 5.0), margin: const EdgeDims.only(right: 5.0),
child: new Hero( child: new Hero(
...@@ -77,7 +78,8 @@ class StockRow extends StatelessComponent { ...@@ -77,7 +78,8 @@ class StockRow extends StatelessComponent {
) )
), ),
new Flexible( new Flexible(
child: new Row(<Widget>[ child: new Row(
children: <Widget>[
new Flexible( new Flexible(
flex: 2, flex: 2,
child: new Text( child: new Text(
......
...@@ -82,35 +82,41 @@ class StockSettingsState extends State<StockSettings> { ...@@ -82,35 +82,41 @@ class StockSettingsState extends State<StockSettings> {
new DrawerItem( new DrawerItem(
icon: 'action/thumb_up', icon: 'action/thumb_up',
onPressed: () => _confirmOptimismChange(), onPressed: () => _confirmOptimismChange(),
child: new Row(<Widget>[ child: new Row(
new Flexible(child: new Text('Everything is awesome')), children: <Widget>[
new Checkbox( new Flexible(child: new Text('Everything is awesome')),
value: config.configuration.stockMode == StockMode.optimistic, new Checkbox(
onChanged: (bool value) => _confirmOptimismChange() value: config.configuration.stockMode == StockMode.optimistic,
), onChanged: (bool value) => _confirmOptimismChange()
]) ),
]
)
), ),
new DrawerItem( new DrawerItem(
icon: 'action/backup', icon: 'action/backup',
onPressed: () { _handleBackupChanged(!(config.configuration.backupMode == BackupMode.enabled)); }, onPressed: () { _handleBackupChanged(!(config.configuration.backupMode == BackupMode.enabled)); },
child: new Row(<Widget>[ child: new Row(
new Flexible(child: new Text('Back up stock list to the cloud')), children: <Widget>[
new Switch( new Flexible(child: new Text('Back up stock list to the cloud')),
value: config.configuration.backupMode == BackupMode.enabled, new Switch(
onChanged: _handleBackupChanged value: config.configuration.backupMode == BackupMode.enabled,
), onChanged: _handleBackupChanged
]) ),
]
)
), ),
new DrawerItem( new DrawerItem(
icon: 'action/picture_in_picture', icon: 'action/picture_in_picture',
onPressed: () { _handleShowPerformanceOverlayChanged(!config.configuration.showPerformanceOverlay); }, onPressed: () { _handleShowPerformanceOverlayChanged(!config.configuration.showPerformanceOverlay); },
child: new Row(<Widget>[ child: new Row(
new Flexible(child: new Text('Show rendering performance overlay')), children: <Widget>[
new Switch( new Flexible(child: new Text('Show rendering performance overlay')),
value: config.configuration.showPerformanceOverlay, new Switch(
onChanged: _handleShowPerformanceOverlayChanged value: config.configuration.showPerformanceOverlay,
), onChanged: _handleShowPerformanceOverlayChanged
]) ),
]
)
), ),
]; ];
assert(() { assert(() {
...@@ -119,24 +125,28 @@ class StockSettingsState extends State<StockSettings> { ...@@ -119,24 +125,28 @@ class StockSettingsState extends State<StockSettings> {
new DrawerItem( new DrawerItem(
icon: 'editor/border_clear', icon: 'editor/border_clear',
onPressed: () { _handleShowGridChanged(!config.configuration.debugShowGrid); }, onPressed: () { _handleShowGridChanged(!config.configuration.debugShowGrid); },
child: new Row(<Widget>[ child: new Row(
new Flexible(child: new Text('Show material grid (for debugging)')), children: <Widget>[
new Switch( new Flexible(child: new Text('Show material grid (for debugging)')),
value: config.configuration.debugShowGrid, new Switch(
onChanged: _handleShowGridChanged value: config.configuration.debugShowGrid,
), onChanged: _handleShowGridChanged
]) ),
]
)
), ),
new DrawerItem( new DrawerItem(
icon: 'editor/border_all', icon: 'editor/border_all',
onPressed: () { _handleShowSizesChanged(!config.configuration.debugShowSizes); }, onPressed: () { _handleShowSizesChanged(!config.configuration.debugShowSizes); },
child: new Row(<Widget>[ child: new Row(
new Flexible(child: new Text('Show construction lines (for debugging)')), children: <Widget>[
new Switch( new Flexible(child: new Text('Show construction lines (for debugging)')),
value: config.configuration.debugShowSizes, new Switch(
onChanged: _handleShowSizesChanged value: config.configuration.debugShowSizes,
), onChanged: _handleShowSizesChanged
]) ),
]
)
) )
]); ]);
return true; return true;
......
...@@ -18,8 +18,10 @@ class StockSymbolView extends StatelessComponent { ...@@ -18,8 +18,10 @@ class StockSymbolView extends StatelessComponent {
TextStyle headings = Theme.of(context).text.body2; TextStyle headings = Theme.of(context).text.body2;
return new Container( return new Container(
padding: new EdgeDims.all(20.0), padding: new EdgeDims.all(20.0),
child: new Column(<Widget>[ child: new Column(
new Row(<Widget>[ children: <Widget>[
new Row(
children: <Widget>[
new Text( new Text(
'${stock.symbol}', '${stock.symbol}',
style: Theme.of(context).text.display2 style: Theme.of(context).text.display2
......
...@@ -209,13 +209,15 @@ class CardCollectionState extends State<CardCollection> { ...@@ -209,13 +209,15 @@ class CardCollectionState extends State<CardCollection> {
Widget buildDrawerCheckbox(String label, bool value, void callback(), { bool enabled: true }) { Widget buildDrawerCheckbox(String label, bool value, void callback(), { bool enabled: true }) {
return new DrawerItem( return new DrawerItem(
onPressed: enabled ? callback : null, onPressed: enabled ? callback : null,
child: new Row(<Widget>[ child: new Row(
new Flexible(child: new Text(label)), children: <Widget>[
new Checkbox( new Flexible(child: new Text(label)),
value: value, new Checkbox(
onChanged: enabled ? (_) { callback(); } : null value: value,
) onChanged: enabled ? (_) { callback(); } : null
]) )
]
)
); );
} }
...@@ -223,14 +225,16 @@ class CardCollectionState extends State<CardCollection> { ...@@ -223,14 +225,16 @@ class CardCollectionState extends State<CardCollection> {
return new DrawerItem( return new DrawerItem(
icon: icon, icon: icon,
onPressed: enabled ? () { onChanged(itemValue); } : null, onPressed: enabled ? () { onChanged(itemValue); } : null,
child: new Row(<Widget>[ child: new Row(
new Flexible(child: new Text(label)), children: <Widget>[
new Radio<Map<int, Color>>( new Flexible(child: new Text(label)),
value: itemValue, new Radio<Map<int, Color>>(
groupValue: currentValue, value: itemValue,
onChanged: enabled ? onChanged : null groupValue: currentValue,
) onChanged: enabled ? onChanged : null
]) )
]
)
); );
} }
...@@ -238,14 +242,16 @@ class CardCollectionState extends State<CardCollection> { ...@@ -238,14 +242,16 @@ class CardCollectionState extends State<CardCollection> {
return new DrawerItem( return new DrawerItem(
icon: icon, icon: icon,
onPressed: enabled ? () { onChanged(itemValue); } : null, onPressed: enabled ? () { onChanged(itemValue); } : null,
child: new Row(<Widget>[ child: new Row(
new Flexible(child: new Text(label)), children: <Widget>[
new Radio<DismissDirection>( new Flexible(child: new Text(label)),
value: itemValue, new Radio<DismissDirection>(
groupValue: currentValue, value: itemValue,
onChanged: enabled ? onChanged : null groupValue: currentValue,
) onChanged: enabled ? onChanged : null
]) )
]
)
); );
} }
...@@ -253,14 +259,16 @@ class CardCollectionState extends State<CardCollection> { ...@@ -253,14 +259,16 @@ class CardCollectionState extends State<CardCollection> {
return new DrawerItem( return new DrawerItem(
icon: icon, icon: icon,
onPressed: enabled ? () { onChanged(itemValue); } : null, onPressed: enabled ? () { onChanged(itemValue); } : null,
child: new Row(<Widget>[ child: new Row(
new Flexible(child: new Text(label)), children: <Widget>[
new Radio<TextStyle>( new Flexible(child: new Text(label)),
value: itemValue, new Radio<TextStyle>(
groupValue: currentValue, value: itemValue,
onChanged: enabled ? onChanged : null groupValue: currentValue,
) onChanged: enabled ? onChanged : null
]) )
]
)
); );
} }
...@@ -307,7 +315,8 @@ class CardCollectionState extends State<CardCollection> { ...@@ -307,7 +315,8 @@ class CardCollectionState extends State<CardCollection> {
style: DefaultTextStyle.of(context).merge(cardLabelStyle).merge(_textStyle).copyWith( style: DefaultTextStyle.of(context).merge(cardLabelStyle).merge(_textStyle).copyWith(
fontSize: _varyFontSizes ? _cardModels.length.toDouble() : null fontSize: _varyFontSizes ? _cardModels.length.toDouble() : null
), ),
child: new Column(<Widget>[ child: new Column(
children: <Widget>[
new Text(cardModel.label) new Text(cardModel.label)
], ],
alignItems: FlexAlignItems.stretch, alignItems: FlexAlignItems.stretch,
...@@ -357,11 +366,13 @@ class CardCollectionState extends State<CardCollection> { ...@@ -357,11 +366,13 @@ class CardCollectionState extends State<CardCollection> {
child: new Container( child: new Container(
height: cardModel.height, height: cardModel.height,
decoration: new BoxDecoration(backgroundColor: Theme.of(context).primaryColor), decoration: new BoxDecoration(backgroundColor: Theme.of(context).primaryColor),
child: new Row(<Widget>[ child: new Row(
leftArrowIcon, children: <Widget>[
new Flexible(child: new Text(backgroundMessage, style: backgroundTextStyle)), leftArrowIcon,
rightArrowIcon new Flexible(child: new Text(backgroundMessage, style: backgroundTextStyle)),
]) rightArrowIcon
]
)
) )
) )
) )
...@@ -370,7 +381,7 @@ class CardCollectionState extends State<CardCollection> { ...@@ -370,7 +381,7 @@ class CardCollectionState extends State<CardCollection> {
return new IconTheme( return new IconTheme(
key: cardModel.key, key: cardModel.key,
data: const IconThemeData(color: IconThemeColor.white), data: const IconThemeData(color: IconThemeColor.white),
child: new Stack(<Widget>[background, card]) child: new Stack(children: <Widget>[background, card])
); );
} }
...@@ -409,11 +420,14 @@ class CardCollectionState extends State<CardCollection> { ...@@ -409,11 +420,14 @@ class CardCollectionState extends State<CardCollection> {
); );
} }
if (_sunshine) if (_sunshine) {
cardCollection = new Stack(<Widget>[ cardCollection = new Stack(
new Column(<Widget>[new NetworkImage(src: _sunshineURL)]), children: <Widget>[
new ShaderMask(child: cardCollection, shaderCallback: _createShader) new Column(children: <Widget>[new NetworkImage(src: _sunshineURL)]),
]); new ShaderMask(child: cardCollection, shaderCallback: _createShader)
]
);
}
Widget body = new SizeObserver( Widget body = new SizeObserver(
onSizeChanged: _updateCardCollectionSize, onSizeChanged: _updateCardCollectionSize,
...@@ -434,7 +448,7 @@ class CardCollectionState extends State<CardCollection> { ...@@ -434,7 +448,7 @@ class CardCollectionState extends State<CardCollection> {
) )
) )
); );
body = new Stack(<Widget>[body, indicator]); body = new Stack(children: <Widget>[body, indicator]);
} }
return new Theme( return new Theme(
......
...@@ -6,7 +6,8 @@ import 'package:flutter/material.dart'; ...@@ -6,7 +6,8 @@ import 'package:flutter/material.dart';
class ContainerApp extends StatelessComponent { class ContainerApp extends StatelessComponent {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Column(<Widget>[ return new Column(
children: <Widget>[
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,15 +21,17 @@ class ContainerApp extends StatelessComponent { ...@@ -20,15 +21,17 @@ class ContainerApp extends StatelessComponent {
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 Row(<Widget>[ child: new Row(
new RaisedButton( children: <Widget>[
child: new Text('PRESS ME'), new RaisedButton(
onPressed: () => print("Hello World") child: new Text('PRESS ME'),
), onPressed: () => print("Hello World")
new RaisedButton( ),
child: new Text('DISABLED') new RaisedButton(
) child: new Text('DISABLED')
]) )
]
)
), ),
new Flexible( new Flexible(
child: new Container( child: new Container(
......
...@@ -135,37 +135,44 @@ class DragAndDropApp extends StatelessComponent { ...@@ -135,37 +135,44 @@ class DragAndDropApp extends StatelessComponent {
toolBar: new ToolBar( toolBar: new ToolBar(
center: new Text('Drag and Drop Flutter Demo') center: new Text('Drag and Drop Flutter Demo')
), ),
body: new Column(<Widget>[ body: new Column(
new Flexible(child: new Row(<Widget>[ children: <Widget>[
new ExampleDragSource( new Flexible(child: new Row(
color: const Color(0xFFFFF000), children: <Widget>[
under: true, new ExampleDragSource(
heavy: false, color: const Color(0xFFFFF000),
child: new Text('under') under: true,
), heavy: false,
new ExampleDragSource( child: new Text('under')
color: const Color(0xFF0FFF00), ),
under: false, new ExampleDragSource(
heavy: true, color: const Color(0xFF0FFF00),
child: new Text('long-press above') under: false,
), heavy: true,
new ExampleDragSource( child: new Text('long-press above')
color: const Color(0xFF00FFF0), ),
under: false, new ExampleDragSource(
heavy: false, color: const Color(0xFF00FFF0),
child: new Text('above') under: false,
), heavy: false,
], child: new Text('above')
alignItems: FlexAlignItems.center, ),
justifyContent: FlexJustifyContent.spaceAround ],
)), alignItems: FlexAlignItems.center,
new Flexible(child: new Row(<Widget>[ justifyContent: FlexJustifyContent.spaceAround
new Flexible(child: new ExampleDragTarget()), )),
new Flexible(child: new ExampleDragTarget()), new Flexible(
new Flexible(child: new ExampleDragTarget()), child: new Row(
new Flexible(child: new ExampleDragTarget()), children: <Widget>[
])), new Flexible(child: new ExampleDragTarget()),
]) new Flexible(child: new ExampleDragTarget()),
new Flexible(child: new ExampleDragTarget()),
new Flexible(child: new ExampleDragTarget()),
]
)
),
]
)
); );
} }
} }
......
...@@ -138,68 +138,79 @@ class ScaleAppState extends State<ScaleApp> { ...@@ -138,68 +138,79 @@ class ScaleAppState extends State<ScaleApp> {
child: new Scaffold( child: new Scaffold(
toolBar: new ToolBar( toolBar: new ToolBar(
center: new Text('Gestures Demo')), center: new Text('Gestures Demo')),
body: new Stack([ body: new Stack(
new GestureDetector( children: <Widget>[
onScaleStart: _scaleEnabled ? _handleScaleStart : null, new GestureDetector(
onScaleUpdate: _scaleEnabled ? _handleScaleUpdate : null, onScaleStart: _scaleEnabled ? _handleScaleStart : null,
onTap: _tapEnabled ? _handleColorChange : null, onScaleUpdate: _scaleEnabled ? _handleScaleUpdate : null,
onDoubleTap: _doubleTapEnabled ? _handleScaleReset : null, onTap: _tapEnabled ? _handleColorChange : null,
onLongPress: _longPressEnabled ? _handleDirectionChange : null, onDoubleTap: _doubleTapEnabled ? _handleScaleReset : null,
child: new CustomPaint( onLongPress: _longPressEnabled ? _handleDirectionChange : null,
painter: new _GesturePainter( child: new CustomPaint(
zoom: _zoom, painter: new _GesturePainter(
offset: _offset, zoom: _zoom,
swatch: _swatch, offset: _offset,
forward: _forward, swatch: _swatch,
scaleEnabled: _scaleEnabled, forward: _forward,
tapEnabled: _tapEnabled, scaleEnabled: _scaleEnabled,
doubleTapEnabled: _doubleTapEnabled, tapEnabled: _tapEnabled,
longPressEnabled: _longPressEnabled doubleTapEnabled: _doubleTapEnabled,
longPressEnabled: _longPressEnabled
)
) )
) ),
), new Positioned(
new Positioned( bottom: 0.0,
bottom: 0.0, left: 0.0,
left: 0.0, child: new Card(
child: new Card( child: new Container(
child: new Container( padding: new EdgeDims.all(4.0),
padding: new EdgeDims.all(4.0), child: new Column(
child: new Column([ children: <Widget>[
new Row([ new Row(
new Checkbox( children: <Widget>[
value: _scaleEnabled, new Checkbox(
onChanged: (bool value) { setState(() { _scaleEnabled = value; }); } value: _scaleEnabled,
onChanged: (bool value) { setState(() { _scaleEnabled = value; }); }
),
new Text('Scale'),
]
), ),
new Text('Scale'), new Row(
]), children: <Widget>[
new Row([ new Checkbox(
new Checkbox( value: _tapEnabled,
value: _tapEnabled, onChanged: (bool value) { setState(() { _tapEnabled = value; }); }
onChanged: (bool value) { setState(() { _tapEnabled = value; }); } ),
new Text('Tap'),
]
), ),
new Text('Tap'), new Row(
]), children: <Widget>[
new Row([ new Checkbox(
new Checkbox( value: _doubleTapEnabled,
value: _doubleTapEnabled, onChanged: (bool value) { setState(() { _doubleTapEnabled = value; }); }
onChanged: (bool value) { setState(() { _doubleTapEnabled = value; }); } ),
new Text('Double Tap'),
]
), ),
new Text('Double Tap'), new Row(
]), children: <Widget>[
new Row([ new Checkbox(
new Checkbox( value: _longPressEnabled,
value: _longPressEnabled, onChanged: (bool value) { setState(() { _longPressEnabled = value; }); }
onChanged: (bool value) { setState(() { _longPressEnabled = value; }); } ),
new Text('Long Press'),
]
), ),
new Text('Long Press'), ],
]), alignItems: FlexAlignItems.start
], )
alignItems: FlexAlignItems.start
) )
) )
) ),
), ]
]) )
) )
); );
} }
......
...@@ -59,20 +59,22 @@ class HeroDemo extends StatelessComponent { ...@@ -59,20 +59,22 @@ class HeroDemo extends StatelessComponent {
child: new GestureDetector( child: new GestureDetector(
onTap: () => Navigator.push(context, new CrabRoute()), onTap: () => Navigator.push(context, new CrabRoute()),
child: new Card( child: new Card(
child: new Row(<Widget>[ child: new Row(
new HeroImage( children: <Widget>[
size: const Size(100.0, 100.0) new HeroImage(
), size: const Size(100.0, 100.0)
new Flexible( ),
child: new Container( new Flexible(
padding: const EdgeDims.all(10.0), child: new Container(
child: new Text( padding: const EdgeDims.all(10.0),
"Low Crab Diet", child: new Text(
style: Theme.of(context).text.title "Low Crab Diet",
style: Theme.of(context).text.title
)
) )
) )
) ]
]) )
) )
) )
) )
...@@ -94,34 +96,39 @@ class CrabPage extends StatelessComponent { ...@@ -94,34 +96,39 @@ class CrabPage extends StatelessComponent {
color: const Color(0x00000000), color: const Color(0x00000000),
child: new Block( child: new Block(
<Widget>[ <Widget>[
new Stack(<Widget>[ new Stack(
new HeroImage( children: <Widget>[
size: new Size(ui.window.size.width, ui.window.size.width) new HeroImage(
), size: new Size(ui.window.size.width, ui.window.size.width)
new ToolBar(
padding: new EdgeDims.only(top: ui.window.padding.top),
backgroundColor: const Color(0x00000000),
left: new IconButton(
icon: "navigation/arrow_back",
onPressed: () => Navigator.pop(context)
), ),
right: <Widget>[ new ToolBar(
new IconButton(icon: "navigation/more_vert") padding: new EdgeDims.only(top: ui.window.padding.top),
] backgroundColor: const Color(0x00000000),
), left: new IconButton(
new Positioned( icon: "navigation/arrow_back",
bottom: 10.0, onPressed: () => Navigator.pop(context)
left: 10.0, ),
child: new Text("Low Crab Diet", style: titleStyle) right: <Widget>[
) new IconButton(icon: "navigation/more_vert")
]), ]
),
new Positioned(
bottom: 10.0,
left: 10.0,
child: new Text("Low Crab Diet", style: titleStyle)
)
]
),
new Material( new Material(
child: new Container( child: new Container(
padding: const EdgeDims.all(10.0), padding: const EdgeDims.all(10.0),
child: new Column(<Widget>[ child: new Column(
new Text(kText, style: Theme.of(context).text.body1), children: <Widget>[
new Container(height: 800.0), new Text(kText, style: Theme.of(context).text.body1),
], alignItems: FlexAlignItems.start) new Container(height: 800.0),
],
alignItems: FlexAlignItems.start
)
) )
) )
] ]
......
...@@ -30,7 +30,7 @@ class IndexedStackDemoState extends State<IndexedStackDemo> { ...@@ -30,7 +30,7 @@ class IndexedStackDemoState extends State<IndexedStackDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<PopupMenuItem> items = _buildMenu(); List<PopupMenuItem> items = _buildMenu();
IndexedStack indexedStack = new IndexedStack(items, index: _itemIndex, alignment: const FractionalOffset(0.5, 0.0)); IndexedStack indexedStack = new IndexedStack(children: items, index: _itemIndex, alignment: const FractionalOffset(0.5, 0.0));
return new Scaffold( return new Scaffold(
toolBar: new ToolBar(center: new Text('IndexedStackDemo Demo')), toolBar: new ToolBar(center: new Text('IndexedStackDemo Demo')),
......
...@@ -17,7 +17,7 @@ class AdaptiveItem { ...@@ -17,7 +17,7 @@ class AdaptiveItem {
Widget toListItem() { Widget toListItem() {
return new Row( return new Row(
<Widget>[ children: <Widget>[
new Container( new Container(
width: 32.0, width: 32.0,
height: 32.0, height: 32.0,
...@@ -34,7 +34,7 @@ class AdaptiveItem { ...@@ -34,7 +34,7 @@ class AdaptiveItem {
Widget toCard() { Widget toCard() {
return new Card( return new Card(
child: new Column( child: new Column(
<Widget>[ children: <Widget>[
new Flexible( new Flexible(
child: new Container( child: new Container(
decoration: new BoxDecoration( decoration: new BoxDecoration(
...@@ -45,7 +45,7 @@ class AdaptiveItem { ...@@ -45,7 +45,7 @@ class AdaptiveItem {
new Container( new Container(
margin: const EdgeDims.only(left: 8.0), margin: const EdgeDims.only(left: 8.0),
child: new Row( child: new Row(
<Widget>[ children: <Widget>[
new Flexible( new Flexible(
child: new Text(name) child: new Text(name)
), ),
......
...@@ -169,7 +169,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> { ...@@ -169,7 +169,7 @@ class OverlayGeometryAppState extends State<OverlayGeometryApp> {
]; ];
for (MarkerType type in markers.keys) for (MarkerType type in markers.keys)
layers.add(new Marker(type: type, position: markers[type])); layers.add(new Marker(type: type, position: markers[type]));
return new Stack(layers); return new Stack(children: layers);
} }
} }
......
...@@ -95,10 +95,12 @@ class PageableListAppState extends State<PageableListApp> { ...@@ -95,10 +95,12 @@ class PageableListAppState extends State<PageableListApp> {
), ),
new DrawerItem( new DrawerItem(
onPressed: toggleItemsWrap, onPressed: toggleItemsWrap,
child: new Row(<Widget>[ child: new Row(
new Flexible(child: new Text('Scrolling wraps around')), children: <Widget>[
new Checkbox(value: itemsWrap) new Flexible(child: new Text('Scrolling wraps around')),
]) new Checkbox(value: itemsWrap)
]
)
) )
]) ])
); );
......
...@@ -88,7 +88,7 @@ class PianoApp extends StatelessComponent { ...@@ -88,7 +88,7 @@ class PianoApp extends StatelessComponent {
) )
)); ));
} }
return new Column(children); return new Column(children: children);
} }
} }
......
...@@ -70,7 +70,7 @@ class ProgressIndicatorAppState extends State<ProgressIndicatorApp> { ...@@ -70,7 +70,7 @@ class ProgressIndicatorAppState extends State<ProgressIndicatorApp> {
new Text("${(valueAnimation.value * 100.0).toStringAsFixed(1)}%" + (valueAnimation.isAnimating ? '' : ' (paused)')) new Text("${(valueAnimation.value * 100.0).toStringAsFixed(1)}%" + (valueAnimation.isAnimating ? '' : ' (paused)'))
]; ];
return new Column( return new Column(
indicators children: indicators
.map((Widget c) => new Container(child: c, margin: const EdgeDims.symmetric(vertical: 15.0, horizontal: 20.0))) .map((Widget c) => new Container(child: c, margin: const EdgeDims.symmetric(vertical: 15.0, horizontal: 20.0)))
.toList(), .toList(),
justifyContent: FlexJustifyContent.center justifyContent: FlexJustifyContent.center
......
...@@ -53,7 +53,8 @@ class HardwareKeyDemoState extends State<HardwareKeyDemo> implements mojo.RawKey ...@@ -53,7 +53,8 @@ class HardwareKeyDemoState extends State<HardwareKeyDemo> implements mojo.RawKey
child: new Text("Press a key", style: Typography.black.display1) child: new Text("Press a key", style: Typography.black.display1)
); );
} }
return new Column([ return new Column(
children: <Widget>[
new Text( new Text(
'${_event.type}', '${_event.type}',
style: Typography.black.body2 style: Typography.black.body2
...@@ -62,7 +63,9 @@ class HardwareKeyDemoState extends State<HardwareKeyDemo> implements mojo.RawKey ...@@ -62,7 +63,9 @@ class HardwareKeyDemoState extends State<HardwareKeyDemo> implements mojo.RawKey
'${_event.keyData.keyCode}', '${_event.keyData.keyCode}',
style: Typography.black.display4 style: Typography.black.display4
) )
], justifyContent: FlexJustifyContent.center); ],
justifyContent: FlexJustifyContent.center
);
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
......
...@@ -68,33 +68,39 @@ class SectorAppState extends State<SectorApp> { ...@@ -68,33 +68,39 @@ class SectorAppState extends State<SectorApp> {
} }
Widget buildBody() { Widget buildBody() {
return new Column(<Widget>[ return new Column(
children: <Widget>[
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 Row(<Widget>[ child: new Row(
children: <Widget>[
new RaisedButton( new RaisedButton(
child: new IntrinsicWidth( child: new IntrinsicWidth(
child: new Row(<Widget>[ child: new Row(
new Container( children: <Widget>[
padding: new EdgeDims.all(4.0), new Container(
margin: new EdgeDims.only(right: 10.0), padding: new EdgeDims.all(4.0),
child: new WidgetToRenderBoxAdapter(sectorAddIcon) margin: new EdgeDims.only(right: 10.0),
), child: new WidgetToRenderBoxAdapter(sectorAddIcon)
new Text('ADD SECTOR'), ),
]) new Text('ADD SECTOR'),
]
)
), ),
onPressed: _enabledAdd ? addSector : null onPressed: _enabledAdd ? addSector : null
), ),
new RaisedButton( new RaisedButton(
child: new IntrinsicWidth( child: new IntrinsicWidth(
child: new Row(<Widget>[ child: new Row(
new Container( children: <Widget>[
padding: new EdgeDims.all(4.0), new Container(
margin: new EdgeDims.only(right: 10.0), padding: new EdgeDims.all(4.0),
child: new WidgetToRenderBoxAdapter(sectorRemoveIcon) margin: new EdgeDims.only(right: 10.0),
), child: new WidgetToRenderBoxAdapter(sectorRemoveIcon)
new Text('REMOVE SECTOR'), ),
]) new Text('REMOVE SECTOR'),
]
)
), ),
onPressed: _enabledRemove ? removeSector : null onPressed: _enabledRemove ? removeSector : null
) )
......
...@@ -37,15 +37,18 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) { ...@@ -37,15 +37,18 @@ void attachWidgetTreeToRenderTree(RenderProxyBox container) {
container: container, container: container,
child: new Container( child: new Container(
height: 300.0, height: 300.0,
child: new Column(<Widget>[ child: new Column(
children: <Widget>[
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 Row(<Widget>[ child: new Row(
children: <Widget>[
new RaisedButton( new RaisedButton(
child: new Row(<Widget>[ child: new Row(
children: <Widget>[
new NetworkImage(src: "http://flutter.io/favicon.ico"), new NetworkImage(src: "http://flutter.io/favicon.ico"),
new Text('PRESS ME'), new Text('PRESS ME'),
] ]
......
...@@ -89,7 +89,8 @@ HAL: This mission is too important for me to allow you to jeopardize it.'''; ...@@ -89,7 +89,8 @@ HAL: This mission is too important for me to allow you to jeopardize it.''';
Widget body = new Container( Widget body = new Container(
padding: new EdgeDims.symmetric(horizontal: 8.0), padding: new EdgeDims.symmetric(horizontal: 8.0),
child: new Column(children, child: new Column(
children: children,
justifyContent: FlexJustifyContent.center, justifyContent: FlexJustifyContent.center,
alignItems: FlexAlignItems.start alignItems: FlexAlignItems.start
) )
......
...@@ -79,7 +79,10 @@ class Chip extends StatelessComponent { ...@@ -79,7 +79,10 @@ class Chip extends StatelessComponent {
backgroundColor: Colors.grey[300], backgroundColor: Colors.grey[300],
borderRadius: 16.0 borderRadius: 16.0
), ),
child: new Row(children, justifyContent: FlexJustifyContent.collapse) child: new Row(
children: children,
justifyContent: FlexJustifyContent.collapse
)
); );
} }
} }
...@@ -89,13 +89,16 @@ class _DatePickerState extends State<DatePicker> { ...@@ -89,13 +89,16 @@ class _DatePickerState extends State<DatePicker> {
); );
break; break;
} }
return new Column(<Widget>[ return new Column(
header, children: <Widget>[
new Container( header,
height: _calendarHeight, new Container(
child: picker height: _calendarHeight,
) child: picker
], alignItems: FlexAlignItems.stretch); )
],
alignItems: FlexAlignItems.stretch
);
} }
} }
...@@ -138,20 +141,22 @@ class _DatePickerHeader extends StatelessComponent { ...@@ -138,20 +141,22 @@ class _DatePickerHeader extends StatelessComponent {
return new Container( return new Container(
padding: new EdgeDims.all(10.0), padding: new EdgeDims.all(10.0),
decoration: new BoxDecoration(backgroundColor: theme.primaryColor), decoration: new BoxDecoration(backgroundColor: theme.primaryColor),
child: new Column(<Widget>[ child: new Column(
new GestureDetector( children: <Widget>[
onTap: () => _handleChangeMode(_DatePickerMode.day), new GestureDetector(
child: new Text(new DateFormat("MMM").format(selectedDate).toUpperCase(), style: monthStyle) onTap: () => _handleChangeMode(_DatePickerMode.day),
), child: new Text(new DateFormat("MMM").format(selectedDate).toUpperCase(), style: monthStyle)
new GestureDetector( ),
onTap: () => _handleChangeMode(_DatePickerMode.day), new GestureDetector(
child: new Text(new DateFormat("d").format(selectedDate), style: dayStyle) onTap: () => _handleChangeMode(_DatePickerMode.day),
), child: new Text(new DateFormat("d").format(selectedDate), style: dayStyle)
new GestureDetector( ),
onTap: () => _handleChangeMode(_DatePickerMode.year), new GestureDetector(
child: new Text(new DateFormat("yyyy").format(selectedDate), style: yearStyle) onTap: () => _handleChangeMode(_DatePickerMode.year),
) child: new Text(new DateFormat("yyyy").format(selectedDate), style: yearStyle)
]) )
]
)
); );
} }
} }
...@@ -190,7 +195,7 @@ class DayPicker extends StatelessComponent { ...@@ -190,7 +195,7 @@ class DayPicker extends StatelessComponent {
List<Widget> rows = <Widget>[ List<Widget> rows = <Widget>[
new Text(new DateFormat("MMMM y").format(displayedMonth), style: monthStyle), new Text(new DateFormat("MMMM y").format(displayedMonth), style: monthStyle),
new Flex( new Flex(
headers, children: headers,
justifyContent: FlexJustifyContent.spaceAround justifyContent: FlexJustifyContent.spaceAround
) )
]; ];
...@@ -255,11 +260,11 @@ class DayPicker extends StatelessComponent { ...@@ -255,11 +260,11 @@ class DayPicker extends StatelessComponent {
for (int w = 0; w < weeksShown; w++) { for (int w = 0; w < weeksShown; w++) {
int startIndex = w * days.length; int startIndex = w * days.length;
rows.add(new Row( rows.add(new Row(
labels.sublist(startIndex, startIndex + days.length) children: labels.sublist(startIndex, startIndex + days.length)
)); ));
} }
return new Column(rows); return new Column(children: rows);
} }
} }
......
...@@ -89,7 +89,8 @@ class Dialog extends StatelessComponent { ...@@ -89,7 +89,8 @@ class Dialog extends StatelessComponent {
dialogBody.add(new ButtonTheme( dialogBody.add(new ButtonTheme(
color: ButtonColor.accent, color: ButtonColor.accent,
child: new Container( child: new Container(
child: new Row(actions, child: new Row(
children: actions,
justifyContent: FlexJustifyContent.end justifyContent: FlexJustifyContent.end
) )
) )
......
...@@ -173,36 +173,38 @@ class DrawerControllerState extends State<DrawerController> { ...@@ -173,36 +173,38 @@ class DrawerControllerState extends State<DrawerController> {
onHorizontalDragUpdate: _move, onHorizontalDragUpdate: _move,
onHorizontalDragEnd: _settle, onHorizontalDragEnd: _settle,
child: new RepaintBoundary( child: new RepaintBoundary(
child: new Stack(<Widget>[ child: new Stack(
new GestureDetector( children: <Widget>[
onTap: close, new GestureDetector(
child: new DecoratedBox( onTap: close,
decoration: new BoxDecoration( child: new DecoratedBox(
backgroundColor: _color.value decoration: new BoxDecoration(
), backgroundColor: _color.value
child: new Container() ),
) child: new Container()
), )
new Align( ),
alignment: const FractionalOffset(0.0, 0.5), new Align(
child: new Listener( alignment: const FractionalOffset(0.0, 0.5),
onPointerDown: _handlePointerDown, child: new Listener(
child: new Align( onPointerDown: _handlePointerDown,
alignment: const FractionalOffset(1.0, 0.5), child: new Align(
widthFactor: _performance.progress, alignment: const FractionalOffset(1.0, 0.5),
child: new SizeObserver( widthFactor: _performance.progress,
onSizeChanged: _handleSizeChanged, child: new SizeObserver(
child: new RepaintBoundary( onSizeChanged: _handleSizeChanged,
child: new Focus( child: new RepaintBoundary(
key: new GlobalObjectKey(config.key), child: new Focus(
child: config.child key: new GlobalObjectKey(config.key),
child: config.child
)
) )
) )
) )
) )
) )
) ]
]) )
) )
); );
} }
......
...@@ -31,15 +31,17 @@ class DrawerHeader extends StatelessComponent { ...@@ -31,15 +31,17 @@ class DrawerHeader extends StatelessComponent {
), ),
padding: const EdgeDims.only(bottom: 7.0), padding: const EdgeDims.only(bottom: 7.0),
margin: const EdgeDims.only(bottom: 8.0), margin: const EdgeDims.only(bottom: 8.0),
child: new Column(<Widget>[ child: new Column(
new Flexible(child: new Container()), children: <Widget>[
new Container( new Flexible(child: new Container()),
padding: const EdgeDims.symmetric(horizontal: 16.0), new Container(
child: new DefaultTextStyle( padding: const EdgeDims.symmetric(horizontal: 16.0),
style: Theme.of(context).text.body2, child: new DefaultTextStyle(
child: child style: Theme.of(context).text.body2,
child: child
)
) )
)] ]
) )
); );
} }
......
...@@ -46,9 +46,9 @@ class DrawerItem extends StatelessComponent { ...@@ -46,9 +46,9 @@ class DrawerItem extends StatelessComponent {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ThemeData themeData = Theme.of(context); ThemeData themeData = Theme.of(context);
List<Widget> flexChildren = new List<Widget>(); List<Widget> children = <Widget>[];
if (icon != null) { if (icon != null) {
flexChildren.add( children.add(
new Padding( new Padding(
padding: const EdgeDims.symmetric(horizontal: 16.0), padding: const EdgeDims.symmetric(horizontal: 16.0),
child: new Icon( child: new Icon(
...@@ -58,7 +58,7 @@ class DrawerItem extends StatelessComponent { ...@@ -58,7 +58,7 @@ class DrawerItem extends StatelessComponent {
) )
); );
} }
flexChildren.add( children.add(
new Flexible( new Flexible(
child: new Padding( child: new Padding(
padding: const EdgeDims.symmetric(horizontal: 16.0), padding: const EdgeDims.symmetric(horizontal: 16.0),
...@@ -74,7 +74,7 @@ class DrawerItem extends StatelessComponent { ...@@ -74,7 +74,7 @@ class DrawerItem extends StatelessComponent {
height: 48.0, height: 48.0,
child: new InkWell( child: new InkWell(
onTap: onPressed, onTap: onPressed,
child: new Row(flexChildren) child: new Row(children: children)
) )
); );
} }
......
...@@ -289,18 +289,19 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> { ...@@ -289,18 +289,19 @@ class _DropDownButtonState<T> extends State<DropDownButton<T>> {
onTap: _handleTap, onTap: _handleTap,
child: new Container( child: new Container(
decoration: new BoxDecoration(border: _kDropDownUnderline), decoration: new BoxDecoration(border: _kDropDownUnderline),
child: new Row(<Widget>[ child: new Row(
new IndexedStack( children: <Widget>[
config.items, new IndexedStack(
key: indexedStackKey, children: config.items,
index: _selectedIndex, key: indexedStackKey,
alignment: const FractionalOffset(0.5, 0.0) index: _selectedIndex,
), alignment: const FractionalOffset(0.5, 0.0)
new Container( ),
child: new Icon(icon: 'navigation/arrow_drop_down', size: IconSize.s36), new Container(
padding: const EdgeDims.only(top: 6.0) child: new Icon(icon: 'navigation/arrow_drop_down', size: IconSize.s36),
) padding: const EdgeDims.only(top: 6.0)
], )
],
justifyContent: FlexJustifyContent.collapse justifyContent: FlexJustifyContent.collapse
) )
) )
......
...@@ -134,7 +134,7 @@ class InputState extends ScrollableState<Input> { ...@@ -134,7 +134,7 @@ class InputState extends ScrollableState<Input> {
child: new SizeObserver( child: new SizeObserver(
onSizeChanged: _handleContainerSizeChanged, onSizeChanged: _handleContainerSizeChanged,
child: new Container( child: new Container(
child: new Stack(textChildren), child: new Stack(children: textChildren),
margin: config.isDense ? margin: config.isDense ?
const EdgeDims.symmetric(vertical: 4.0) : const EdgeDims.symmetric(vertical: 4.0) :
const EdgeDims.symmetric(vertical: 8.0), const EdgeDims.symmetric(vertical: 8.0),
......
...@@ -51,7 +51,7 @@ class ListItem extends StatelessComponent { ...@@ -51,7 +51,7 @@ class ListItem extends StatelessComponent {
onLongPress: onLongPress, onLongPress: onLongPress,
child: new Padding( child: new Padding(
padding: const EdgeDims.symmetric(horizontal: 16.0), padding: const EdgeDims.symmetric(horizontal: 16.0),
child: new Row(children) child: new Row(children: children)
) )
); );
} }
......
...@@ -175,10 +175,12 @@ class _MaterialAppState extends State<MaterialApp> implements BindingObserver { ...@@ -175,10 +175,12 @@ class _MaterialAppState extends State<MaterialApp> implements BindingObserver {
return true; return true;
}); });
if (config.showPerformanceOverlay) { if (config.showPerformanceOverlay) {
result = new Stack([ result = new Stack(
result, children: <Widget>[
new Positioned(bottom: 0.0, left: 0.0, right: 0.0, child: new PerformanceOverlay.allEnabled()), result,
]); new Positioned(bottom: 0.0, left: 0.0, right: 0.0, child: new PerformanceOverlay.allEnabled()),
]
);
} }
return result; return result;
} }
......
...@@ -314,7 +314,7 @@ class ScaffoldState extends State<Scaffold> { ...@@ -314,7 +314,7 @@ class ScaffoldState extends State<Scaffold> {
if (_currentBottomSheet != null) if (_currentBottomSheet != null)
bottomSheets.add(_currentBottomSheet._widget); bottomSheets.add(_currentBottomSheet._widget);
Widget stack = new Stack( Widget stack = new Stack(
bottomSheets, children: bottomSheets,
alignment: const FractionalOffset(0.5, 1.0) // bottom-aligned, centered alignment: const FractionalOffset(0.5, 1.0) // bottom-aligned, centered
); );
_addIfNonNull(children, stack, _Child.bottomSheet); _addIfNonNull(children, stack, _Child.bottomSheet);
...@@ -335,7 +335,7 @@ class ScaffoldState extends State<Scaffold> { ...@@ -335,7 +335,7 @@ class ScaffoldState extends State<Scaffold> {
)); ));
} }
return new CustomMultiChildLayout(children, delegate: new _ScaffoldLayout()); return new CustomMultiChildLayout(children: children, delegate: new _ScaffoldLayout());
} }
} }
......
...@@ -103,7 +103,7 @@ class SnackBar extends StatelessComponent { ...@@ -103,7 +103,7 @@ class SnackBar extends StatelessComponent {
performance: performance, performance: performance,
opacity: new AnimatedValue<double>(0.0, end: 1.0, curve: _snackBarFadeCurve), opacity: new AnimatedValue<double>(0.0, end: 1.0, curve: _snackBarFadeCurve),
child: new Row( child: new Row(
children, children: children,
alignItems: FlexAlignItems.center alignItems: FlexAlignItems.center
) )
) )
......
...@@ -331,7 +331,7 @@ class _Tab extends StatelessComponent { ...@@ -331,7 +331,7 @@ class _Tab extends StatelessComponent {
labelContent = _buildLabelIcon(); labelContent = _buildLabelIcon();
} else { } else {
labelContent = new Column( labelContent = new Column(
<Widget>[ children: <Widget>[
new Container( new Container(
child: _buildLabelIcon(), child: _buildLabelIcon(),
margin: const EdgeDims.only(bottom: 10.0) margin: const EdgeDims.only(bottom: 10.0)
......
...@@ -123,20 +123,23 @@ class _TimePickerState extends State<TimePicker> { ...@@ -123,20 +123,23 @@ class _TimePickerState extends State<TimePicker> {
onModeChanged: _handleModeChanged, onModeChanged: _handleModeChanged,
onChanged: config.onChanged onChanged: config.onChanged
); );
return new Column(<Widget>[ return new Column(
header, children: <Widget>[
new AspectRatio( header,
aspectRatio: 1.0, new AspectRatio(
child: new Container( aspectRatio: 1.0,
margin: const EdgeDims.all(12.0), child: new Container(
child: new _Dial( margin: const EdgeDims.all(12.0),
mode: _mode, child: new _Dial(
selectedTime: config.selectedTime, mode: _mode,
onChanged: config.onChanged selectedTime: config.selectedTime,
onChanged: config.onChanged
)
) )
) )
) ],
], alignItems: FlexAlignItems.stretch); alignItems: FlexAlignItems.stretch
);
} }
} }
...@@ -199,31 +202,37 @@ class _TimePickerHeader extends StatelessComponent { ...@@ -199,31 +202,37 @@ class _TimePickerHeader extends StatelessComponent {
return new Container( return new Container(
padding: kDialogHeadingPadding, padding: kDialogHeadingPadding,
decoration: new BoxDecoration(backgroundColor: theme.primaryColor), decoration: new BoxDecoration(backgroundColor: theme.primaryColor),
child: new Row(<Widget>[ child: new Row(
new GestureDetector( children: <Widget>[
onTap: () => _handleChangeMode(_TimePickerMode.hour), new GestureDetector(
child: new Text(selectedTime.hourOfPeriodLabel, style: hourStyle) onTap: () => _handleChangeMode(_TimePickerMode.hour),
), child: new Text(selectedTime.hourOfPeriodLabel, style: hourStyle)
new Text(':', style: inactiveStyle), ),
new GestureDetector( new Text(':', style: inactiveStyle),
onTap: () => _handleChangeMode(_TimePickerMode.minute), new GestureDetector(
child: new Text(selectedTime.minuteLabel, style: minuteStyle) onTap: () => _handleChangeMode(_TimePickerMode.minute),
), child: new Text(selectedTime.minuteLabel, style: minuteStyle)
new GestureDetector( ),
onTap: _handleChangeDayPeriod, new GestureDetector(
behavior: HitTestBehavior.opaque, onTap: _handleChangeDayPeriod,
child: new Container( behavior: HitTestBehavior.opaque,
padding: const EdgeDims.only(left: 16.0, right: 24.0), child: new Container(
child: new Column([ padding: const EdgeDims.only(left: 16.0, right: 24.0),
new Text('AM', style: amStyle), child: new Column(
new Container( children: <Widget>[
padding: const EdgeDims.only(top: 4.0), new Text('AM', style: amStyle),
child: new Text('PM', style: pmStyle) new Container(
), padding: const EdgeDims.only(top: 4.0),
], justifyContent: FlexJustifyContent.end) child: new Text('PM', style: pmStyle)
),
],
justifyContent: FlexJustifyContent.end
)
)
) )
) ],
], justifyContent: FlexJustifyContent.end) justifyContent: FlexJustifyContent.end
)
); );
} }
} }
......
...@@ -95,7 +95,7 @@ class ToolBar extends StatelessComponent { ...@@ -95,7 +95,7 @@ class ToolBar extends StatelessComponent {
height: kToolBarHeight, height: kToolBarHeight,
child: new DefaultTextStyle( child: new DefaultTextStyle(
style: sideStyle, style: sideStyle,
child: new Row(firstRow) child: new Row(children: firstRow)
) )
) )
]; ];
...@@ -123,7 +123,7 @@ class ToolBar extends StatelessComponent { ...@@ -123,7 +123,7 @@ class ToolBar extends StatelessComponent {
child: new Container( child: new Container(
padding: combinedPadding, padding: combinedPadding,
child: new Column( child: new Column(
rows, children: rows,
justifyContent: FlexJustifyContent.collapse justifyContent: FlexJustifyContent.collapse
) )
) )
......
...@@ -464,6 +464,8 @@ class LayoutId extends ParentDataWidget<CustomMultiChildLayout> { ...@@ -464,6 +464,8 @@ class LayoutId extends ParentDataWidget<CustomMultiChildLayout> {
} }
} }
const List<Widget> _emptyWidgetList = const <Widget>[];
/// Defers the layout of multiple children to a delegate. /// Defers the layout of multiple children to a delegate.
/// ///
/// The delegate can determine the layout constraints for each child and can /// The delegate can determine the layout constraints for each child and can
...@@ -471,8 +473,9 @@ class LayoutId extends ParentDataWidget<CustomMultiChildLayout> { ...@@ -471,8 +473,9 @@ class LayoutId extends ParentDataWidget<CustomMultiChildLayout> {
/// size of the parent, but the size of the parent cannot depend on the sizes of /// size of the parent, but the size of the parent cannot depend on the sizes of
/// the children. /// the children.
class CustomMultiChildLayout extends MultiChildRenderObjectWidget { class CustomMultiChildLayout extends MultiChildRenderObjectWidget {
CustomMultiChildLayout(List<Widget> children, { CustomMultiChildLayout({
Key key, Key key,
List<Widget> children: _emptyWidgetList,
this.delegate this.delegate
}) : super(key: key, children: children) { }) : super(key: key, children: children) {
assert(delegate != null); assert(delegate != null);
...@@ -927,8 +930,9 @@ class Container extends StatelessComponent { ...@@ -927,8 +930,9 @@ class Container extends StatelessComponent {
/// ///
/// For details about the block layout algorithm, see [RenderBlockBase]. /// For details about the block layout algorithm, see [RenderBlockBase].
class BlockBody extends MultiChildRenderObjectWidget { class BlockBody extends MultiChildRenderObjectWidget {
BlockBody(List<Widget> children, { BlockBody({
Key key, Key key,
List<Widget> children: _emptyWidgetList,
this.direction: Axis.vertical this.direction: Axis.vertical
}) : super(key: key, children: children) { }) : super(key: key, children: children) {
assert(direction != null); assert(direction != null);
...@@ -946,7 +950,7 @@ class BlockBody extends MultiChildRenderObjectWidget { ...@@ -946,7 +950,7 @@ class BlockBody extends MultiChildRenderObjectWidget {
abstract class StackRenderObjectWidgetBase extends MultiChildRenderObjectWidget { abstract class StackRenderObjectWidgetBase extends MultiChildRenderObjectWidget {
StackRenderObjectWidgetBase({ StackRenderObjectWidgetBase({
List<Widget> children, List<Widget> children: _emptyWidgetList,
Key key Key key
}) : super(key: key, children: children); }) : super(key: key, children: children);
} }
...@@ -956,8 +960,9 @@ abstract class StackRenderObjectWidgetBase extends MultiChildRenderObjectWidget ...@@ -956,8 +960,9 @@ abstract class StackRenderObjectWidgetBase extends MultiChildRenderObjectWidget
/// For details about the stack layout algorithm, see [RenderStack]. To control /// For details about the stack layout algorithm, see [RenderStack]. To control
/// the position of child widgets, see the [Positioned] widget. /// the position of child widgets, see the [Positioned] widget.
class Stack extends StackRenderObjectWidgetBase { class Stack extends StackRenderObjectWidgetBase {
Stack(List<Widget> children, { Stack({
Key key, Key key,
List<Widget> children: _emptyWidgetList,
this.alignment: const FractionalOffset(0.0, 0.0) this.alignment: const FractionalOffset(0.0, 0.0)
}) : super(key: key, children: children); }) : super(key: key, children: children);
...@@ -973,8 +978,9 @@ class Stack extends StackRenderObjectWidgetBase { ...@@ -973,8 +978,9 @@ class Stack extends StackRenderObjectWidgetBase {
/// A [Stack] that shows a single child at once. /// A [Stack] that shows a single child at once.
class IndexedStack extends StackRenderObjectWidgetBase { class IndexedStack extends StackRenderObjectWidgetBase {
IndexedStack(List<Widget> children, { IndexedStack({
Key key, Key key,
List<Widget> children: _emptyWidgetList,
this.alignment: const FractionalOffset(0.0, 0.0), this.alignment: const FractionalOffset(0.0, 0.0),
this.index: 0 this.index: 0
}) : super(key: key, children: children) { }) : super(key: key, children: children) {
...@@ -1113,7 +1119,7 @@ class Positioned extends ParentDataWidget<StackRenderObjectWidgetBase> { ...@@ -1113,7 +1119,7 @@ class Positioned extends ParentDataWidget<StackRenderObjectWidgetBase> {
abstract class GridRenderObjectWidgetBase extends MultiChildRenderObjectWidget { abstract class GridRenderObjectWidgetBase extends MultiChildRenderObjectWidget {
GridRenderObjectWidgetBase({ GridRenderObjectWidgetBase({
List<Widget> children, List<Widget> children: _emptyWidgetList,
Key key Key key
}) : super(key: key, children: children) { }) : super(key: key, children: children) {
_delegate = createDelegate(); _delegate = createDelegate();
...@@ -1135,7 +1141,7 @@ abstract class GridRenderObjectWidgetBase extends MultiChildRenderObjectWidget { ...@@ -1135,7 +1141,7 @@ abstract class GridRenderObjectWidgetBase extends MultiChildRenderObjectWidget {
/// ///
/// For details about the grid layout algorithm, see [RenderGrid]. /// For details about the grid layout algorithm, see [RenderGrid].
class CustomGrid extends GridRenderObjectWidgetBase { class CustomGrid extends GridRenderObjectWidgetBase {
CustomGrid(List<Widget> children, { Key key, this.delegate }) CustomGrid({ Key key, List<Widget> children: _emptyWidgetList, this.delegate })
: super(key: key, children: children) { : super(key: key, children: children) {
assert(delegate != null); assert(delegate != null);
} }
...@@ -1150,8 +1156,9 @@ class CustomGrid extends GridRenderObjectWidgetBase { ...@@ -1150,8 +1156,9 @@ class CustomGrid extends GridRenderObjectWidgetBase {
/// ///
/// For details about the grid layout algorithm, see [MaxTileWidthGridDelegate]. /// For details about the grid layout algorithm, see [MaxTileWidthGridDelegate].
class FixedColumnCountGrid extends GridRenderObjectWidgetBase { class FixedColumnCountGrid extends GridRenderObjectWidgetBase {
FixedColumnCountGrid(List<Widget> children, { FixedColumnCountGrid({
Key key, Key key,
List<Widget> children: _emptyWidgetList,
this.columnCount, this.columnCount,
this.tileAspectRatio: 1.0, this.tileAspectRatio: 1.0,
this.padding: EdgeDims.zero this.padding: EdgeDims.zero
...@@ -1181,8 +1188,9 @@ class FixedColumnCountGrid extends GridRenderObjectWidgetBase { ...@@ -1181,8 +1188,9 @@ class FixedColumnCountGrid extends GridRenderObjectWidgetBase {
/// ///
/// For details about the grid layout algorithm, see [MaxTileWidthGridDelegate]. /// For details about the grid layout algorithm, see [MaxTileWidthGridDelegate].
class MaxTileWidthGrid extends GridRenderObjectWidgetBase { class MaxTileWidthGrid extends GridRenderObjectWidgetBase {
MaxTileWidthGrid(List<Widget> children, { MaxTileWidthGrid({
Key key, Key key,
List<Widget> children: _emptyWidgetList,
this.maxTileWidth, this.maxTileWidth,
this.tileAspectRatio: 1.0, this.tileAspectRatio: 1.0,
this.padding: EdgeDims.zero this.padding: EdgeDims.zero
...@@ -1238,8 +1246,9 @@ class GridPlacementData<DataType, WidgetType extends RenderObjectWidget> extends ...@@ -1238,8 +1246,9 @@ class GridPlacementData<DataType, WidgetType extends RenderObjectWidget> extends
/// For details about the flex layout algorithm, see [RenderFlex]. To control /// For details about the flex layout algorithm, see [RenderFlex]. To control
/// the flex of child widgets, see the [Flexible] widget. /// the flex of child widgets, see the [Flexible] widget.
class Flex extends MultiChildRenderObjectWidget { class Flex extends MultiChildRenderObjectWidget {
Flex(List<Widget> children, { Flex({
Key key, Key key,
List<Widget> children: _emptyWidgetList,
this.direction: FlexDirection.horizontal, this.direction: FlexDirection.horizontal,
this.justifyContent: FlexJustifyContent.start, this.justifyContent: FlexJustifyContent.start,
this.alignItems: FlexAlignItems.center, this.alignItems: FlexAlignItems.center,
...@@ -1270,12 +1279,20 @@ class Flex extends MultiChildRenderObjectWidget { ...@@ -1270,12 +1279,20 @@ class Flex extends MultiChildRenderObjectWidget {
/// For details about the flex layout algorithm, see [RenderFlex]. To control /// For details about the flex layout algorithm, see [RenderFlex]. To control
/// the flex of child widgets, see the [Flexible] widget. /// the flex of child widgets, see the [Flexible] widget.
class Row extends Flex { class Row extends Flex {
Row(List<Widget> children, { Row({
Key key, Key key,
List<Widget> children: _emptyWidgetList,
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, textBaseline: textBaseline); }) : super(
children: children,
key: key,
direction: FlexDirection.horizontal,
justifyContent: justifyContent,
alignItems: alignItems,
textBaseline: textBaseline
);
} }
/// Lays out child elements in a column. /// Lays out child elements in a column.
...@@ -1283,12 +1300,20 @@ class Row extends Flex { ...@@ -1283,12 +1300,20 @@ class Row extends Flex {
/// For details about the flex layout algorithm, see [RenderFlex]. To control /// For details about the flex layout algorithm, see [RenderFlex]. To control
/// the flex of child widgets, see the [Flexible] widget. /// the flex of child widgets, see the [Flexible] widget.
class Column extends Flex { class Column extends Flex {
Column(List<Widget> children, { Column({
Key key, Key key,
List<Widget> children: _emptyWidgetList,
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, textBaseline: textBaseline); }) : super(
children: children,
key: key,
direction: FlexDirection.vertical,
justifyContent: justifyContent,
alignItems: alignItems,
textBaseline: textBaseline
);
} }
/// Controls how a child of a [Flex], [Row], or [Column] flexes. /// Controls how a child of a [Flex], [Row], or [Column] flexes.
......
...@@ -171,17 +171,19 @@ class _EnterExitTransitionState extends State<EnterExitTransition> { ...@@ -171,17 +171,19 @@ class _EnterExitTransitionState extends State<EnterExitTransition> {
size: _entries.last.childSize, size: _entries.last.childSize,
duration: config.duration, duration: config.duration,
curve: config.curve, curve: config.curve,
child: new Stack(_entries.map((_Entry entry) { child: new Stack(
return new SizeObserver( children: _entries.map((_Entry entry) {
key: new ObjectKey(entry), return new SizeObserver(
onSizeChanged: (Size newSize) { key: new ObjectKey(entry),
setState(() { onSizeChanged: (Size newSize) {
entry.childSize = newSize; setState(() {
}); entry.childSize = newSize;
}, });
child: entry.currentTransition },
); child: entry.currentTransition
}).toList()) );
}).toList()
)
); );
} }
} }
...@@ -282,6 +282,7 @@ abstract class OneChildRenderObjectWidget extends RenderObjectWidget { ...@@ -282,6 +282,7 @@ abstract class OneChildRenderObjectWidget extends RenderObjectWidget {
abstract class MultiChildRenderObjectWidget extends RenderObjectWidget { abstract class MultiChildRenderObjectWidget extends RenderObjectWidget {
MultiChildRenderObjectWidget({ Key key, this.children }) MultiChildRenderObjectWidget({ Key key, this.children })
: super(key: key) { : super(key: key) {
assert(children != null);
assert(!children.any((Widget child) => child == null)); assert(!children.any((Widget child) => child == null));
} }
......
...@@ -152,7 +152,7 @@ class OverlayState extends State<Overlay> { ...@@ -152,7 +152,7 @@ class OverlayState extends State<Overlay> {
break; break;
} }
return new Stack(backwardsChildren.reversed.toList(growable: false)); return new Stack(children: backwardsChildren.reversed.toList(growable: false));
} }
void debugFillDescription(List<String> description) { void debugFillDescription(List<String> description) {
......
...@@ -425,7 +425,7 @@ class Block extends StatelessComponent { ...@@ -425,7 +425,7 @@ class Block extends StatelessComponent {
final ScrollListener onScroll; final ScrollListener onScroll;
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget contents = new BlockBody(children, direction: scrollDirection); Widget contents = new BlockBody(children: children, direction: scrollDirection);
if (padding != null) if (padding != null)
contents = new Padding(padding: padding, child: contents); contents = new Padding(padding: padding, child: contents);
return new ScrollableViewport( return new ScrollableViewport(
......
...@@ -16,7 +16,7 @@ void main() { ...@@ -16,7 +16,7 @@ void main() {
tester.pumpWidget( tester.pumpWidget(
new Stack( new Stack(
<Widget>[ children: <Widget>[
new AnimatedPositioned( new AnimatedPositioned(
child: new Container(key: key), child: new Container(key: key),
left: 50.0, left: 50.0,
...@@ -39,7 +39,7 @@ void main() { ...@@ -39,7 +39,7 @@ void main() {
tester.pumpWidget( tester.pumpWidget(
new Stack( new Stack(
<Widget>[ children: <Widget>[
new AnimatedPositioned( new AnimatedPositioned(
child: new Container(key: key), child: new Container(key: key),
left: 37.0, left: 37.0,
...@@ -77,7 +77,7 @@ void main() { ...@@ -77,7 +77,7 @@ void main() {
tester.pumpWidget( tester.pumpWidget(
new Stack( new Stack(
<Widget>[ children: <Widget>[
new AnimatedPositioned( new AnimatedPositioned(
child: new Container(key: key), child: new Container(key: key),
left: 0.0, left: 0.0,
...@@ -100,7 +100,7 @@ void main() { ...@@ -100,7 +100,7 @@ void main() {
tester.pumpWidget( tester.pumpWidget(
new Stack( new Stack(
<Widget>[ children: <Widget>[
new AnimatedPositioned( new AnimatedPositioned(
child: new Container(key: key), child: new Container(key: key),
left: 100.0, left: 100.0,
...@@ -123,7 +123,7 @@ void main() { ...@@ -123,7 +123,7 @@ void main() {
tester.pumpWidget( tester.pumpWidget(
new Stack( new Stack(
<Widget>[ children: <Widget>[
new AnimatedPositioned( new AnimatedPositioned(
child: new Container(key: key), child: new Container(key: key),
left: 150.0, left: 150.0,
...@@ -160,7 +160,7 @@ void main() { ...@@ -160,7 +160,7 @@ void main() {
tester.pumpWidget( tester.pumpWidget(
new Stack( new Stack(
<Widget>[ children: <Widget>[
new AnimatedPositioned( new AnimatedPositioned(
child: new Container(key: key), child: new Container(key: key),
left: 0.0, left: 0.0,
...@@ -183,7 +183,7 @@ void main() { ...@@ -183,7 +183,7 @@ void main() {
tester.pumpWidget( tester.pumpWidget(
new Stack( new Stack(
<Widget>[ children: <Widget>[
new AnimatedPositioned( new AnimatedPositioned(
child: new Container(key: key), child: new Container(key: key),
left: 0.0, left: 0.0,
......
...@@ -14,26 +14,28 @@ void main() { ...@@ -14,26 +14,28 @@ void main() {
Key keyB = new GlobalKey(); Key keyB = new GlobalKey();
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
top: 100.0, new Positioned(
left: 100.0, top: 100.0,
child: new SizedBox( left: 100.0,
key: keyA, child: new SizedBox(
width: 10.0, key: keyA,
height: 10.0 width: 10.0,
) height: 10.0
), )
new Positioned( ),
left: 100.0, new Positioned(
top: 200.0, left: 100.0,
child: new SizedBox( top: 200.0,
key: keyB, child: new SizedBox(
width: 20.0, key: keyB,
height: 10.0 width: 20.0,
) height: 10.0
), )
]) ),
]
)
); );
expect((tester.findElementByKey(keyA).renderObject as RenderBox).localToGlobal(const Point(0.0, 0.0)), expect((tester.findElementByKey(keyA).renderObject as RenderBox).localToGlobal(const Point(0.0, 0.0)),
......
...@@ -41,7 +41,8 @@ class TestMultiChildLayoutDelegate extends MultiChildLayoutDelegate { ...@@ -41,7 +41,8 @@ class TestMultiChildLayoutDelegate extends MultiChildLayoutDelegate {
Widget buildFrame(MultiChildLayoutDelegate delegate) { Widget buildFrame(MultiChildLayoutDelegate delegate) {
return new Center( return new Center(
child: new CustomMultiChildLayout([ child: new CustomMultiChildLayout(
children: <Widget>[
new LayoutId(id: 0, child: new Container(width: 150.0, height: 100.0)), new LayoutId(id: 0, child: new Container(width: 150.0, height: 100.0)),
new LayoutId(id: 1, child: new Container(width: 100.0, height: 200.0)), new LayoutId(id: 1, child: new Container(width: 100.0, height: 200.0)),
], ],
...@@ -105,16 +106,22 @@ void main() { ...@@ -105,16 +106,22 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
TestMultiChildLayoutDelegate delegate = new TestMultiChildLayoutDelegate(); TestMultiChildLayoutDelegate delegate = new TestMultiChildLayoutDelegate();
tester.pumpWidget(new Center( tester.pumpWidget(new Center(
child: new CustomMultiChildLayout([ child: new CustomMultiChildLayout(
new LayoutId( children: <Widget>[
id: 0, new LayoutId(
child: new CustomMultiChildLayout([ id: 0,
new LayoutId(id: 0, child: new Container(width: 150.0, height: 100.0)), child: new CustomMultiChildLayout(
new LayoutId(id: 1, child: new Container(width: 100.0, height: 200.0)), children: <Widget>[
], delegate: delegate) new LayoutId(id: 0, child: new Container(width: 150.0, height: 100.0)),
), new LayoutId(id: 1, child: new Container(width: 100.0, height: 200.0)),
new LayoutId(id: 1, child: new Container(width: 100.0, height: 200.0)), ],
], delegate: delegate) delegate: delegate
)
),
new LayoutId(id: 1, child: new Container(width: 100.0, height: 200.0)),
],
delegate: delegate
)
)); ));
}); });
......
...@@ -274,10 +274,12 @@ void main() { ...@@ -274,10 +274,12 @@ void main() {
child: new Container( child: new Container(
width: 100.0, width: 100.0,
height: 1000.0, height: 1000.0,
child: new Column(<Widget>[ child: new Column(
new Test1215DismissableComponent('1'), children: <Widget>[
new Test1215DismissableComponent('2') new Test1215DismissableComponent('1'),
]) new Test1215DismissableComponent('2')
]
)
) )
)); ));
expect(tester.findText('1'), isNotNull); expect(tester.findText('1'), isNotNull);
......
...@@ -15,7 +15,8 @@ void main() { ...@@ -15,7 +15,8 @@ void main() {
tester.pumpWidget(new MaterialApp( tester.pumpWidget(new MaterialApp(
routes: <String, RouteBuilder>{ routes: <String, RouteBuilder>{
'/': (RouteArguments args) { return new Column(<Widget>[ '/': (RouteArguments args) { return new Column(
children: <Widget>[
new Draggable( new Draggable(
data: 1, data: 1,
child: new Text('Source'), child: new Text('Source'),
......
...@@ -37,10 +37,12 @@ class KeyedWrapper extends StatelessComponent { ...@@ -37,10 +37,12 @@ class KeyedWrapper extends StatelessComponent {
} }
Widget builder() { Widget builder() {
return new Column(<Widget>[ return new Column(
new KeyedWrapper(items[1].key1, items[1].key2), children: <Widget>[
new KeyedWrapper(items[0].key1, items[0].key2) new KeyedWrapper(items[1].key1, items[1].key2),
]); new KeyedWrapper(items[0].key1, items[0].key2)
]
);
} }
void main() { void main() {
......
...@@ -16,29 +16,33 @@ void main() { ...@@ -16,29 +16,33 @@ void main() {
decoration: const BoxDecoration( decoration: const BoxDecoration(
backgroundColor: const Color(0xFF00FF00) backgroundColor: const Color(0xFF00FF00)
), ),
child: new Stack(<Widget>[ child: new Stack(
new Positioned( children: <Widget>[
top: 10.0, new Positioned(
left: 10.0, top: 10.0,
child: new Column(<Widget>[ left: 10.0,
new GestureDetector( child: new Column(
onTap: () { children: <Widget>[
didReceiveTap = true; new GestureDetector(
}, onTap: () {
child: new Container( didReceiveTap = true;
decoration: const BoxDecoration( },
backgroundColor: const Color(0xFF0000FF) child: new Container(
), decoration: const BoxDecoration(
width: 100.0, backgroundColor: const Color(0xFF0000FF)
height: 100.0, ),
child: new Center( width: 100.0,
child: new Text('X') height: 100.0,
child: new Center(
child: new Text('X')
)
)
) )
) ]
) )
]) )
) ]
]) )
) )
); );
...@@ -53,10 +57,11 @@ void main() { ...@@ -53,10 +57,11 @@ void main() {
// Row without justifyContent: FlexJustifyContent.collapse // Row without justifyContent: FlexJustifyContent.collapse
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget(new Center( tester.pumpWidget(new Center(
child: new Row([ child: new Row(
new Container(width: 10.0, height: 100.0), children: <Widget>[
new Container(width: 30.0, height: 100.0) new Container(width: 10.0, height: 100.0),
], new Container(width: 30.0, height: 100.0)
],
key: flexKey key: flexKey
) )
)); ));
...@@ -66,10 +71,11 @@ void main() { ...@@ -66,10 +71,11 @@ void main() {
// Row with justifyContent: FlexJustifyContent.collapse // Row with justifyContent: FlexJustifyContent.collapse
tester.pumpWidget(new Center( tester.pumpWidget(new Center(
child: new Row([ child: new Row(
new Container(width: 10.0, height: 100.0), children: <Widget>[
new Container(width: 30.0, height: 100.0) new Container(width: 10.0, height: 100.0),
], new Container(width: 30.0, height: 100.0)
],
key: flexKey, key: flexKey,
justifyContent: FlexJustifyContent.collapse justifyContent: FlexJustifyContent.collapse
) )
...@@ -82,10 +88,11 @@ void main() { ...@@ -82,10 +88,11 @@ void main() {
// Column without justifyContent: FlexJustifyContent.collapse // Column without justifyContent: FlexJustifyContent.collapse
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget(new Center( tester.pumpWidget(new Center(
child: new Column([ child: new Column(
new Container(width: 100.0, height: 100.0), children: <Widget>[
new Container(width: 100.0, height: 150.0) new Container(width: 100.0, height: 100.0),
], new Container(width: 100.0, height: 150.0)
],
key: flexKey key: flexKey
) )
)); ));
...@@ -95,10 +102,11 @@ void main() { ...@@ -95,10 +102,11 @@ void main() {
// Column with justifyContent: FlexJustifyContent.collapse // Column with justifyContent: FlexJustifyContent.collapse
tester.pumpWidget(new Center( tester.pumpWidget(new Center(
child: new Column([ child: new Column(
new Container(width: 100.0, height: 100.0), children: <Widget>[
new Container(width: 100.0, height: 150.0) new Container(width: 100.0, height: 100.0),
], new Container(width: 100.0, height: 150.0)
],
key: flexKey, key: flexKey,
justifyContent: FlexJustifyContent.collapse justifyContent: FlexJustifyContent.collapse
) )
...@@ -117,12 +125,15 @@ void main() { ...@@ -117,12 +125,15 @@ void main() {
child: new Container( child: new Container(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
child: new Column([ child: new Column(
new Container( children: <Widget>[
key: childKey, new Container(
width: 100.0, key: childKey,
height: 100.0 width: 100.0,
)], justifyContent: FlexJustifyContent.collapse height: 100.0
)
],
justifyContent: FlexJustifyContent.collapse
) )
) )
)); ));
...@@ -135,12 +146,15 @@ void main() { ...@@ -135,12 +146,15 @@ void main() {
child: new Container( child: new Container(
width: 0.0, width: 0.0,
height: 0.0, height: 0.0,
child: new Row([ child: new Row(
new Container( children: <Widget>[
key: childKey, new Container(
width: 100.0, key: childKey,
height: 100.0 width: 100.0,
)], justifyContent: FlexJustifyContent.collapse height: 100.0
)
],
justifyContent: FlexJustifyContent.collapse
) )
) )
)); ));
......
...@@ -26,11 +26,13 @@ void main() { ...@@ -26,11 +26,13 @@ void main() {
GlobalKey keyB = new GlobalKey(); GlobalKey keyB = new GlobalKey();
tester.pumpWidget( tester.pumpWidget(
new Focus( new Focus(
child: new Column(<Widget>[ child: new Column(
// reverse these when you fix https://github.com/flutter/engine/issues/1495 children: <Widget>[
new TestFocusable('b', 'B FOCUSED', keyB), // reverse these when you fix https://github.com/flutter/engine/issues/1495
new TestFocusable('a', 'A FOCUSED', keyA), new TestFocusable('b', 'B FOCUSED', keyB),
]) new TestFocusable('a', 'A FOCUSED', keyA),
]
)
) )
); );
expect(tester.findText('a'), isNull); expect(tester.findText('a'), isNull);
......
...@@ -144,30 +144,32 @@ void main() { ...@@ -144,30 +144,32 @@ void main() {
void pumpWidgetTree(HitTestBehavior behavior) { void pumpWidgetTree(HitTestBehavior behavior) {
tester.pumpWidget( tester.pumpWidget(
new Stack([ new Stack(
new Listener( children: <Widget>[
onPointerDown: (_) { new Listener(
didReceivePointerDown = true; onPointerDown: (_) {
}, didReceivePointerDown = true;
child: new Container( },
child: new Container(
width: 100.0,
height: 100.0,
decoration: const BoxDecoration(
backgroundColor: const Color(0xFF00FF00)
)
)
),
new Container(
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: const BoxDecoration( child: new GestureDetector(
backgroundColor: const Color(0xFF00FF00) onTap: () {
didTap = true;
},
behavior: behavior
) )
) )
), ]
new Container( )
width: 100.0,
height: 100.0,
child: new GestureDetector(
onTap: () {
didTap = true;
},
behavior: behavior
)
)
])
); );
} }
......
...@@ -76,18 +76,20 @@ void main() { ...@@ -76,18 +76,20 @@ void main() {
key: insideKey, key: insideKey,
builder: (BuildContext context) { builder: (BuildContext context) {
PageRoute route = ModalRoute.of(context); PageRoute route = ModalRoute.of(context);
return new Column([ return new Column(
new TestTransition( children: <Widget>[
childFirstHalf: new Text('A'), new TestTransition(
childSecondHalf: new Text('B'), childFirstHalf: new Text('A'),
performance: route.performance childSecondHalf: new Text('B'),
), performance: route.performance
new TestTransition( ),
childFirstHalf: new Text('C'), new TestTransition(
childSecondHalf: new Text('D'), childFirstHalf: new Text('C'),
performance: route.forwardPerformance childSecondHalf: new Text('D'),
), performance: route.forwardPerformance
]); ),
]
);
} }
) )
); );
......
...@@ -65,15 +65,17 @@ void main() { ...@@ -65,15 +65,17 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new DecoratedBox(decoration: kBoxDecorationA), children: <Widget>[
new Positioned( new DecoratedBox(decoration: kBoxDecorationA),
top: 10.0, new Positioned(
left: 10.0, top: 10.0,
child: new DecoratedBox(decoration: kBoxDecorationB) left: 10.0,
), child: new DecoratedBox(decoration: kBoxDecorationB)
new DecoratedBox(decoration: kBoxDecorationC), ),
]) new DecoratedBox(decoration: kBoxDecorationC),
]
)
); );
checkTree(tester, <TestParentData>[ checkTree(tester, <TestParentData>[
...@@ -83,19 +85,21 @@ void main() { ...@@ -83,19 +85,21 @@ void main() {
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
bottom: 5.0, new Positioned(
right: 7.0, bottom: 5.0,
child: new DecoratedBox(decoration: kBoxDecorationA) right: 7.0,
), child: new DecoratedBox(decoration: kBoxDecorationA)
new Positioned( ),
top: 10.0, new Positioned(
left: 10.0, top: 10.0,
child: new DecoratedBox(decoration: kBoxDecorationB) left: 10.0,
), child: new DecoratedBox(decoration: kBoxDecorationB)
new DecoratedBox(decoration: kBoxDecorationC), ),
]) new DecoratedBox(decoration: kBoxDecorationC),
]
)
); );
checkTree(tester, <TestParentData>[ checkTree(tester, <TestParentData>[
...@@ -109,19 +113,21 @@ void main() { ...@@ -109,19 +113,21 @@ void main() {
DecoratedBox kDecoratedBoxC = new DecoratedBox(decoration: kBoxDecorationC); DecoratedBox kDecoratedBoxC = new DecoratedBox(decoration: kBoxDecorationC);
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
bottom: 5.0, new Positioned(
right: 7.0, bottom: 5.0,
child: kDecoratedBoxA right: 7.0,
), child: kDecoratedBoxA
new Positioned( ),
top: 10.0, new Positioned(
left: 10.0, top: 10.0,
child: kDecoratedBoxB left: 10.0,
), child: kDecoratedBoxB
kDecoratedBoxC, ),
]) kDecoratedBoxC,
]
)
); );
checkTree(tester, <TestParentData>[ checkTree(tester, <TestParentData>[
...@@ -131,19 +137,21 @@ void main() { ...@@ -131,19 +137,21 @@ void main() {
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
bottom: 6.0, new Positioned(
right: 8.0, bottom: 6.0,
child: kDecoratedBoxA right: 8.0,
), child: kDecoratedBoxA
new Positioned( ),
left: 10.0, new Positioned(
right: 10.0, left: 10.0,
child: kDecoratedBoxB right: 10.0,
), child: kDecoratedBoxB
kDecoratedBoxC, ),
]) kDecoratedBoxC,
]
)
); );
checkTree(tester, <TestParentData>[ checkTree(tester, <TestParentData>[
...@@ -153,15 +161,17 @@ void main() { ...@@ -153,15 +161,17 @@ void main() {
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
kDecoratedBoxA, children: <Widget>[
new Positioned( kDecoratedBoxA,
left: 11.0, new Positioned(
right: 12.0, left: 11.0,
child: new Container(child: kDecoratedBoxB) right: 12.0,
), child: new Container(child: kDecoratedBoxB)
kDecoratedBoxC, ),
]) kDecoratedBoxC,
]
)
); );
checkTree(tester, <TestParentData>[ checkTree(tester, <TestParentData>[
...@@ -171,19 +181,21 @@ void main() { ...@@ -171,19 +181,21 @@ void main() {
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
kDecoratedBoxA, children: <Widget>[
new Positioned( kDecoratedBoxA,
right: 10.0, new Positioned(
child: new Container(child: kDecoratedBoxB) right: 10.0,
), child: new Container(child: kDecoratedBoxB)
new Container( ),
child: new Positioned( new Container(
top: 8.0, child: new Positioned(
child: kDecoratedBoxC top: 8.0,
child: kDecoratedBoxC
)
) )
) ]
]) )
); );
checkTree(tester, <TestParentData>[ checkTree(tester, <TestParentData>[
...@@ -193,12 +205,14 @@ void main() { ...@@ -193,12 +205,14 @@ void main() {
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
right: 10.0, new Positioned(
child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB) right: 10.0,
), child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB)
]) ),
]
)
); );
checkTree(tester, <TestParentData>[ checkTree(tester, <TestParentData>[
...@@ -213,12 +227,14 @@ void main() { ...@@ -213,12 +227,14 @@ void main() {
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
top: 7.0, new Positioned(
child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB) top: 7.0,
), child: new FlipComponent(left: kDecoratedBoxA, right: kDecoratedBoxB)
]) ),
]
)
); );
checkTree(tester, <TestParentData>[ checkTree(tester, <TestParentData>[
...@@ -233,7 +249,7 @@ void main() { ...@@ -233,7 +249,7 @@ void main() {
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[]) new Stack()
); );
checkTree(tester, <TestParentData>[]); checkTree(tester, <TestParentData>[]);
...@@ -245,36 +261,40 @@ void main() { ...@@ -245,36 +261,40 @@ void main() {
expect(cachedException, isNull); expect(cachedException, isNull);
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
top: 5.0, new Positioned(
bottom: 8.0, top: 5.0,
child: new Positioned( bottom: 8.0,
top: 6.0, child: new Positioned(
left: 7.0, top: 6.0,
child: new DecoratedBox(decoration: kBoxDecorationB) left: 7.0,
child: new DecoratedBox(decoration: kBoxDecorationB)
)
) )
) ]
]) )
); );
expect(cachedException, isNotNull); expect(cachedException, isNotNull);
cachedException = null; cachedException = null;
tester.pumpWidget(new Stack(<Widget>[])); tester.pumpWidget(new Stack());
checkTree(tester, <TestParentData>[]); checkTree(tester, <TestParentData>[]);
expect(cachedException, isNull); expect(cachedException, isNull);
tester.pumpWidget( tester.pumpWidget(
new Container( new Container(
child: new Flex(<Widget>[ child: new Flex(
new Positioned( children: <Widget>[
top: 6.0, new Positioned(
left: 7.0, top: 6.0,
child: new DecoratedBox(decoration: kBoxDecorationB) left: 7.0,
) child: new DecoratedBox(decoration: kBoxDecorationB)
]) )
]
)
) )
); );
...@@ -282,7 +302,7 @@ void main() { ...@@ -282,7 +302,7 @@ void main() {
cachedException = null; cachedException = null;
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[]) new Stack()
); );
checkTree(tester, <TestParentData>[]); checkTree(tester, <TestParentData>[]);
...@@ -294,13 +314,15 @@ void main() { ...@@ -294,13 +314,15 @@ void main() {
GlobalKey key = new GlobalKey(); GlobalKey key = new GlobalKey();
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
top: 10.0, new Positioned(
left: 10.0, top: 10.0,
child: new DecoratedBox(key: key, decoration: kBoxDecorationA) left: 10.0,
) child: new DecoratedBox(key: key, decoration: kBoxDecorationA)
]) )
]
)
); );
checkTree(tester, <TestParentData>[ checkTree(tester, <TestParentData>[
...@@ -308,16 +330,18 @@ void main() { ...@@ -308,16 +330,18 @@ void main() {
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
top: 10.0, new Positioned(
left: 10.0, top: 10.0,
child: new DecoratedBox( left: 10.0,
decoration: kBoxDecorationB, child: new DecoratedBox(
child: new DecoratedBox(key: key, decoration: kBoxDecorationA) decoration: kBoxDecorationB,
child: new DecoratedBox(key: key, decoration: kBoxDecorationA)
)
) )
) ]
]) )
); );
checkTree(tester, <TestParentData>[ checkTree(tester, <TestParentData>[
...@@ -325,13 +349,15 @@ void main() { ...@@ -325,13 +349,15 @@ void main() {
]); ]);
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
top: 10.0, new Positioned(
left: 10.0, top: 10.0,
child: new DecoratedBox(key: key, decoration: kBoxDecorationA) left: 10.0,
) child: new DecoratedBox(key: key, decoration: kBoxDecorationA)
]) )
]
)
); );
checkTree(tester, <TestParentData>[ checkTree(tester, <TestParentData>[
......
...@@ -43,15 +43,17 @@ void main() { ...@@ -43,15 +43,17 @@ void main() {
child: new Container( child: new Container(
height: 100.0, height: 100.0,
width: 100.0, width: 100.0,
child: new Stack(<Widget>[ child: new Stack(
new PositionedTransition( children: <Widget>[
rect: rect, new PositionedTransition(
performance: performance, rect: rect,
child: new Container( performance: performance,
key: key child: new Container(
key: key
)
) )
) ]
]) )
) )
) )
); // t=0 ); // t=0
......
...@@ -32,17 +32,19 @@ void main() { ...@@ -32,17 +32,19 @@ void main() {
StateMarker grandchild = new StateMarker(); StateMarker grandchild = new StateMarker();
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Container( children: <Widget>[
child: new StateMarker(key: left) new Container(
), child: new StateMarker(key: left)
new Container( ),
child: new StateMarker( new Container(
key: right, child: new StateMarker(
child: grandchild key: right,
) child: grandchild
), )
]) ),
]
)
); );
(left.currentState as StateMarkerState).marker = "left"; (left.currentState as StateMarkerState).marker = "left";
...@@ -54,17 +56,19 @@ void main() { ...@@ -54,17 +56,19 @@ void main() {
StateMarker newGrandchild = new StateMarker(); StateMarker newGrandchild = new StateMarker();
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Container( children: <Widget>[
child: new StateMarker( new Container(
key: right, child: new StateMarker(
child: newGrandchild key: right,
) child: newGrandchild
), )
new Container( ),
child: new StateMarker(key: left) new Container(
), child: new StateMarker(key: left)
]) ),
]
)
); );
expect((left.currentState as StateMarkerState).marker, equals("left")); expect((left.currentState as StateMarkerState).marker, equals("left"));
......
...@@ -12,13 +12,13 @@ import '../rendering/rendering_tester.dart'; ...@@ -12,13 +12,13 @@ import '../rendering/rendering_tester.dart';
void main() { void main() {
test('Can construct an empty Stack', () { test('Can construct an empty Stack', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget(new Stack(<Widget>[])); tester.pumpWidget(new Stack());
}); });
}); });
test('Can construct an empty Centered Stack', () { test('Can construct an empty Centered Stack', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget(new Center(child: new Stack(<Widget>[]))); tester.pumpWidget(new Center(child: new Stack()));
}); });
}); });
...@@ -27,16 +27,18 @@ void main() { ...@@ -27,16 +27,18 @@ void main() {
Key key = new Key('container'); Key key = new Key('container');
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
left: 10.0, new Positioned(
child: new Container( left: 10.0,
key: key, child: new Container(
width: 10.0, key: key,
height: 10.0 width: 10.0,
height: 10.0
)
) )
) ]
]) )
); );
Element container; Element container;
...@@ -52,16 +54,18 @@ void main() { ...@@ -52,16 +54,18 @@ void main() {
expect(parentData.height, isNull); expect(parentData.height, isNull);
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
right: 10.0, new Positioned(
child: new Container( right: 10.0,
key: key, child: new Container(
width: 10.0, key: key,
height: 10.0 width: 10.0,
height: 10.0
)
) )
) ]
]) )
); );
container = tester.findElementByKey(key); container = tester.findElementByKey(key);
...@@ -80,7 +84,7 @@ void main() { ...@@ -80,7 +84,7 @@ void main() {
Key key = new Key('container'); Key key = new Key('container');
Container container = new Container(key: key, width: 10.0, height: 10.0); Container container = new Container(key: key, width: 10.0, height: 10.0);
tester.pumpWidget(new Stack(<Widget>[ new Positioned(left: 10.0, child: container) ])); tester.pumpWidget(new Stack(children: <Widget>[ new Positioned(left: 10.0, child: container) ]));
Element containerElement = tester.findElementByKey(key); Element containerElement = tester.findElementByKey(key);
StackParentData parentData; StackParentData parentData;
...@@ -92,7 +96,7 @@ void main() { ...@@ -92,7 +96,7 @@ void main() {
expect(parentData.width, isNull); expect(parentData.width, isNull);
expect(parentData.height, isNull); expect(parentData.height, isNull);
tester.pumpWidget(new Stack(<Widget>[ container ])); tester.pumpWidget(new Stack(children: <Widget>[ container ]));
containerElement = tester.findElementByKey(key); containerElement = tester.findElementByKey(key);
parentData = containerElement.renderObject.parentData; parentData = containerElement.renderObject.parentData;
...@@ -112,7 +116,8 @@ void main() { ...@@ -112,7 +116,8 @@ void main() {
tester.pumpWidget( tester.pumpWidget(
new Center( new Center(
child: new Stack(<Widget>[ child: new Stack(
children: <Widget>[
new Container(key: child0Key, width: 20.0, height: 20.0), new Container(key: child0Key, width: 20.0, height: 20.0),
new Container(key: child1Key, width: 10.0, height: 10.0) new Container(key: child1Key, width: 10.0, height: 10.0)
], ],
...@@ -133,13 +138,13 @@ void main() { ...@@ -133,13 +138,13 @@ void main() {
test('Can construct an empty IndexedStack', () { test('Can construct an empty IndexedStack', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget(new IndexedStack(<Widget>[])); tester.pumpWidget(new IndexedStack());
}); });
}); });
test('Can construct an empty Centered IndexedStack', () { test('Can construct an empty Centered IndexedStack', () {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
tester.pumpWidget(new Center(child: new IndexedStack(<Widget>[]))); tester.pumpWidget(new Center(child: new IndexedStack()));
}); });
}); });
...@@ -158,7 +163,7 @@ void main() { ...@@ -158,7 +163,7 @@ void main() {
) )
); );
}); });
return new Center(child: new IndexedStack(items, index: index)); return new Center(child: new IndexedStack(children: items, index: index));
} }
tester.pumpWidget(buildFrame(0)); tester.pumpWidget(buildFrame(0));
...@@ -186,7 +191,7 @@ void main() { ...@@ -186,7 +191,7 @@ void main() {
List<Widget> items = new List<Widget>.generate(itemCount, (i) { List<Widget> items = new List<Widget>.generate(itemCount, (i) {
return new GestureDetector(child: new Text('$i'), onTap: () { itemsTapped.add(i); }); return new GestureDetector(child: new Text('$i'), onTap: () { itemsTapped.add(i); });
}); });
return new Center(child: new IndexedStack(items, key: key, index: index)); return new Center(child: new IndexedStack(children: items, key: key, index: index));
} }
tester.pumpWidget(buildFrame(0)); tester.pumpWidget(buildFrame(0));
...@@ -210,14 +215,16 @@ void main() { ...@@ -210,14 +215,16 @@ void main() {
); );
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
left: 10.0, new Positioned(
width: 11.0, left: 10.0,
height: 12.0, width: 11.0,
child: new DecoratedBox(key: key, decoration: kBoxDecoration) height: 12.0,
) child: new DecoratedBox(key: key, decoration: kBoxDecoration)
]) )
]
)
); );
Element box; Element box;
...@@ -239,14 +246,16 @@ void main() { ...@@ -239,14 +246,16 @@ void main() {
expect(renderBox.size.height, equals(12.0)); expect(renderBox.size.height, equals(12.0));
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
right: 10.0, new Positioned(
width: 11.0, right: 10.0,
height: 12.0, width: 11.0,
child: new DecoratedBox(key: key, decoration: kBoxDecoration) height: 12.0,
) child: new DecoratedBox(key: key, decoration: kBoxDecoration)
]) )
]
)
); );
box = tester.findElementByKey(key); box = tester.findElementByKey(key);
......
...@@ -115,22 +115,24 @@ void main() { ...@@ -115,22 +115,24 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
Widget a = new TestWidget(persistentState: 0x61, syncedState: 0x41, child: new Text('apple')); Widget a = new TestWidget(persistentState: 0x61, syncedState: 0x41, child: new Text('apple'));
Widget b = new TestWidget(persistentState: 0x62, syncedState: 0x42, child: new Text('banana')); Widget b = new TestWidget(persistentState: 0x62, syncedState: 0x42, child: new Text('banana'));
tester.pumpWidget(new Column(<Widget>[])); tester.pumpWidget(new Column());
GlobalKey keyA = new GlobalKey(); GlobalKey keyA = new GlobalKey();
GlobalKey keyB = new GlobalKey(); GlobalKey keyB = new GlobalKey();
tester.pumpWidget( tester.pumpWidget(
new Column(<Widget>[ new Column(
new Container( children: <Widget>[
key: keyA, new Container(
child: a key: keyA,
), child: a
new Container( ),
key: keyB, new Container(
child: b key: keyB,
) child: b
]) )
]
)
); );
TestWidgetState first, second; TestWidgetState first, second;
...@@ -146,16 +148,18 @@ void main() { ...@@ -146,16 +148,18 @@ void main() {
expect(second.syncedState, equals(0x42)); expect(second.syncedState, equals(0x42));
tester.pumpWidget( tester.pumpWidget(
new Column(<Widget>[ new Column(
new Container( children: <Widget>[
key: keyA, new Container(
child: a key: keyA,
), child: a
new Container( ),
key: keyB, new Container(
child: b key: keyB,
) child: b
]) )
]
)
); );
first = tester.findStateByConfig(a); first = tester.findStateByConfig(a);
...@@ -173,16 +177,18 @@ void main() { ...@@ -173,16 +177,18 @@ void main() {
// since they are both "old" nodes, they shouldn't sync with each other even though they look alike // since they are both "old" nodes, they shouldn't sync with each other even though they look alike
tester.pumpWidget( tester.pumpWidget(
new Column(<Widget>[ new Column(
new Container( children: <Widget>[
key: keyA, new Container(
child: b key: keyA,
), child: b
new Container( ),
key: keyB, new Container(
child: a key: keyB,
) child: a
]) )
]
)
); );
first = tester.findStateByConfig(b); first = tester.findStateByConfig(b);
......
...@@ -11,41 +11,43 @@ void main() { ...@@ -11,41 +11,43 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
bool didReceiveTap = false; bool didReceiveTap = false;
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
top: 100.0, new Positioned(
left: 100.0, top: 100.0,
child: new Container( left: 100.0,
width: 100.0, child: new Container(
height: 100.0, width: 100.0,
decoration: new BoxDecoration( height: 100.0,
backgroundColor: new Color(0xFF0000FF) decoration: new BoxDecoration(
backgroundColor: new Color(0xFF0000FF)
)
) )
) ),
), new Positioned(
new Positioned( top: 100.0,
top: 100.0, left: 100.0,
left: 100.0, child: new Container(
child: new Container( width: 100.0,
width: 100.0, height: 100.0,
height: 100.0, child: new Transform(
child: new Transform( transform: new Matrix4.identity().scale(0.5, 0.5),
transform: new Matrix4.identity().scale(0.5, 0.5), origin: new Offset(100.0, 50.0),
origin: new Offset(100.0, 50.0), child: new GestureDetector(
child: new GestureDetector( onTap: () {
onTap: () { didReceiveTap = true;
didReceiveTap = true; },
}, child: new Container(
child: new Container( decoration: new BoxDecoration(
decoration: new BoxDecoration( backgroundColor: new Color(0xFF00FFFF)
backgroundColor: new Color(0xFF00FFFF) )
) )
) )
) )
) )
) )
) ]
]) )
); );
expect(didReceiveTap, isFalse); expect(didReceiveTap, isFalse);
...@@ -60,41 +62,43 @@ void main() { ...@@ -60,41 +62,43 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
bool didReceiveTap = false; bool didReceiveTap = false;
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
top: 100.0, new Positioned(
left: 100.0, top: 100.0,
child: new Container( left: 100.0,
width: 100.0, child: new Container(
height: 100.0, width: 100.0,
decoration: new BoxDecoration( height: 100.0,
backgroundColor: new Color(0xFF0000FF) decoration: new BoxDecoration(
backgroundColor: new Color(0xFF0000FF)
)
) )
) ),
), new Positioned(
new Positioned( top: 100.0,
top: 100.0, left: 100.0,
left: 100.0, child: new Container(
child: new Container( width: 100.0,
width: 100.0, height: 100.0,
height: 100.0, child: new Transform(
child: new Transform( transform: new Matrix4.identity().scale(0.5, 0.5),
transform: new Matrix4.identity().scale(0.5, 0.5), alignment: new FractionalOffset(1.0, 0.5),
alignment: new FractionalOffset(1.0, 0.5), child: new GestureDetector(
child: new GestureDetector( onTap: () {
onTap: () { didReceiveTap = true;
didReceiveTap = true; },
}, child: new Container(
child: new Container( decoration: new BoxDecoration(
decoration: new BoxDecoration( backgroundColor: new Color(0xFF00FFFF)
backgroundColor: new Color(0xFF00FFFF) )
) )
) )
) )
) )
) )
) ]
]) )
); );
expect(didReceiveTap, isFalse); expect(didReceiveTap, isFalse);
...@@ -109,42 +113,44 @@ void main() { ...@@ -109,42 +113,44 @@ void main() {
testWidgets((WidgetTester tester) { testWidgets((WidgetTester tester) {
bool didReceiveTap = false; bool didReceiveTap = false;
tester.pumpWidget( tester.pumpWidget(
new Stack(<Widget>[ new Stack(
new Positioned( children: <Widget>[
top: 100.0, new Positioned(
left: 100.0, top: 100.0,
child: new Container( left: 100.0,
width: 100.0, child: new Container(
height: 100.0, width: 100.0,
decoration: new BoxDecoration( height: 100.0,
backgroundColor: new Color(0xFF0000FF) decoration: new BoxDecoration(
backgroundColor: new Color(0xFF0000FF)
)
) )
) ),
), new Positioned(
new Positioned( top: 100.0,
top: 100.0, left: 100.0,
left: 100.0, child: new Container(
child: new Container( width: 100.0,
width: 100.0, height: 100.0,
height: 100.0, child: new Transform(
child: new Transform( transform: new Matrix4.identity().scale(0.5, 0.5),
transform: new Matrix4.identity().scale(0.5, 0.5), origin: new Offset(100.0, 0.0),
origin: new Offset(100.0, 0.0), alignment: new FractionalOffset(0.0, 0.5),
alignment: new FractionalOffset(0.0, 0.5), child: new GestureDetector(
child: new GestureDetector( onTap: () {
onTap: () { didReceiveTap = true;
didReceiveTap = true; },
}, child: new Container(
child: new Container( decoration: new BoxDecoration(
decoration: new BoxDecoration( backgroundColor: new Color(0xFF00FFFF)
backgroundColor: new Color(0xFF00FFFF) )
) )
) )
) )
) )
) )
) ]
]) )
); );
expect(didReceiveTap, isFalse); expect(didReceiveTap, isFalse);
......
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