didAttachRenderer method
void
didAttachRenderer(
)
override
Implementation
@override
void didAttachRenderer() {
super.didAttachRenderer();
// Should add image box after style has applied to ensure intersection observer
// attached to correct renderBoxModel
if (!_isInLazyLoading || _renderImage == null) {
// Image dimensions (width or height) should specified for performance when lazy-load.
if (_shouldLazyLoading) {
RenderReplaced renderReplaced = renderBoxModel! as RenderReplaced;
renderReplaced.isInLazyRendering = true;
// When detach renderer, all listeners will be cleared.
renderReplaced.addIntersectionChangeListener(_handleIntersectionChange);
} else {
_loadImage();
}
}
}