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
33c619c9
Unverified
Commit
33c619c9
authored
Sep 03, 2020
by
Sahand Akbarzadeh
Committed by
GitHub
Sep 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix Container.clipBehaviour, clips the shadow in decoration (#64362)
parent
a8640801
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
11 deletions
+42
-11
container.dart
packages/flutter/lib/src/widgets/container.dart
+11
-11
container_test.dart
packages/flutter/test/widgets/container_test.dart
+31
-0
No files found.
packages/flutter/lib/src/widgets/container.dart
View file @
33c619c9
...
...
@@ -397,6 +397,17 @@ class Container extends StatelessWidget {
if
(
color
!=
null
)
current
=
ColoredBox
(
color:
color
,
child:
current
);
if
(
clipBehavior
!=
Clip
.
none
)
{
current
=
ClipPath
(
clipper:
_DecorationClipper
(
textDirection:
Directionality
.
of
(
context
),
decoration:
decoration
),
clipBehavior:
clipBehavior
,
child:
current
,
);
}
if
(
decoration
!=
null
)
current
=
DecoratedBox
(
decoration:
decoration
,
child:
current
);
...
...
@@ -417,17 +428,6 @@ class Container extends StatelessWidget {
if
(
transform
!=
null
)
current
=
Transform
(
transform:
transform
,
child:
current
);
if
(
clipBehavior
!=
Clip
.
none
)
{
current
=
ClipPath
(
clipper:
_DecorationClipper
(
textDirection:
Directionality
.
of
(
context
),
decoration:
decoration
),
clipBehavior:
clipBehavior
,
child:
current
,
);
}
return
current
;
}
...
...
packages/flutter/test/widgets/container_test.dart
View file @
33c619c9
...
...
@@ -555,6 +555,37 @@ void main() {
await
tester
.
tap
(
find
.
byType
(
Container
));
expect
(
tapped
,
false
);
});
testWidgets
(
'using clipBehaviour and shadow, should not clip the shadow'
,
(
WidgetTester
tester
)
async
{
final
Container
container
=
Container
(
clipBehavior:
Clip
.
hardEdge
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
30
),
color:
Colors
.
red
,
boxShadow:
const
<
BoxShadow
>[
BoxShadow
(
color:
Colors
.
blue
,
offset:
Offset
.
zero
,
spreadRadius:
10
,
blurRadius:
20.0
,
),
]),
child:
const
SizedBox
(
width:
50
,
height:
50
),
);
await
tester
.
pumpWidget
(
RepaintBoundary
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
30.0
),
child:
container
,
)),
);
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
matchesGoldenFile
(
'container.clipBehaviour.with.shadow.png'
),
);
});
}
class
_MockPaintingContext
extends
Fake
implements
PaintingContext
{
...
...
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