mirror of
https://github.com/flutter/flutter
synced 2024-08-27 20:10:11 +00:00
Assign debugCreator for more layers (#101899)
This commit is contained in:
parent
f6feb8f8b6
commit
899548c48a
|
@ -899,6 +899,10 @@ class RenderOpacity extends RenderProxyBox {
|
|||
}
|
||||
assert(needsCompositing);
|
||||
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
|
|||
}
|
||||
assert(needsCompositing);
|
||||
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 {
|
|||
..maskRect = offset & size
|
||||
..blendMode = _blendMode;
|
||||
context.pushLayer(layer!, super.paint, offset);
|
||||
assert(() {
|
||||
layer!.debugCreator = debugCreator;
|
||||
return true;
|
||||
}());
|
||||
} else {
|
||||
layer = null;
|
||||
}
|
||||
|
@ -1181,6 +1193,10 @@ class RenderBackdropFilter extends RenderProxyBox {
|
|||
layer!.filter = _filter;
|
||||
layer!.blendMode = _blendMode;
|
||||
context.pushLayer(layer!, super.paint, offset);
|
||||
assert(() {
|
||||
layer!.debugCreator = debugCreator;
|
||||
return true;
|
||||
}());
|
||||
} else {
|
||||
layer = null;
|
||||
}
|
||||
|
@ -2426,6 +2442,10 @@ class RenderTransform extends RenderProxyBox {
|
|||
layer = ImageFilterLayer(imageFilter: filter);
|
||||
}
|
||||
context.pushLayer(layer!, super.paint, offset);
|
||||
assert(() {
|
||||
layer!.debugCreator = debugCreator;
|
||||
return true;
|
||||
}());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5212,7 +5232,10 @@ class RenderLeaderLayer extends RenderProxyBox {
|
|||
..offset = offset;
|
||||
}
|
||||
context.pushLayer(layer!, super.paint, Offset.zero);
|
||||
assert(layer != null);
|
||||
assert(() {
|
||||
layer!.debugCreator = debugCreator;
|
||||
return true;
|
||||
}());
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -5424,6 +5447,10 @@ class RenderFollowerLayer extends RenderProxyBox {
|
|||
double.infinity,
|
||||
),
|
||||
);
|
||||
assert(() {
|
||||
layer!.debugCreator = debugCreator;
|
||||
return true;
|
||||
}());
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -173,6 +173,10 @@ class RenderSliverOpacity extends RenderProxySliver {
|
|||
super.paint,
|
||||
oldLayer: layer as OpacityLayer?,
|
||||
);
|
||||
assert(() {
|
||||
layer!.debugCreator = debugCreator;
|
||||
return true;
|
||||
}());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,5 +74,9 @@ class _ColorFilterRenderObject extends RenderProxyBox {
|
|||
@override
|
||||
void paint(PaintingContext context, Offset offset) {
|
||||
layer = context.pushColorFilter(offset, colorFilter, super.paint, oldLayer: layer as ColorFilterLayer?);
|
||||
assert(() {
|
||||
layer!.debugCreator = debugCreator;
|
||||
return true;
|
||||
}());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,6 +73,9 @@ class _ImageFilterRenderObject extends RenderProxyBox {
|
|||
filterLayer.imageFilter = imageFilter;
|
||||
}
|
||||
context.pushLayer(layer!, super.paint, offset);
|
||||
assert(layer != null);
|
||||
assert(() {
|
||||
layer!.debugCreator = debugCreator;
|
||||
return true;
|
||||
}());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
|
@ -269,4 +271,74 @@ void main() {
|
|||
}
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue