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
7965ee25
Unverified
Commit
7965ee25
authored
May 02, 2022
by
Darren Austin
Committed by
GitHub
May 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Fix position of CupertinoContextMenu within Transform.scale (#97896)" (#102938)
This reverts commit
6ddb99e9
.
parent
6ddb99e9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
70 deletions
+13
-70
context_menu.dart
packages/flutter/lib/src/cupertino/context_menu.dart
+3
-4
context_menu_test.dart
packages/flutter/test/cupertino/context_menu_test.dart
+0
-56
flexible_space_bar_test.dart
packages/flutter/test/material/flexible_space_bar_test.dart
+4
-4
input_decorator_test.dart
packages/flutter/test/material/input_decorator_test.dart
+5
-5
controller.dart
packages/flutter_test/lib/src/controller.dart
+1
-1
No files found.
packages/flutter/lib/src/cupertino/context_menu.dart
View file @
7965ee25
...
...
@@ -47,11 +47,10 @@ typedef _ContextMenuPreviewBuilderChildless = Widget Function(
Rect
_getRect
(
GlobalKey
globalKey
)
{
assert
(
globalKey
.
currentContext
!=
null
);
final
RenderBox
renderBoxContainer
=
globalKey
.
currentContext
!.
findRenderObject
()!
as
RenderBox
;
return
Rect
.
fromPoints
(
renderBoxContainer
.
localToGlobal
(
final
Offset
containerOffset
=
renderBoxContainer
.
localToGlobal
(
renderBoxContainer
.
paintBounds
.
topLeft
,
),
renderBoxContainer
.
localToGlobal
(
renderBoxContainer
.
paintBounds
.
bottomRight
));
);
return
containerOffset
&
renderBoxContainer
.
paintBounds
.
size
;
}
// The context menu arranges itself slightly differently based on the location
...
...
packages/flutter/test/cupertino/context_menu_test.dart
View file @
7965ee25
...
...
@@ -228,62 +228,6 @@ void main() {
kIsWeb
?
SystemMouseCursors
.
click
:
SystemMouseCursors
.
basic
,
);
});
testWidgets
(
'CupertinoContextMenu is in the correct position when within a Transform.scale'
,
(
WidgetTester
tester
)
async
{
final
Widget
child
=
_getChild
();
await
tester
.
pumpWidget
(
CupertinoApp
(
home:
CupertinoPageScaffold
(
child:
MediaQuery
(
data:
const
MediaQueryData
(
size:
Size
(
800
,
600
)),
child:
Transform
.
scale
(
scale:
0.5
,
child:
Align
(
//alignment: Alignment.bottomRight,
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'
,
()
{
...
...
packages/flutter/test/material/flexible_space_bar_test.dart
View file @
7965ee25
...
...
@@ -473,8 +473,8 @@ void main() {
Rect
.
fromLTRB
(
0
,
height
-
titleFontSize
-
10
,
(
width
/
1.5
).
floorToDouble
()
*
1.5
,
height
,
(
width
/
1.5
).
floorToDouble
(),
height
-
10
,
),
);
});
...
...
@@ -545,8 +545,8 @@ void main() {
Rect
.
fromLTRB
(
0
,
height
-
titleFontSize
-
bottomMargin
,
(
collapsedWidth
/
3
).
floorToDouble
()
*
3
,
height
,
(
collapsedWidth
/
3
).
floorToDouble
(),
height
-
bottomMargin
,
),
);
});
...
...
packages/flutter/test/material/input_decorator_test.dart
View file @
7965ee25
...
...
@@ -4321,17 +4321,17 @@ void main() {
await
pumpDecorator
(
focused:
false
,
empty:
false
);
await
tester
.
pumpAndSettle
();
expect
(
getLabelRect
(
tester
).
topLeft
,
equals
(
const
Offset
(
12
,
-
5.5
)));
expect
(
getLabelRect
(
tester
).
size
,
equals
(
const
Size
(
80
,
16
)
*
0.75
));
expect
(
getLabelRect
(
tester
).
size
,
equals
(
const
Size
(
80
,
16
)));
await
pumpDecorator
(
focused:
true
);
await
tester
.
pumpAndSettle
();
expect
(
getLabelRect
(
tester
).
topLeft
,
equals
(
const
Offset
(
12
,
-
5.5
)));
expect
(
getLabelRect
(
tester
).
size
,
equals
(
const
Size
(
80
,
16
)
*
0.75
));
expect
(
getLabelRect
(
tester
).
size
,
equals
(
const
Size
(
80
,
16
)));
await
pumpDecorator
(
focused:
true
,
empty:
false
);
await
tester
.
pumpAndSettle
();
expect
(
getLabelRect
(
tester
).
topLeft
,
equals
(
const
Offset
(
12
,
-
5.5
)));
expect
(
getLabelRect
(
tester
).
size
,
equals
(
const
Size
(
80
,
16
)
*
0.75
));
expect
(
getLabelRect
(
tester
).
size
,
equals
(
const
Size
(
80
,
16
)));
await
pumpDecorator
(
focused:
false
,
enabled:
false
);
await
tester
.
pumpAndSettle
();
...
...
@@ -4341,7 +4341,7 @@ void main() {
await
pumpDecorator
(
focused:
false
,
empty:
false
,
enabled:
false
);
await
tester
.
pumpAndSettle
();
expect
(
getLabelRect
(
tester
).
topLeft
,
equals
(
const
Offset
(
12
,
-
5.5
)));
expect
(
getLabelRect
(
tester
).
size
,
equals
(
const
Size
(
80
,
16
)
*
0.75
));
expect
(
getLabelRect
(
tester
).
size
,
equals
(
const
Size
(
80
,
16
)));
// Focused and disabled happens with NavigationMode.directional.
await
pumpDecorator
(
focused:
true
,
enabled:
false
);
...
...
@@ -4352,7 +4352,7 @@ void main() {
await
pumpDecorator
(
focused:
true
,
empty:
false
,
enabled:
false
);
await
tester
.
pumpAndSettle
();
expect
(
getLabelRect
(
tester
).
topLeft
,
equals
(
const
Offset
(
12
,
-
5.5
)));
expect
(
getLabelRect
(
tester
).
size
,
equals
(
const
Size
(
80
,
16
)
*
0.75
));
expect
(
getLabelRect
(
tester
).
size
,
equals
(
const
Size
(
80
,
16
)));
});
testWidgets
(
'InputDecorationTheme.toString()'
,
(
WidgetTester
tester
)
async
{
...
...
packages/flutter_test/lib/src/controller.dart
View file @
7965ee25
...
...
@@ -1138,7 +1138,7 @@ abstract class WidgetController {
/// Returns the rect of the given widget. This is only valid once
/// the widget's render object has been laid out at least once.
Rect
getRect
(
Finder
finder
)
=>
Rect
.
fromPoints
(
getTopLeft
(
finder
),
getBottomRight
(
finder
)
);
Rect
getRect
(
Finder
finder
)
=>
getTopLeft
(
finder
)
&
getSize
(
finder
);
/// Attempts to find the [SemanticsNode] of first result from `finder`.
///
...
...
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