Unverified Commit 5d9983a1 authored by Kostia Sokolovskyi's avatar Kostia Sokolovskyi Committed by GitHub

RenderAnnotatedRegion should dispose created layers. (#136086)

parent eec3f060
......@@ -4989,6 +4989,7 @@ class RenderAnnotatedRegion<T extends Object> extends RenderProxyBox {
RenderBox? child,
}) : _value = value,
_sized = sized,
_layerHandle = LayerHandle<AnnotatedRegionLayer<T>>(),
super(child);
/// A value which can be retrieved using [Layer.find].
......@@ -5013,6 +5014,8 @@ class RenderAnnotatedRegion<T extends Object> extends RenderProxyBox {
markNeedsPaint();
}
final LayerHandle<AnnotatedRegionLayer<T>> _layerHandle;
@override
final bool alwaysNeedsCompositing = true;
......@@ -5024,6 +5027,13 @@ class RenderAnnotatedRegion<T extends Object> extends RenderProxyBox {
size: sized ? size : null,
offset: sized ? offset : null,
);
_layerHandle.layer = layer;
context.pushLayer(layer, super.paint, offset);
}
@override
void dispose() {
_layerHandle.layer = null;
super.dispose();
}
}
......@@ -552,12 +552,7 @@ void main() {
await gesture.moveTo(tester.getCenter(find.text('18')));
await tester.pumpAndSettle();
expect(inkFeatures, paints..circle(color: datePickerTheme.rangeSelectionOverlayColor?.resolve(<MaterialState>{})));
},
leakTrackingTestConfig: const LeakTrackingTestConfig(
// TODO(ksokolovskyi): remove after fixing
// https://github.com/flutter/flutter/issues/136036
notDisposedAllowList: <String, int?> {'AnnotatedRegionLayer<SystemUiOverlayStyle>': 2},
));
});
testWidgetsWithLeakTracking('Dividers use DatePickerThemeData.dividerColor', (WidgetTester tester) async {
Future<void> showPicker(WidgetTester tester, Size size) async {
......@@ -902,10 +897,5 @@ void main() {
..circle(color: rangeSelectionOverlayColor.resolve(<MaterialState>{MaterialState.pressed})),
);
}
},
leakTrackingTestConfig: const LeakTrackingTestConfig(
// TODO(ksokolovskyi): remove after fixing
// https://github.com/flutter/flutter/issues/136036
notDisposedAllowList: <String, int?> {'AnnotatedRegionLayer<SystemUiOverlayStyle>': 2},
));
});
}
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