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
8ed704d8
Unverified
Commit
8ed704d8
authored
Sep 27, 2021
by
Callum Moffat
Committed by
GitHub
Sep 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CupertinoContextMenu: Use root Overlay (#89331)
parent
c70df378
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
1 deletion
+67
-1
context_menu.dart
packages/flutter/lib/src/cupertino/context_menu.dart
+1
-1
context_menu_test.dart
packages/flutter/test/cupertino/context_menu_test.dart
+66
-0
No files found.
packages/flutter/lib/src/cupertino/context_menu.dart
View file @
8ed704d8
...
...
@@ -354,7 +354,7 @@ class _CupertinoContextMenuState extends State<CupertinoContextMenu> with Ticker
);
},
);
Overlay
.
of
(
context
)!.
insert
(
_lastOverlayEntry
!);
Overlay
.
of
(
context
,
rootOverlay:
true
)!.
insert
(
_lastOverlayEntry
!);
_openController
.
forward
();
}
...
...
packages/flutter/test/cupertino/context_menu_test.dart
View file @
8ed704d8
...
...
@@ -122,6 +122,72 @@ void main() {
await
tester
.
pumpAndSettle
();
expect
(
_findStatic
(),
findsOneWidget
);
});
testWidgets
(
'CupertinoContextMenu is in the correct position when within a nested navigator'
,
(
WidgetTester
tester
)
async
{
final
Widget
child
=
_getChild
();
await
tester
.
pumpWidget
(
CupertinoApp
(
home:
CupertinoPageScaffold
(
child:
MediaQuery
(
data:
const
MediaQueryData
(
size:
Size
(
800
,
600
)),
child:
Align
(
alignment:
Alignment
.
bottomRight
,
child:
SizedBox
(
width:
700
,
height:
500
,
child:
Navigator
(
onGenerateRoute:
(
RouteSettings
settings
)
{
return
CupertinoPageRoute
<
void
>(
builder:
(
BuildContext
context
)
=>
Align
(
alignment:
Alignment
.
center
,
child:
CupertinoContextMenu
(
actions:
const
<
CupertinoContextMenuAction
>[
CupertinoContextMenuAction
(
child:
Text
(
'CupertinoContextMenuAction'
),
),
],
child:
child
),
)
);
}
)
)
)
)
)
));
expect
(
find
.
byWidget
(
child
),
findsOneWidget
);
final
Rect
childRect
=
tester
.
getRect
(
find
.
byWidget
(
child
));
expect
(
find
.
byType
(
ShaderMask
),
findsNothing
);
// Start a press on the child.
final
TestGesture
gesture
=
await
tester
.
startGesture
(
childRect
.
center
);
await
tester
.
pump
();
// The _DecoyChild is showing directly on top of the child.
expect
(
_findDecoyChild
(
child
),
findsOneWidget
);
Rect
decoyChildRect
=
tester
.
getRect
(
_findDecoyChild
(
child
));
expect
(
childRect
,
equals
(
decoyChildRect
));
expect
(
find
.
byType
(
ShaderMask
),
findsOneWidget
);
// After a small delay, the _DecoyChild has begun to animate.
await
tester
.
pump
(
const
Duration
(
milliseconds:
100
));
decoyChildRect
=
tester
.
getRect
(
_findDecoyChild
(
child
));
expect
(
childRect
,
isNot
(
equals
(
decoyChildRect
)));
// Eventually the decoy fully scales by _kOpenSize.
await
tester
.
pump
(
const
Duration
(
milliseconds:
500
));
decoyChildRect
=
tester
.
getRect
(
_findDecoyChild
(
child
));
expect
(
childRect
,
isNot
(
equals
(
decoyChildRect
)));
expect
(
decoyChildRect
.
width
,
childRect
.
width
*
_kOpenScale
);
// Then the CupertinoContextMenu opens.
await
tester
.
pumpAndSettle
();
await
gesture
.
up
();
await
tester
.
pumpAndSettle
();
expect
(
_findStatic
(),
findsOneWidget
);
});
});
group
(
'CupertinoContextMenu when open'
,
()
{
...
...
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