more type parameters
This commit is contained in:
parent
8af3dde3af
commit
f1659e4f7a
@ -138,16 +138,16 @@ class GridListDemoState extends State<GridListDemo> {
|
||||
GridDemoTileStyle tileStyle = GridDemoTileStyle.twoLine;
|
||||
|
||||
void showTileStyleMenu(BuildContext context) {
|
||||
final List<PopupMenuItem> items = <PopupMenuItem>[
|
||||
new PopupMenuItem(
|
||||
final List<PopupMenuItem> items = <PopupMenuItem<GridDemoTileStyle>>[
|
||||
new PopupMenuItem<GridDemoTileStyle>(
|
||||
value: GridDemoTileStyle.imageOnly,
|
||||
child: new Text('Image only')
|
||||
),
|
||||
new PopupMenuItem(
|
||||
new PopupMenuItem<GridDemoTileStyle>(
|
||||
value: GridDemoTileStyle.oneLine,
|
||||
child: new Text('One line')
|
||||
),
|
||||
new PopupMenuItem(
|
||||
new PopupMenuItem<GridDemoTileStyle>(
|
||||
value: GridDemoTileStyle.twoLine,
|
||||
child: new Text('Two line')
|
||||
)
|
||||
|
@ -61,16 +61,16 @@ class MenuDemoState extends State<MenuDemo> {
|
||||
right: <Widget>[
|
||||
new PopupMenuButton<String>(
|
||||
onSelected: showMenuSelection,
|
||||
items: <PopupMenuItem>[
|
||||
new PopupMenuItem(
|
||||
items: <PopupMenuItem<String>>[
|
||||
new PopupMenuItem<String>(
|
||||
value: 'ToolBar Menu',
|
||||
child: new Text('ToolBar Menu')
|
||||
),
|
||||
new PopupMenuItem(
|
||||
new PopupMenuItem<String>(
|
||||
value: 'Right Here',
|
||||
child: new Text('Right Here')
|
||||
),
|
||||
new PopupMenuItem(
|
||||
new PopupMenuItem<String>(
|
||||
value: 'Hooray!',
|
||||
child: new Text('Hooray!')
|
||||
),
|
||||
@ -88,16 +88,16 @@ class MenuDemoState extends State<MenuDemo> {
|
||||
primary: new Text('An item with a context menu button'),
|
||||
right: new PopupMenuButton<String>(
|
||||
onSelected: showMenuSelection,
|
||||
items: <PopupMenuItem>[
|
||||
new PopupMenuItem(
|
||||
items: <PopupMenuItem<String>>[
|
||||
new PopupMenuItem<String>(
|
||||
value: _simpleValue1,
|
||||
child: new Text('Context menu item one')
|
||||
),
|
||||
new PopupMenuItem(
|
||||
new PopupMenuItem<String>(
|
||||
enabled: false,
|
||||
child: new Text('A disabled menu item')
|
||||
),
|
||||
new PopupMenuItem(
|
||||
new PopupMenuItem<String>(
|
||||
value: _simpleValue3,
|
||||
child: new Text('Context menu item three')
|
||||
),
|
||||
@ -112,21 +112,21 @@ class MenuDemoState extends State<MenuDemo> {
|
||||
right: new PopupMenuButton<String>(
|
||||
onSelected: showMenuSelection,
|
||||
items: <PopupMenuEntry<String>>[
|
||||
new PopupMenuItem(
|
||||
new PopupMenuItem<String>(
|
||||
value: 'Preview',
|
||||
child: new ListItem(
|
||||
left: new Icon(icon: Icons.visibility),
|
||||
primary: new Text('Preview')
|
||||
)
|
||||
),
|
||||
new PopupMenuItem(
|
||||
new PopupMenuItem<String>(
|
||||
value: 'Share',
|
||||
child: new ListItem(
|
||||
left: new Icon(icon: Icons.person_add),
|
||||
primary: new Text('Share')
|
||||
)
|
||||
),
|
||||
new PopupMenuItem(
|
||||
new PopupMenuItem<String>(
|
||||
value: 'Get Link',
|
||||
child: new ListItem(
|
||||
left: new Icon(icon: Icons.link),
|
||||
@ -134,7 +134,7 @@ class MenuDemoState extends State<MenuDemo> {
|
||||
)
|
||||
),
|
||||
new PopupMenuDivider(),
|
||||
new PopupMenuItem(
|
||||
new PopupMenuItem<String>(
|
||||
value: 'Remove',
|
||||
child: new ListItem(
|
||||
left: new Icon(icon: Icons.delete),
|
||||
@ -154,16 +154,16 @@ class MenuDemoState extends State<MenuDemo> {
|
||||
primary: new Text('An item with a simple menu'),
|
||||
secondary: new Text(_simpleValue)
|
||||
),
|
||||
items: <PopupMenuItem>[
|
||||
new PopupMenuItem(
|
||||
items: <PopupMenuItem<String>>[
|
||||
new PopupMenuItem<String>(
|
||||
value: _simpleValue1,
|
||||
child: new Text(_simpleValue1)
|
||||
),
|
||||
new PopupMenuItem(
|
||||
new PopupMenuItem<String>(
|
||||
value: _simpleValue2,
|
||||
child: new Text(_simpleValue2)
|
||||
),
|
||||
new PopupMenuItem(
|
||||
new PopupMenuItem<String>(
|
||||
value: _simpleValue3,
|
||||
child: new Text(_simpleValue3)
|
||||
)
|
||||
@ -175,23 +175,24 @@ class MenuDemoState extends State<MenuDemo> {
|
||||
primary: new Text('An item with a checklist menu'),
|
||||
right: new PopupMenuButton<String>(
|
||||
onSelected: showCheckedMenuSelections,
|
||||
items: <PopupMenuItem>[
|
||||
items: <PopupMenuItem<String>>[
|
||||
new CheckedPopupMenuItem(
|
||||
value: _checkedValue1,
|
||||
checked: isChecked(_checkedValue1),
|
||||
child: new Text(_checkedValue1)
|
||||
),
|
||||
new CheckedPopupMenuItem(
|
||||
new CheckedPopupMenuItem<String>(
|
||||
value: _checkedValue2,
|
||||
enabled: false,
|
||||
checked: isChecked(_checkedValue2),
|
||||
child: new Text(_checkedValue2)
|
||||
),
|
||||
new CheckedPopupMenuItem(
|
||||
new CheckedPopupMenuItem<String>(
|
||||
value: _checkedValue3,
|
||||
checked: isChecked(_checkedValue3),
|
||||
child: new Text(_checkedValue3)
|
||||
),
|
||||
new CheckedPopupMenuItem(
|
||||
new CheckedPopupMenuItem<String>(
|
||||
value: _checkedValue4,
|
||||
checked: isChecked(_checkedValue4),
|
||||
child: new Text(_checkedValue4)
|
||||
|
@ -218,21 +218,21 @@ class StockHomeState extends State<StockHome> {
|
||||
),
|
||||
new PopupMenuButton<_StockMenuItem>(
|
||||
onSelected: (_StockMenuItem value) { _handleStockMenu(context, value); },
|
||||
items: <PopupMenuItem>[
|
||||
new CheckedPopupMenuItem(
|
||||
items: <PopupMenuItem<_StockMenuItem>>[
|
||||
new CheckedPopupMenuItem<_StockMenuItem>(
|
||||
value: _StockMenuItem.autorefresh,
|
||||
checked: _autorefresh,
|
||||
child: new Text('Autorefresh')
|
||||
),
|
||||
new PopupMenuItem(
|
||||
new PopupMenuItem<_StockMenuItem>(
|
||||
value: _StockMenuItem.refresh,
|
||||
child: new Text('Refresh')
|
||||
),
|
||||
new PopupMenuItem(
|
||||
new PopupMenuItem<_StockMenuItem>(
|
||||
value: _StockMenuItem.speedUp,
|
||||
child: new Text('Increase animation speed')
|
||||
),
|
||||
new PopupMenuItem(
|
||||
new PopupMenuItem<_StockMenuItem>(
|
||||
value: _StockMenuItem.speedDown,
|
||||
child: new Text('Decrease animation speed')
|
||||
)
|
||||
|
@ -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')),
|
||||
|
Loading…
x
Reference in New Issue
Block a user