Unverified Commit 6c29986b authored by Kostia Sokolovskyi's avatar Kostia Sokolovskyi Committed by GitHub

SnapshotPainter should dispatch creation and disposal events. (#138810)

parent 3c422dd7
......@@ -4,6 +4,7 @@
import 'dart:ui' as ui;
import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
import 'basic.dart';
......@@ -385,7 +386,14 @@ class _RenderSnapshotWidget extends RenderProxyBox {
/// }
/// ```
/// {@end-tool}
abstract class SnapshotPainter extends ChangeNotifier {
abstract class SnapshotPainter extends ChangeNotifier {
/// Creates an instance of [SnapshotPainter].
SnapshotPainter() {
if (kFlutterMemoryAllocationsEnabled) {
ChangeNotifier.maybeDispatchObjectCreation(this);
}
}
/// Called whenever the [image] that represents a [SnapshotWidget]s child should be painted.
///
/// The image is rasterized at the physical pixel resolution and should be scaled down by
......
......@@ -326,6 +326,16 @@ void main() {
await expectLater(find.byKey(repaintBoundaryKey), matchesReferenceImage(imageWhenDisabled));
},
skip: kIsWeb); // TODO(jonahwilliams): https://github.com/flutter/flutter/issues/106689
test('SnapshotPainter dispatches memory events', () async {
await expectLater(
await memoryEvents(
() => TestPainter().dispose(),
TestPainter,
),
areCreateAndDispose,
);
});
}
class TestPlatformView extends SingleChildRenderObjectWidget {
......
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