Use ScrollView in examples a manual_tests (#7645)
This patch deploys ScrollView in a number of demos and manual tests.
diff --git a/dev/benchmarks/complex_layout/lib/main.dart b/dev/benchmarks/complex_layout/lib/main.dart
index c63c593..5acfece 100644
--- a/dev/benchmarks/complex_layout/lib/main.dart
+++ b/dev/benchmarks/complex_layout/lib/main.dart
@@ -589,7 +589,7 @@
@override
Widget build(BuildContext context) {
return new Drawer(
- child: new Block(
+ child: new ScrollView(
children: <Widget>[
new FancyDrawerHeader(),
new DrawerItem(
diff --git a/dev/manual_tests/card_collection.dart b/dev/manual_tests/card_collection.dart
index e02e96d..aa3c0e8 100644
--- a/dev/manual_tests/card_collection.dart
+++ b/dev/manual_tests/card_collection.dart
@@ -123,33 +123,35 @@
return new Drawer(
child: new IconTheme(
data: const IconThemeData(color: Colors.black),
- child: new Block(children: <Widget>[
- new DrawerHeader(child: new Center(child: new Text('Options'))),
- buildDrawerCheckbox("Make card labels editable", _editable, _toggleEditable),
- buildDrawerCheckbox("Snap fling scrolls to center", _snapToCenter, _toggleSnapToCenter),
- buildDrawerCheckbox("Fixed size cards", _fixedSizeCards, _toggleFixedSizeCards),
- buildDrawerCheckbox("Let the sun shine", _sunshine, _toggleSunshine),
- buildDrawerCheckbox("Vary font sizes", _varyFontSizes, _toggleVaryFontSizes, enabled: !_editable),
- new Divider(),
- buildDrawerColorRadioItem("Deep Purple", Colors.deepPurple, _primaryColor, _selectColor),
- buildDrawerColorRadioItem("Green", Colors.green, _primaryColor, _selectColor),
- buildDrawerColorRadioItem("Amber", Colors.amber, _primaryColor, _selectColor),
- buildDrawerColorRadioItem("Teal", Colors.teal, _primaryColor, _selectColor),
- new Divider(),
- buildDrawerDirectionRadioItem("Dismiss horizontally", DismissDirection.horizontal, _dismissDirection, _changeDismissDirection, icon: Icons.code),
- buildDrawerDirectionRadioItem("Dismiss left", DismissDirection.endToStart, _dismissDirection, _changeDismissDirection, icon: Icons.arrow_back),
- buildDrawerDirectionRadioItem("Dismiss right", DismissDirection.startToEnd, _dismissDirection, _changeDismissDirection, icon: Icons.arrow_forward),
- new Divider(),
- buildFontRadioItem("Left-align text", TextAlign.left, _textAlign, _changeTextAlign, icon: Icons.format_align_left, enabled: !_editable),
- buildFontRadioItem("Center-align text", TextAlign.center, _textAlign, _changeTextAlign, icon: Icons.format_align_center, enabled: !_editable),
- buildFontRadioItem("Right-align text", TextAlign.right, _textAlign, _changeTextAlign, icon: Icons.format_align_right, enabled: !_editable),
- new Divider(),
- new DrawerItem(
- icon: new Icon(Icons.dvr),
- onPressed: () { debugDumpApp(); debugDumpRenderTree(); },
- child: new Text('Dump App to Console')
- ),
- ])
+ child: new ScrollView(
+ children: <Widget>[
+ new DrawerHeader(child: new Center(child: new Text('Options'))),
+ buildDrawerCheckbox("Make card labels editable", _editable, _toggleEditable),
+ buildDrawerCheckbox("Snap fling scrolls to center", _snapToCenter, _toggleSnapToCenter),
+ buildDrawerCheckbox("Fixed size cards", _fixedSizeCards, _toggleFixedSizeCards),
+ buildDrawerCheckbox("Let the sun shine", _sunshine, _toggleSunshine),
+ buildDrawerCheckbox("Vary font sizes", _varyFontSizes, _toggleVaryFontSizes, enabled: !_editable),
+ new Divider(),
+ buildDrawerColorRadioItem("Deep Purple", Colors.deepPurple, _primaryColor, _selectColor),
+ buildDrawerColorRadioItem("Green", Colors.green, _primaryColor, _selectColor),
+ buildDrawerColorRadioItem("Amber", Colors.amber, _primaryColor, _selectColor),
+ buildDrawerColorRadioItem("Teal", Colors.teal, _primaryColor, _selectColor),
+ new Divider(),
+ buildDrawerDirectionRadioItem("Dismiss horizontally", DismissDirection.horizontal, _dismissDirection, _changeDismissDirection, icon: Icons.code),
+ buildDrawerDirectionRadioItem("Dismiss left", DismissDirection.endToStart, _dismissDirection, _changeDismissDirection, icon: Icons.arrow_back),
+ buildDrawerDirectionRadioItem("Dismiss right", DismissDirection.startToEnd, _dismissDirection, _changeDismissDirection, icon: Icons.arrow_forward),
+ new Divider(),
+ buildFontRadioItem("Left-align text", TextAlign.left, _textAlign, _changeTextAlign, icon: Icons.format_align_left, enabled: !_editable),
+ buildFontRadioItem("Center-align text", TextAlign.center, _textAlign, _changeTextAlign, icon: Icons.format_align_center, enabled: !_editable),
+ buildFontRadioItem("Right-align text", TextAlign.right, _textAlign, _changeTextAlign, icon: Icons.format_align_right, enabled: !_editable),
+ new Divider(),
+ new DrawerItem(
+ icon: new Icon(Icons.dvr),
+ onPressed: () { debugDumpApp(); debugDumpRenderTree(); },
+ child: new Text('Dump App to Console')
+ ),
+ ]
+ )
)
);
}
diff --git a/dev/manual_tests/pageable_list.dart b/dev/manual_tests/pageable_list.dart
index 2547fa1..80954ca 100644
--- a/dev/manual_tests/pageable_list.dart
+++ b/dev/manual_tests/pageable_list.dart
@@ -84,31 +84,33 @@
Widget _buildDrawer() {
return new Drawer(
- child: new Block(children: <Widget>[
- new DrawerHeader(child: new Center(child: new Text('Options'))),
- new DrawerItem(
- icon: new Icon(Icons.more_horiz),
- selected: scrollDirection == Axis.horizontal,
- child: new Text('Horizontal Layout'),
- onPressed: switchScrollDirection
- ),
- new DrawerItem(
- icon: new Icon(Icons.more_vert),
- selected: scrollDirection == Axis.vertical,
- child: new Text('Vertical Layout'),
- onPressed: switchScrollDirection
- ),
- new DrawerItem(
- onPressed: toggleItemsWrap,
- child: new Row(
- children: <Widget>[
- new Expanded(child: new Text('Scrolling wraps around')),
- // TODO(abarth): Actually make this checkbox change this value.
- new Checkbox(value: itemsWrap, onChanged: null)
- ]
+ child: new ScrollView(
+ children: <Widget>[
+ new DrawerHeader(child: new Center(child: new Text('Options'))),
+ new DrawerItem(
+ icon: new Icon(Icons.more_horiz),
+ selected: scrollDirection == Axis.horizontal,
+ child: new Text('Horizontal Layout'),
+ onPressed: switchScrollDirection
+ ),
+ new DrawerItem(
+ icon: new Icon(Icons.more_vert),
+ selected: scrollDirection == Axis.vertical,
+ child: new Text('Vertical Layout'),
+ onPressed: switchScrollDirection
+ ),
+ new DrawerItem(
+ onPressed: toggleItemsWrap,
+ child: new Row(
+ children: <Widget>[
+ new Expanded(child: new Text('Scrolling wraps around')),
+ // TODO(abarth): Actually make this checkbox change this value.
+ new Checkbox(value: itemsWrap, onChanged: null)
+ ]
+ )
)
- )
- ])
+ ]
+ )
);
}
diff --git a/examples/flutter_gallery/lib/demo/chip_demo.dart b/examples/flutter_gallery/lib/demo/chip_demo.dart
index 08b2ae8..118f874 100644
--- a/examples/flutter_gallery/lib/demo/chip_demo.dart
+++ b/examples/flutter_gallery/lib/demo/chip_demo.dart
@@ -41,7 +41,7 @@
return new Scaffold(
appBar: new AppBar(title: new Text('Chips')),
- body: new Block(
+ body: new ScrollView(
children: chips.map((Widget widget) {
return new Container(
height: 100.0,
diff --git a/examples/flutter_gallery/lib/demo/drawer_demo.dart b/examples/flutter_gallery/lib/demo/drawer_demo.dart
index caae261..68e9732 100644
--- a/examples/flutter_gallery/lib/demo/drawer_demo.dart
+++ b/examples/flutter_gallery/lib/demo/drawer_demo.dart
@@ -88,7 +88,7 @@
title: new Text('Navigation drawer'),
),
drawer: new Drawer(
- child: new Block(
+ child: new ScrollView(
children: <Widget>[
new UserAccountsDrawerHeader(
accountName: new Text('Zach Widget'),
diff --git a/examples/flutter_gallery/lib/demo/leave_behind_demo.dart b/examples/flutter_gallery/lib/demo/leave_behind_demo.dart
index 1849bff..704f8fe 100644
--- a/examples/flutter_gallery/lib/demo/leave_behind_demo.dart
+++ b/examples/flutter_gallery/lib/demo/leave_behind_demo.dart
@@ -161,7 +161,7 @@
)
]
),
- body: new Block(
+ body: new ScrollView(
children: leaveBehindItems.map(buildItem).toList()
)
);
diff --git a/examples/flutter_gallery/lib/demo/snack_bar_demo.dart b/examples/flutter_gallery/lib/demo/snack_bar_demo.dart
index d89aa36..c6b7839 100644
--- a/examples/flutter_gallery/lib/demo/snack_bar_demo.dart
+++ b/examples/flutter_gallery/lib/demo/snack_bar_demo.dart
@@ -29,41 +29,39 @@
int _snackBarIndex = 1;
Widget buildBody(BuildContext context) {
- return new Padding(
+ return new Block(
padding: const EdgeInsets.all(24.0),
- child: new Block(
- children: <Widget>[
- new Text(_text1),
- new Text(_text2),
- new Center(
- child: new RaisedButton(
- child: new Text('SHOW A SNACKBAR'),
- onPressed: () {
- final int thisSnackBarIndex = _snackBarIndex++;
- Scaffold.of(context).showSnackBar(new SnackBar(
- content: new Text('This is snackbar #$thisSnackBarIndex.'),
- action: new SnackBarAction(
- label: 'ACTION',
- onPressed: () {
- Scaffold.of(context).showSnackBar(new SnackBar(
- content: new Text('You pressed snackbar $thisSnackBarIndex\'s action.')
- ));
- }
- )
- ));
- }
- )
- ),
- new Text(_text3),
- ]
- .map((Widget child) {
- return new Container(
- margin: const EdgeInsets.symmetric(vertical: 12.0),
- child: child
- );
- })
- .toList()
- )
+ children: <Widget>[
+ new Text(_text1),
+ new Text(_text2),
+ new Center(
+ child: new RaisedButton(
+ child: new Text('SHOW A SNACKBAR'),
+ onPressed: () {
+ final int thisSnackBarIndex = _snackBarIndex++;
+ Scaffold.of(context).showSnackBar(new SnackBar(
+ content: new Text('This is snackbar #$thisSnackBarIndex.'),
+ action: new SnackBarAction(
+ label: 'ACTION',
+ onPressed: () {
+ Scaffold.of(context).showSnackBar(new SnackBar(
+ content: new Text('You pressed snackbar $thisSnackBarIndex\'s action.')
+ ));
+ }
+ )
+ ));
+ }
+ )
+ ),
+ new Text(_text3),
+ ]
+ .map((Widget child) {
+ return new Container(
+ margin: const EdgeInsets.symmetric(vertical: 12.0),
+ child: child
+ );
+ })
+ .toList()
);
}
diff --git a/examples/flutter_gallery/lib/demo/tooltip_demo.dart b/examples/flutter_gallery/lib/demo/tooltip_demo.dart
index 7522c6f..d264fcd 100644
--- a/examples/flutter_gallery/lib/demo/tooltip_demo.dart
+++ b/examples/flutter_gallery/lib/demo/tooltip_demo.dart
@@ -22,7 +22,7 @@
),
body: new Builder(
builder: (BuildContext context) {
- return new Block(
+ return new ScrollView(
children: <Widget>[
new Text(_introText, style: theme.textTheme.subhead),
new Row(
diff --git a/examples/flutter_gallery/lib/demo/typography_demo.dart b/examples/flutter_gallery/lib/demo/typography_demo.dart
index 52d2dab..2daa1a8 100644
--- a/examples/flutter_gallery/lib/demo/typography_demo.dart
+++ b/examples/flutter_gallery/lib/demo/typography_demo.dart
@@ -66,7 +66,7 @@
return new Scaffold(
appBar: new AppBar(title: new Text('Typography')),
- body: new Block(children: styleItems)
+ body: new ScrollView(children: styleItems)
);
}
}
diff --git a/examples/flutter_gallery/lib/gallery/drawer.dart b/examples/flutter_gallery/lib/gallery/drawer.dart
index 41c3bd3..280b488 100644
--- a/examples/flutter_gallery/lib/gallery/drawer.dart
+++ b/examples/flutter_gallery/lib/gallery/drawer.dart
@@ -305,6 +305,6 @@
));
}
- return new Drawer(child: new Block(children: allDrawerItems));
+ return new Drawer(child: new ScrollView(children: allDrawerItems));
}
}
diff --git a/examples/stocks/lib/stock_home.dart b/examples/stocks/lib/stock_home.dart
index 3419ac6..e3fcdb5 100644
--- a/examples/stocks/lib/stock_home.dart
+++ b/examples/stocks/lib/stock_home.dart
@@ -121,63 +121,65 @@
Widget _buildDrawer(BuildContext context) {
return new Drawer(
- child: new Block(children: <Widget>[
- new DrawerHeader(child: new Center(child: new Text('Stocks'))),
- new DrawerItem(
- icon: new Icon(Icons.assessment),
- selected: true,
- child: new Text('Stock List')
- ),
- new DrawerItem(
- icon: new Icon(Icons.account_balance),
- onPressed: null,
- child: new Text('Account Balance')
- ),
- new DrawerItem(
- icon: new Icon(Icons.dvr),
- onPressed: () {
- try {
- debugDumpApp();
- debugDumpRenderTree();
- debugDumpLayerTree();
- debugDumpSemanticsTree();
- } catch (e, stack) {
- debugPrint('Exception while dumping app:\n$e\n$stack');
- }
- },
- child: new Text('Dump App to Console')
- ),
- new Divider(),
- new DrawerItem(
- icon: new Icon(Icons.thumb_up),
- onPressed: () => _handleStockModeChange(StockMode.optimistic),
- child: new Row(
- children: <Widget>[
- new Expanded(child: new Text('Optimistic')),
- new Radio<StockMode>(value: StockMode.optimistic, groupValue: config.configuration.stockMode, onChanged: _handleStockModeChange)
- ]
- )
- ),
- new DrawerItem(
- icon: new Icon(Icons.thumb_down),
- onPressed: () => _handleStockModeChange(StockMode.pessimistic),
- child: new Row(
- children: <Widget>[
- new Expanded(child: new Text('Pessimistic')),
- new Radio<StockMode>(value: StockMode.pessimistic, groupValue: config.configuration.stockMode, onChanged: _handleStockModeChange)
- ]
- )
- ),
- new Divider(),
- new DrawerItem(
- icon: new Icon(Icons.settings),
- onPressed: _handleShowSettings,
- child: new Text('Settings')),
- new DrawerItem(
- icon: new Icon(Icons.help),
- onPressed: _handleShowAbout,
- child: new Text('About'))
- ])
+ child: new ScrollView(
+ children: <Widget>[
+ new DrawerHeader(child: new Center(child: new Text('Stocks'))),
+ new DrawerItem(
+ icon: new Icon(Icons.assessment),
+ selected: true,
+ child: new Text('Stock List')
+ ),
+ new DrawerItem(
+ icon: new Icon(Icons.account_balance),
+ onPressed: null,
+ child: new Text('Account Balance')
+ ),
+ new DrawerItem(
+ icon: new Icon(Icons.dvr),
+ onPressed: () {
+ try {
+ debugDumpApp();
+ debugDumpRenderTree();
+ debugDumpLayerTree();
+ debugDumpSemanticsTree();
+ } catch (e, stack) {
+ debugPrint('Exception while dumping app:\n$e\n$stack');
+ }
+ },
+ child: new Text('Dump App to Console')
+ ),
+ new Divider(),
+ new DrawerItem(
+ icon: new Icon(Icons.thumb_up),
+ onPressed: () => _handleStockModeChange(StockMode.optimistic),
+ child: new Row(
+ children: <Widget>[
+ new Expanded(child: new Text('Optimistic')),
+ new Radio<StockMode>(value: StockMode.optimistic, groupValue: config.configuration.stockMode, onChanged: _handleStockModeChange)
+ ]
+ )
+ ),
+ new DrawerItem(
+ icon: new Icon(Icons.thumb_down),
+ onPressed: () => _handleStockModeChange(StockMode.pessimistic),
+ child: new Row(
+ children: <Widget>[
+ new Expanded(child: new Text('Pessimistic')),
+ new Radio<StockMode>(value: StockMode.pessimistic, groupValue: config.configuration.stockMode, onChanged: _handleStockModeChange)
+ ]
+ )
+ ),
+ new Divider(),
+ new DrawerItem(
+ icon: new Icon(Icons.settings),
+ onPressed: _handleShowSettings,
+ child: new Text('Settings')),
+ new DrawerItem(
+ icon: new Icon(Icons.help),
+ onPressed: _handleShowAbout,
+ child: new Text('About'))
+ ]
+ )
);
}
diff --git a/examples/stocks/lib/stock_settings.dart b/examples/stocks/lib/stock_settings.dart
index 5b61d6a..32d4c06 100644
--- a/examples/stocks/lib/stock_settings.dart
+++ b/examples/stocks/lib/stock_settings.dart
@@ -241,8 +241,8 @@
return true;
});
return new Block(
+ padding: const EdgeInsets.symmetric(vertical: 20.0),
children: rows,
- padding: const EdgeInsets.symmetric(vertical: 20.0)
);
}
diff --git a/examples/stocks/lib/stock_symbol_viewer.dart b/examples/stocks/lib/stock_symbol_viewer.dart
index 0dd10aa..0b12771 100644
--- a/examples/stocks/lib/stock_symbol_viewer.dart
+++ b/examples/stocks/lib/stock_symbol_viewer.dart
@@ -73,22 +73,20 @@
appBar: new AppBar(
title: new Text(stock.name)
),
- body: new Block(
- children: <Widget>[
- new Container(
- margin: new EdgeInsets.all(20.0),
- child: new Card(
- child: new _StockSymbolView(
- stock: stock,
- arrow: new Hero(
- tag: stock,
- turns: 2,
- child: new StockArrow(percentChange: stock.percentChange)
- )
+ body: new SingleChildScrollView(
+ child: new Container(
+ margin: new EdgeInsets.all(20.0),
+ child: new Card(
+ child: new _StockSymbolView(
+ stock: stock,
+ arrow: new Hero(
+ tag: stock,
+ turns: 2,
+ child: new StockArrow(percentChange: stock.percentChange)
)
)
)
- ]
+ )
)
);
}
diff --git a/packages/flutter/bin/loader/loader_app.dart b/packages/flutter/bin/loader/loader_app.dart
index 32f17c2..e2df8ad 100644
--- a/packages/flutter/bin/loader/loader_app.dart
+++ b/packages/flutter/bin/loader/loader_app.dart
@@ -39,7 +39,7 @@
children.add(const SizedBox(height: 18.0));
children.add(new Center(child: new CircularProgressIndicator(value: progressMax > 0 ? progress / progressMax : null)));
}
- return new Block(children: children);
+ return new ScrollView(children: children);
},
),
),
@@ -114,4 +114,4 @@
}
);
}
-}
\ No newline at end of file
+}