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
899548c4
Unverified
Commit
899548c4
authored
Apr 25, 2022
by
wangying
Committed by
GitHub
Apr 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assign debugCreator for more layers (#101899)
parent
f6feb8f8
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
113 additions
and
3 deletions
+113
-3
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+28
-1
proxy_sliver.dart
packages/flutter/lib/src/rendering/proxy_sliver.dart
+4
-0
color_filter.dart
packages/flutter/lib/src/widgets/color_filter.dart
+4
-0
image_filter.dart
packages/flutter/lib/src/widgets/image_filter.dart
+4
-1
debug_test.dart
packages/flutter/test/widgets/debug_test.dart
+73
-1
No files found.
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
899548c4
...
@@ -899,6 +899,10 @@ class RenderOpacity extends RenderProxyBox {
...
@@ -899,6 +899,10 @@ class RenderOpacity extends RenderProxyBox {
}
}
assert
(
needsCompositing
);
assert
(
needsCompositing
);
layer
=
context
.
pushOpacity
(
offset
,
_alpha
,
super
.
paint
,
oldLayer:
layer
as
OpacityLayer
?);
layer
=
context
.
pushOpacity
(
offset
,
_alpha
,
super
.
paint
,
oldLayer:
layer
as
OpacityLayer
?);
assert
(()
{
layer
!.
debugCreator
=
debugCreator
;
return
true
;
}());
}
}
}
}
...
@@ -1006,6 +1010,10 @@ mixin RenderAnimatedOpacityMixin<T extends RenderObject> on RenderObjectWithChil
...
@@ -1006,6 +1010,10 @@ mixin RenderAnimatedOpacityMixin<T extends RenderObject> on RenderObjectWithChil
}
}
assert
(
needsCompositing
);
assert
(
needsCompositing
);
layer
=
context
.
pushOpacity
(
offset
,
_alpha
!,
super
.
paint
,
oldLayer:
layer
as
OpacityLayer
?);
layer
=
context
.
pushOpacity
(
offset
,
_alpha
!,
super
.
paint
,
oldLayer:
layer
as
OpacityLayer
?);
assert
(()
{
layer
!.
debugCreator
=
debugCreator
;
return
true
;
}());
}
}
}
}
...
@@ -1115,6 +1123,10 @@ class RenderShaderMask extends RenderProxyBox {
...
@@ -1115,6 +1123,10 @@ class RenderShaderMask extends RenderProxyBox {
..
maskRect
=
offset
&
size
..
maskRect
=
offset
&
size
..
blendMode
=
_blendMode
;
..
blendMode
=
_blendMode
;
context
.
pushLayer
(
layer
!,
super
.
paint
,
offset
);
context
.
pushLayer
(
layer
!,
super
.
paint
,
offset
);
assert
(()
{
layer
!.
debugCreator
=
debugCreator
;
return
true
;
}());
}
else
{
}
else
{
layer
=
null
;
layer
=
null
;
}
}
...
@@ -1181,6 +1193,10 @@ class RenderBackdropFilter extends RenderProxyBox {
...
@@ -1181,6 +1193,10 @@ class RenderBackdropFilter extends RenderProxyBox {
layer
!.
filter
=
_filter
;
layer
!.
filter
=
_filter
;
layer
!.
blendMode
=
_blendMode
;
layer
!.
blendMode
=
_blendMode
;
context
.
pushLayer
(
layer
!,
super
.
paint
,
offset
);
context
.
pushLayer
(
layer
!,
super
.
paint
,
offset
);
assert
(()
{
layer
!.
debugCreator
=
debugCreator
;
return
true
;
}());
}
else
{
}
else
{
layer
=
null
;
layer
=
null
;
}
}
...
@@ -2426,6 +2442,10 @@ class RenderTransform extends RenderProxyBox {
...
@@ -2426,6 +2442,10 @@ class RenderTransform extends RenderProxyBox {
layer
=
ImageFilterLayer
(
imageFilter:
filter
);
layer
=
ImageFilterLayer
(
imageFilter:
filter
);
}
}
context
.
pushLayer
(
layer
!,
super
.
paint
,
offset
);
context
.
pushLayer
(
layer
!,
super
.
paint
,
offset
);
assert
(()
{
layer
!.
debugCreator
=
debugCreator
;
return
true
;
}());
}
}
}
}
}
}
...
@@ -5212,7 +5232,10 @@ class RenderLeaderLayer extends RenderProxyBox {
...
@@ -5212,7 +5232,10 @@ class RenderLeaderLayer extends RenderProxyBox {
..
offset
=
offset
;
..
offset
=
offset
;
}
}
context
.
pushLayer
(
layer
!,
super
.
paint
,
Offset
.
zero
);
context
.
pushLayer
(
layer
!,
super
.
paint
,
Offset
.
zero
);
assert
(
layer
!=
null
);
assert
(()
{
layer
!.
debugCreator
=
debugCreator
;
return
true
;
}());
}
}
@override
@override
...
@@ -5424,6 +5447,10 @@ class RenderFollowerLayer extends RenderProxyBox {
...
@@ -5424,6 +5447,10 @@ class RenderFollowerLayer extends RenderProxyBox {
double
.
infinity
,
double
.
infinity
,
),
),
);
);
assert
(()
{
layer
!.
debugCreator
=
debugCreator
;
return
true
;
}());
}
}
@override
@override
...
...
packages/flutter/lib/src/rendering/proxy_sliver.dart
View file @
899548c4
...
@@ -173,6 +173,10 @@ class RenderSliverOpacity extends RenderProxySliver {
...
@@ -173,6 +173,10 @@ class RenderSliverOpacity extends RenderProxySliver {
super
.
paint
,
super
.
paint
,
oldLayer:
layer
as
OpacityLayer
?,
oldLayer:
layer
as
OpacityLayer
?,
);
);
assert
(()
{
layer
!.
debugCreator
=
debugCreator
;
return
true
;
}());
}
}
}
}
...
...
packages/flutter/lib/src/widgets/color_filter.dart
View file @
899548c4
...
@@ -74,5 +74,9 @@ class _ColorFilterRenderObject extends RenderProxyBox {
...
@@ -74,5 +74,9 @@ class _ColorFilterRenderObject extends RenderProxyBox {
@override
@override
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
layer
=
context
.
pushColorFilter
(
offset
,
colorFilter
,
super
.
paint
,
oldLayer:
layer
as
ColorFilterLayer
?);
layer
=
context
.
pushColorFilter
(
offset
,
colorFilter
,
super
.
paint
,
oldLayer:
layer
as
ColorFilterLayer
?);
assert
(()
{
layer
!.
debugCreator
=
debugCreator
;
return
true
;
}());
}
}
}
}
packages/flutter/lib/src/widgets/image_filter.dart
View file @
899548c4
...
@@ -73,6 +73,9 @@ class _ImageFilterRenderObject extends RenderProxyBox {
...
@@ -73,6 +73,9 @@ class _ImageFilterRenderObject extends RenderProxyBox {
filterLayer
.
imageFilter
=
imageFilter
;
filterLayer
.
imageFilter
=
imageFilter
;
}
}
context
.
pushLayer
(
layer
!,
super
.
paint
,
offset
);
context
.
pushLayer
(
layer
!,
super
.
paint
,
offset
);
assert
(
layer
!=
null
);
assert
(()
{
layer
!.
debugCreator
=
debugCreator
;
return
true
;
}());
}
}
}
}
packages/flutter/test/widgets/debug_test.dart
View file @
899548c4
...
@@ -2,8 +2,10 @@
...
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'dart:ui'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/
widgets
.dart'
;
import
'package:flutter/
material
.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
void
main
(
)
{
...
@@ -269,4 +271,74 @@ void main() {
...
@@ -269,4 +271,74 @@ void main() {
}
}
debugHighlightDeprecatedWidgets
=
false
;
debugHighlightDeprecatedWidgets
=
false
;
});
});
testWidgets
(
'debugCreator of layers should not be null'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Material
(
child:
Stack
(
children:
<
Widget
>[
const
ColorFiltered
(
colorFilter:
ColorFilter
.
mode
(
Color
(
0xFFFF0000
),
BlendMode
.
color
),
child:
Placeholder
(),
),
const
Opacity
(
opacity:
1.0
,
child:
Placeholder
(),
),
ImageFiltered
(
imageFilter:
ImageFilter
.
blur
(
sigmaX:
10.0
,
sigmaY:
10.0
),
child:
const
Placeholder
(),
),
BackdropFilter
(
filter:
ImageFilter
.
blur
(
sigmaX:
10.0
,
sigmaY:
10.0
),
child:
const
Placeholder
(),
),
ShaderMask
(
shaderCallback:
(
Rect
bounds
)
=>
const
RadialGradient
(
radius:
0.05
,
colors:
<
Color
>[
Color
(
0xFFFF0000
),
Color
(
0xFF00FF00
)],
tileMode:
TileMode
.
mirror
,
).
createShader
(
bounds
),
child:
const
Placeholder
(),
),
RangeSlider
(
values:
const
RangeValues
(
0.3
,
0.7
),
onChanged:
(
RangeValues
newValues
)
{},
),
CompositedTransformFollower
(
link:
LayerLink
(),
),
],
),
),
),
),
);
RenderObject
renderObject
;
renderObject
=
tester
.
firstRenderObject
(
find
.
byType
(
Opacity
));
expect
(
renderObject
.
debugLayer
?.
debugCreator
,
isNotNull
);
renderObject
=
tester
.
firstRenderObject
(
find
.
byType
(
ColorFiltered
));
expect
(
renderObject
.
debugLayer
?.
debugCreator
,
isNotNull
);
renderObject
=
tester
.
firstRenderObject
(
find
.
byType
(
ImageFiltered
));
expect
(
renderObject
.
debugLayer
?.
debugCreator
,
isNotNull
);
renderObject
=
tester
.
firstRenderObject
(
find
.
byType
(
BackdropFilter
));
expect
(
renderObject
.
debugLayer
?.
debugCreator
,
isNotNull
);
renderObject
=
tester
.
firstRenderObject
(
find
.
byType
(
ShaderMask
));
expect
(
renderObject
.
debugLayer
?.
debugCreator
,
isNotNull
);
renderObject
=
tester
.
firstRenderObject
(
find
.
byType
(
RangeSlider
));
expect
(
renderObject
.
debugLayer
?.
debugCreator
,
isNotNull
);
renderObject
=
tester
.
firstRenderObject
(
find
.
byType
(
CompositedTransformFollower
));
expect
(
renderObject
.
debugLayer
?.
debugCreator
,
isNotNull
);
});
}
}
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