Unverified Commit fb9065fe authored by fzyzcjy's avatar fzyzcjy Committed by GitHub

`Layer ... was previously used as oldLayer` assertion error in debug mode, and...

`Layer ... was previously used as oldLayer` assertion error in debug mode, and page being blank in release mode, caused by LeaderLayer addToScene bug (#113998)
parent eadda3c3
......@@ -2503,6 +2503,8 @@ class LeaderLayer extends ContainerLayer {
Matrix4.translationValues(offset.dx, offset.dy, 0.0).storage,
oldLayer: _engineLayer as ui.TransformEngineLayer?,
);
} else {
engineLayer = null;
}
addChildrenToScene(builder);
if (offset != Offset.zero) {
......
......@@ -56,6 +56,35 @@ void main() {
expect(box.localToGlobal(Offset.zero), const Offset(118.0, 451.0));
});
testWidgets('LeaderLayer should not cause error', (WidgetTester tester) async {
final LayerLink link = LayerLink();
Widget buildWidget({
required double paddingLeft,
Color siblingColor = const Color(0xff000000),
}) {
return Directionality(
textDirection: TextDirection.ltr,
child: Stack(
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: paddingLeft),
child: CompositedTransformTarget(
link: link,
child: RepaintBoundary(child: ClipRect(child: Container(color: const Color(0x00ff0000)))),
),
),
Positioned.fill(child: RepaintBoundary(child: ColoredBox(color: siblingColor))),
],
),
);
}
await tester.pumpWidget(buildWidget(paddingLeft: 10));
await tester.pumpWidget(buildWidget(paddingLeft: 0));
await tester.pumpWidget(buildWidget(paddingLeft: 0, siblingColor: const Color(0x0000ff00)));
});
group('Composited transforms - only offsets', () {
final GlobalKey key = GlobalKey();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment