`next_gen_ui_demo`: Add `dispose` handler for `Picture`s (#1889)

## Pre-launch Checklist

- [x] I read the [Flutter Style Guide] _recently_, and have followed its
advice.
- [x] I signed the [CLA].
- [x] I read the [Contributors Guide].
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-devrel
channel on [Discord].

<!-- Links -->
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[CLA]: https://cla.developers.google.com/
[Discord]: https://github.com/flutter/flutter/wiki/Chat
[Contributors Guide]:
https://github.com/flutter/samples/blob/main/CONTRIBUTING.md
pull/1891/head
Brett Morgan 2 years ago committed by GitHub
parent 419ed42d37
commit 4f943bbde3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -283,10 +283,10 @@ class _RenderShaderSamplerBuilderWidget extends RenderProxyBox {
@override @override
void paint(PaintingContext context, Offset offset) { void paint(PaintingContext context, Offset offset) {
if (size.isEmpty || !_enabled) { if (size.isEmpty) {
return; return;
} }
assert(offset == Offset.zero); assert(!_enabled || offset == Offset.zero);
return super.paint(context, offset); return super.paint(context, offset);
} }
} }
@ -359,4 +359,10 @@ class _ShaderSamplerBuilderLayer extends OffsetLayer {
_lastPicture = pictureRecorder.endRecording(); _lastPicture = pictureRecorder.endRecording();
builder.addPicture(offset, _lastPicture!); builder.addPicture(offset, _lastPicture!);
} }
@override
void dispose() {
_lastPicture?.dispose();
super.dispose();
}
} }

@ -4,7 +4,7 @@ publish_to: 'none'
version: 0.1.0 version: 0.1.0
environment: environment:
sdk: '>=3.0.0-417.4.beta <4.0.0' sdk: ^3.0.0
dependencies: dependencies:
cupertino_icons: ^1.0.5 cupertino_icons: ^1.0.5

Loading…
Cancel
Save