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
f6922d57
Commit
f6922d57
authored
Dec 20, 2019
by
Matt Sullivan
Committed by
Flutter GitHub Bot
Dec 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed incorrect offsetting when applying ShaderMasks (#45654)
parent
275a2f13
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
2 deletions
+66
-2
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+1
-1
shader_mask_test.dart
packages/flutter/test/widgets/shader_mask_test.dart
+65
-1
No files found.
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
f6922d57
...
...
@@ -1011,7 +1011,7 @@ class RenderShaderMask extends RenderProxyBox {
assert
(
needsCompositing
);
layer
??=
ShaderMaskLayer
();
layer
..
shader
=
_shaderCallback
(
offset
&
size
)
..
shader
=
_shaderCallback
(
Offset
.
zero
&
size
)
..
maskRect
=
offset
&
size
..
blendMode
=
_blendMode
;
context
.
pushLayer
(
layer
,
super
.
paint
,
offset
);
...
...
packages/flutter/test/widgets/shader_mask_test.dart
View file @
f6922d57
...
...
@@ -44,6 +44,70 @@ void main() {
await
tester
.
pumpWidget
(
widget
);
// The shader bounds rectangle should reflect the position of the centered SizedBox.
expect
(
shaderBounds
,
equals
(
const
Rect
.
fromLTWH
(
200.0
,
100.0
,
400.0
,
400.0
)));
expect
(
shaderBounds
,
equals
(
const
Rect
.
fromLTWH
(
0.0
,
0.0
,
400.0
,
400.0
)));
},
skip:
isBrowser
);
testWidgets
(
'Bounds rect includes offset visual inspection'
,
(
WidgetTester
tester
)
async
{
final
Widget
widgetBottomRight
=
Container
(
width:
400
,
height:
400
,
color:
const
Color
(
0xFFFFFFFF
),
child:
RepaintBoundary
(
child:
Align
(
alignment:
Alignment
.
bottomRight
,
child:
ShaderMask
(
shaderCallback:
(
Rect
bounds
)
=>
const
RadialGradient
(
center:
Alignment
.
center
,
radius:
0.05
,
colors:
<
Color
>[
Color
(
0xFFFF0000
),
Color
(
0xFF00FF00
)],
tileMode:
TileMode
.
mirror
,
).
createShader
(
bounds
),
child:
Container
(
width:
100
,
height:
100
,
color:
const
Color
(
0xFFFFFFFF
),
),
),
),
),
);
await
tester
.
pumpWidget
(
widgetBottomRight
);
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
matchesGoldenFile
(
'shader_mask.bounds.matches_bottom_right.png'
),
);
final
Widget
widgetTopLeft
=
Container
(
width:
400
,
height:
400
,
color:
const
Color
(
0xFFFFFFFF
),
child:
RepaintBoundary
(
child:
Align
(
alignment:
Alignment
.
topLeft
,
child:
ShaderMask
(
shaderCallback:
(
Rect
bounds
)
=>
const
RadialGradient
(
center:
Alignment
.
center
,
radius:
0.05
,
colors:
<
Color
>[
Color
(
0xFFFF0000
),
Color
(
0xFF00FF00
)],
tileMode:
TileMode
.
mirror
,
).
createShader
(
bounds
),
child:
Container
(
width:
100
,
height:
100
,
color:
const
Color
(
0xFFFFFFFF
),
),
),
),
),
);
await
tester
.
pumpWidget
(
widgetTopLeft
);
await
expectLater
(
find
.
byType
(
RepaintBoundary
),
matchesGoldenFile
(
'shader_mask.bounds.matches_top_left.png'
),
);
},
skip:
isBrowser
);
}
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