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
ac2f62a9
Unverified
Commit
ac2f62a9
authored
Jan 14, 2021
by
Pedro Massango
Committed by
GitHub
Jan 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide a way to change the default PopupMenuButton's icon size (#68000)
parent
737824db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
popup_menu.dart
packages/flutter/lib/src/material/popup_menu.dart
+7
-0
popup_menu_test.dart
packages/flutter/test/material/popup_menu_test.dart
+28
-0
No files found.
packages/flutter/lib/src/material/popup_menu.dart
View file @
ac2f62a9
...
...
@@ -949,6 +949,7 @@ class PopupMenuButton<T> extends StatefulWidget {
this
.
padding
=
const
EdgeInsets
.
all
(
8.0
),
this
.
child
,
this
.
icon
,
this
.
iconSize
,
this
.
offset
=
Offset
.
zero
,
this
.
enabled
=
true
,
this
.
shape
,
...
...
@@ -1048,6 +1049,11 @@ class PopupMenuButton<T> extends StatefulWidget {
/// * [Feedback] for providing platform-specific feedback to certain actions.
final
bool
?
enableFeedback
;
/// If provided, the size of the [Icon].
///
/// If this property is null, the default size is 24.0 pixels.
final
double
?
iconSize
;
@override
PopupMenuButtonState
<
T
>
createState
()
=>
PopupMenuButtonState
<
T
>();
}
...
...
@@ -1134,6 +1140,7 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
return
IconButton
(
icon:
widget
.
icon
??
Icon
(
Icons
.
adaptive
.
more
),
padding:
widget
.
padding
,
iconSize:
widget
.
iconSize
??
24.0
,
tooltip:
widget
.
tooltip
??
MaterialLocalizations
.
of
(
context
).
showMenuTooltip
,
onPressed:
widget
.
enabled
?
showButtonMenu
:
null
,
enableFeedback:
enableFeedback
,
...
...
packages/flutter/test/material/popup_menu_test.dart
View file @
ac2f62a9
...
...
@@ -1876,6 +1876,34 @@ void main() {
expect
(
feedback
.
hapticCount
,
0
);
});
});
testWidgets
(
'iconSize parameter tests'
,
(
WidgetTester
tester
)
async
{
Future
<
void
>
buildFrame
({
double
?
iconSize
})
{
return
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Center
(
child:
PopupMenuButton
<
String
>(
iconSize:
iconSize
,
itemBuilder:
(
_
)
=>
<
PopupMenuEntry
<
String
>>[
const
PopupMenuItem
<
String
>(
value:
'value'
,
child:
Text
(
'child'
),
),
],
),
),
),
),
);
}
await
buildFrame
();
expect
(
tester
.
widget
<
IconButton
>(
find
.
byType
(
IconButton
)).
iconSize
,
24
);
await
buildFrame
(
iconSize:
50
);
expect
(
tester
.
widget
<
IconButton
>(
find
.
byType
(
IconButton
)).
iconSize
,
50
);
});
}
class
TestApp
extends
StatefulWidget
{
...
...
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