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
790ca116
Unverified
Commit
790ca116
authored
Jan 26, 2022
by
Aliaksei Chorny
Committed by
GitHub
Jan 26, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add splashRadius to PopupMenuButton (#91148)
parent
10658266
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
0 deletions
+65
-0
popup_menu.dart
packages/flutter/lib/src/material/popup_menu.dart
+8
-0
popup_menu_test.dart
packages/flutter/test/material/popup_menu_test.dart
+57
-0
No files found.
packages/flutter/lib/src/material/popup_menu.dart
View file @
790ca116
...
...
@@ -985,6 +985,7 @@ class PopupMenuButton<T> extends StatefulWidget {
this
.
elevation
,
this
.
padding
=
const
EdgeInsets
.
all
(
8.0
),
this
.
child
,
this
.
splashRadius
,
this
.
icon
,
this
.
iconSize
,
this
.
offset
=
Offset
.
zero
,
...
...
@@ -1035,6 +1036,11 @@ class PopupMenuButton<T> extends StatefulWidget {
/// to set the padding to zero.
final
EdgeInsetsGeometry
padding
;
/// The splash radius.
///
/// If null, default splash radius of [InkWell] or [IconButton] is used.
final
double
?
splashRadius
;
/// If provided, [child] is the widget used for this button
/// and the button will utilize an [InkWell] for taps.
final
Widget
?
child
;
...
...
@@ -1169,6 +1175,7 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
child:
InkWell
(
onTap:
widget
.
enabled
?
showButtonMenu
:
null
,
canRequestFocus:
_canRequestFocus
,
radius:
widget
.
splashRadius
,
enableFeedback:
enableFeedback
,
child:
widget
.
child
,
),
...
...
@@ -1177,6 +1184,7 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
return
IconButton
(
icon:
widget
.
icon
??
Icon
(
Icons
.
adaptive
.
more
),
padding:
widget
.
padding
,
splashRadius:
widget
.
splashRadius
,
iconSize:
widget
.
iconSize
??
24.0
,
tooltip:
widget
.
tooltip
??
MaterialLocalizations
.
of
(
context
).
showMenuTooltip
,
onPressed:
widget
.
enabled
?
showButtonMenu
:
null
,
...
...
packages/flutter/test/material/popup_menu_test.dart
View file @
790ca116
...
...
@@ -2479,6 +2479,63 @@ void main() {
// The 8.0 pixels is [_kMenuScreenPadding].
expect
(
popupMenu
,
const
Offset
(
8.0
,
50.0
));
});
testWidgets
(
'PopupMenuButton custom splash radius'
,
(
WidgetTester
tester
)
async
{
Future
<
void
>
buildFrameWithoutChild
({
double
?
splashRadius
})
{
return
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Center
(
child:
PopupMenuButton
<
String
>(
splashRadius:
splashRadius
,
itemBuilder:
(
_
)
=>
<
PopupMenuEntry
<
String
>>[
const
PopupMenuItem
<
String
>(
value:
'value'
,
child:
Text
(
'child'
),
),
],
),
),
),
),
);
}
Future
<
void
>
buildFrameWithChild
({
double
?
splashRadius
})
{
return
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Center
(
child:
PopupMenuButton
<
String
>(
splashRadius:
splashRadius
,
child:
const
Text
(
'An item'
),
itemBuilder:
(
_
)
=>
<
PopupMenuEntry
<
String
>>[
const
PopupMenuDivider
()
],
),
),
),
),
);
}
await
buildFrameWithoutChild
();
expect
(
tester
.
widget
<
InkResponse
>(
find
.
byType
(
InkResponse
)).
radius
,
Material
.
defaultSplashRadius
);
await
buildFrameWithChild
();
expect
(
tester
.
widget
<
InkWell
>(
find
.
byType
(
InkWell
)).
radius
,
null
);
const
double
testSplashRadius
=
50
;
await
buildFrameWithoutChild
(
splashRadius:
testSplashRadius
);
expect
(
tester
.
widget
<
InkResponse
>(
find
.
byType
(
InkResponse
)).
radius
,
testSplashRadius
);
await
buildFrameWithChild
(
splashRadius:
testSplashRadius
);
expect
(
tester
.
widget
<
InkWell
>(
find
.
byType
(
InkWell
)).
radius
,
testSplashRadius
);
});
}
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