Use ScrollView in examples a manual_tests (#7645)
This patch deploys ScrollView in a number of demos and manual tests.
This commit is contained in:
@@ -41,7 +41,7 @@ class _ChipDemoState extends State<ChipDemo> {
|
||||
|
||||
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,
|
||||
|
||||
@@ -88,7 +88,7 @@ class _DrawerDemoState extends State<DrawerDemo> with TickerProviderStateMixin {
|
||||
title: new Text('Navigation drawer'),
|
||||
),
|
||||
drawer: new Drawer(
|
||||
child: new Block(
|
||||
child: new ScrollView(
|
||||
children: <Widget>[
|
||||
new UserAccountsDrawerHeader(
|
||||
accountName: new Text('Zach Widget'),
|
||||
|
||||
@@ -161,7 +161,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
|
||||
)
|
||||
]
|
||||
),
|
||||
body: new Block(
|
||||
body: new ScrollView(
|
||||
children: leaveBehindItems.map(buildItem).toList()
|
||||
)
|
||||
);
|
||||
|
||||
@@ -29,41 +29,39 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
|
||||
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()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class TooltipDemo extends StatelessWidget {
|
||||
),
|
||||
body: new Builder(
|
||||
builder: (BuildContext context) {
|
||||
return new Block(
|
||||
return new ScrollView(
|
||||
children: <Widget>[
|
||||
new Text(_introText, style: theme.textTheme.subhead),
|
||||
new Row(
|
||||
|
||||
@@ -66,7 +66,7 @@ class TypographyDemo extends StatelessWidget {
|
||||
|
||||
return new Scaffold(
|
||||
appBar: new AppBar(title: new Text('Typography')),
|
||||
body: new Block(children: styleItems)
|
||||
body: new ScrollView(children: styleItems)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,6 +305,6 @@ class GalleryDrawer extends StatelessWidget {
|
||||
));
|
||||
}
|
||||
|
||||
return new Drawer(child: new Block(children: allDrawerItems));
|
||||
return new Drawer(child: new ScrollView(children: allDrawerItems));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,63 +121,65 @@ class StockHomeState extends State<StockHome> {
|
||||
|
||||
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'))
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -241,8 +241,8 @@ class StockSettingsState extends State<StockSettings> {
|
||||
return true;
|
||||
});
|
||||
return new Block(
|
||||
padding: const EdgeInsets.symmetric(vertical: 20.0),
|
||||
children: rows,
|
||||
padding: const EdgeInsets.symmetric(vertical: 20.0)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,22 +73,20 @@ class StockSymbolPage extends StatelessWidget {
|
||||
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)
|
||||
)
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user