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
531870f5
Unverified
Commit
531870f5
authored
Feb 10, 2021
by
Michael Goderbauer
Committed by
GitHub
Feb 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix constraints of popupmenu (#75748)
parent
3e89f242
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
3 deletions
+41
-3
popup_menu.dart
packages/flutter/lib/src/material/popup_menu.dart
+1
-3
popup_menu_test.dart
packages/flutter/test/material/popup_menu_test.dart
+40
-0
No files found.
packages/flutter/lib/src/material/popup_menu.dart
View file @
531870f5
...
...
@@ -623,9 +623,7 @@ class _PopupMenuRouteLayout extends SingleChildLayoutDelegate {
BoxConstraints
getConstraintsForChild
(
BoxConstraints
constraints
)
{
// The menu can be at most the size of the overlay minus 8.0 pixels in each
// direction.
return
BoxConstraints
.
loose
(
constraints
.
biggest
-
const
Offset
(
_kMenuScreenPadding
*
2.0
,
_kMenuScreenPadding
*
2.0
)
as
Size
,
);
return
BoxConstraints
.
loose
(
constraints
.
biggest
).
deflate
(
const
EdgeInsets
.
all
(
_kMenuScreenPadding
));
}
@override
...
...
packages/flutter/test/material/popup_menu_test.dart
View file @
531870f5
...
...
@@ -1915,6 +1915,46 @@ void main() {
await
buildFrame
(
iconSize:
50
);
expect
(
tester
.
widget
<
IconButton
>(
find
.
byType
(
IconButton
)).
iconSize
,
50
);
});
testWidgets
(
'does not crash in small overlay'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
navigator
=
GlobalKey
();
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Column
(
children:
<
Widget
>[
OutlinedButton
(
onPressed:
()
{
showMenu
<
void
>(
context:
navigator
.
currentContext
!,
position:
const
RelativeRect
.
fromLTRB
(
0
,
0
,
0
,
0
),
items:
const
<
PopupMenuItem
<
void
>>[
PopupMenuItem
<
void
>(
child:
Text
(
'foo'
)),
],
);
},
child:
const
Text
(
'press'
),
),
SizedBox
(
height:
10
,
width:
10
,
child:
Navigator
(
key:
navigator
,
onGenerateRoute:
(
RouteSettings
settings
)
=>
MaterialPageRoute
<
void
>(
builder:
(
BuildContext
context
)
=>
Container
(
color:
Colors
.
red
),
),
),
),
],
),
),
),
);
await
tester
.
tap
(
find
.
text
(
'press'
));
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'foo'
),
findsOneWidget
);
});
}
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