more type parameters

This commit is contained in:
Hans Muller
2016-03-03 10:18:46 -08:00
parent 8af3dde3af
commit f1659e4f7a
4 changed files with 38 additions and 33 deletions

View File

@@ -19,18 +19,22 @@ class IndexedStackDemoState extends State<IndexedStackDemo> {
});
}
List<PopupMenuItem> _buildMenu() {
List<PopupMenuItem<int>> _buildMenu() {
TextStyle style = const TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold);
String pad = '';
return new List<PopupMenuItem>.generate(_itemCount, (int i) {
pad += '-';
return new PopupMenuItem(value: i, child: new Text('$pad Hello World $i $pad', style: style));
return new PopupMenuItem<int>(value: i, child: new Text('$pad Hello World $i $pad', style: style));
});
}
Widget build(BuildContext context) {
List<PopupMenuItem> items = _buildMenu();
IndexedStack indexedStack = new IndexedStack(children: items, index: _itemIndex, alignment: const FractionalOffset(0.5, 0.0));
List<PopupMenuItem<int>> items = _buildMenu();
IndexedStack indexedStack = new IndexedStack(
children: items,
index: _itemIndex,
alignment: const FractionalOffset(0.5, 0.0)
);
return new Scaffold(
toolBar: new ToolBar(center: new Text('IndexedStackDemo Demo')),