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
103a5c98
Unverified
Commit
103a5c98
authored
Oct 20, 2022
by
chunhtai
Committed by
GitHub
Oct 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Overlay always applies clip (#113770)
parent
483e1d9a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
8 deletions
+27
-8
overlay.dart
packages/flutter/lib/src/widgets/overlay.dart
+3
-7
action_sheet_test.dart
packages/flutter/test/cupertino/action_sheet_test.dart
+1
-1
overlay_test.dart
packages/flutter/test/widgets/overlay_test.dart
+23
-0
No files found.
packages/flutter/lib/src/widgets/overlay.dart
View file @
103a5c98
...
@@ -709,8 +709,6 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
...
@@ -709,8 +709,6 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
addAll
(
children
);
addAll
(
children
);
}
}
bool
_hasVisualOverflow
=
false
;
@override
@override
void
setupParentData
(
RenderBox
child
)
{
void
setupParentData
(
RenderBox
child
)
{
if
(
child
.
parentData
is
!
StackParentData
)
{
if
(
child
.
parentData
is
!
StackParentData
)
{
...
@@ -836,8 +834,6 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
...
@@ -836,8 +834,6 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
@override
@override
void
performLayout
()
{
void
performLayout
()
{
_hasVisualOverflow
=
false
;
if
(
_onstageChildCount
==
0
)
{
if
(
_onstageChildCount
==
0
)
{
return
;
return
;
}
}
...
@@ -856,7 +852,7 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
...
@@ -856,7 +852,7 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
child
.
layout
(
nonPositionedConstraints
,
parentUsesSize:
true
);
child
.
layout
(
nonPositionedConstraints
,
parentUsesSize:
true
);
childParentData
.
offset
=
_resolvedAlignment
!.
alongOffset
(
size
-
child
.
size
as
Offset
);
childParentData
.
offset
=
_resolvedAlignment
!.
alongOffset
(
size
-
child
.
size
as
Offset
);
}
else
{
}
else
{
_hasVisualOverflow
=
RenderStack
.
layoutPositionedChild
(
child
,
childParentData
,
size
,
_resolvedAlignment
!)
||
_hasVisualOverflow
;
RenderStack
.
layoutPositionedChild
(
child
,
childParentData
,
size
,
_resolvedAlignment
!)
;
}
}
assert
(
child
.
parentData
==
childParentData
);
assert
(
child
.
parentData
==
childParentData
);
...
@@ -898,7 +894,7 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
...
@@ -898,7 +894,7 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
@override
@override
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
_hasVisualOverflow
&&
clipBehavior
!=
Clip
.
none
)
{
if
(
clipBehavior
!=
Clip
.
none
)
{
_clipRectLayer
.
layer
=
context
.
pushClipRect
(
_clipRectLayer
.
layer
=
context
.
pushClipRect
(
needsCompositing
,
needsCompositing
,
offset
,
offset
,
...
@@ -939,7 +935,7 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
...
@@ -939,7 +935,7 @@ class _RenderTheatre extends RenderBox with ContainerRenderObjectMixin<RenderBox
case
Clip
.
hardEdge
:
case
Clip
.
hardEdge
:
case
Clip
.
antiAlias
:
case
Clip
.
antiAlias
:
case
Clip
.
antiAliasWithSaveLayer
:
case
Clip
.
antiAliasWithSaveLayer
:
return
_hasVisualOverflow
?
Offset
.
zero
&
size
:
null
;
return
Offset
.
zero
&
size
;
}
}
}
}
...
...
packages/flutter/test/cupertino/action_sheet_test.dart
View file @
103a5c98
...
@@ -952,7 +952,7 @@ void main() {
...
@@ -952,7 +952,7 @@ void main() {
);
);
await
tester
.
tap
(
find
.
text
(
'Go'
));
await
tester
.
tap
(
find
.
text
(
'Go'
));
await
tester
.
pump
();
await
tester
.
pump
AndSettle
();
expect
(
expect
(
semantics
,
semantics
,
...
...
packages/flutter/test/widgets/overlay_test.dart
View file @
103a5c98
...
@@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
...
@@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../rendering/mock_canvas.dart'
;
import
'semantics_tester.dart'
;
import
'semantics_tester.dart'
;
void
main
(
)
{
void
main
(
)
{
...
@@ -1119,6 +1120,28 @@ void main() {
...
@@ -1119,6 +1120,28 @@ void main() {
}
}
});
});
testWidgets
(
'Overlay always applies clip'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Overlay
(
initialEntries:
<
OverlayEntry
>[
OverlayEntry
(
builder:
(
BuildContext
context
)
=>
Positioned
(
left:
10
,
right:
10
,
child:
Container
()),
),
],
),
),
);
final
RenderObject
renderObject
=
tester
.
renderObject
(
find
.
byType
(
Overlay
));
// ignore: avoid_dynamic_calls
expect
((
renderObject
as
dynamic
).
paint
,
paints
..
save
()
..
clipRect
(
rect:
const
Rect
.
fromLTWH
(
0.0
,
0.0
,
800.0
,
600.0
))
..
restore
(),
);
});
group
(
'OverlayEntry listenable'
,
()
{
group
(
'OverlayEntry listenable'
,
()
{
final
GlobalKey
overlayKey
=
GlobalKey
();
final
GlobalKey
overlayKey
=
GlobalKey
();
final
Widget
emptyOverlay
=
Directionality
(
final
Widget
emptyOverlay
=
Directionality
(
...
...
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