mirror of
https://github.com/flutter/samples.git
synced 2025-11-09 06:18:49 +00:00
next_gen_ui_demo: Add dispose handler for Pictures (#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
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user