Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
13e7c017
Commit
13e7c017
authored
Mar 03, 2016
by
Hans Muller
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2372 from HansMuller/menu_item
Add type parameters to uses of PopupMenuItem
parents
8af3dde3
f1659e4f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
33 deletions
+38
-33
grid_list_demo.dart
examples/material_gallery/lib/demo/grid_list_demo.dart
+4
-4
menu_demo.dart
examples/material_gallery/lib/demo/menu_demo.dart
+21
-20
stock_home.dart
examples/stocks/lib/stock_home.dart
+5
-5
indexed_stack.dart
examples/widgets/indexed_stack.dart
+8
-4
No files found.
examples/material_gallery/lib/demo/grid_list_demo.dart
View file @
13e7c017
...
...
@@ -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'
)
)
...
...
examples/material_gallery/lib/demo/menu_demo.dart
View file @
13e7c017
...
...
@@ -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
)
...
...
examples/stocks/lib/stock_home.dart
View file @
13e7c017
...
...
@@ -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'
)
)
...
...
examples/widgets/indexed_stack.dart
View file @
13e7c017
...
...
@@ -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'
)),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment