updateRenderBoxModel method
void
updateRenderBoxModel(
{ - bool forceUpdate = false,
})
Implementation
void updateRenderBoxModel({ bool forceUpdate = false }) {
RenderBoxModel nextRenderBoxModel;
if (isWidgetElement) {
nextRenderBoxModel = _createRenderWidget(previousRenderWidget: _renderWidget, forceUpdate: forceUpdate);
} else if (isReplacedElement) {
nextRenderBoxModel =
_createRenderReplaced(isRepaintBoundary: isRepaintBoundary, previousReplaced: _renderReplaced);
} else if (isSVGElement) {
nextRenderBoxModel = createRenderSVG(isRepaintBoundary: isRepaintBoundary, previous: _renderSVG);
} else {
nextRenderBoxModel =
_createRenderLayout(isRepaintBoundary: isRepaintBoundary, previousRenderLayoutBox: _renderLayoutBox);
}
RenderBoxModel? previousRenderBoxModel = renderBoxModel;
if (nextRenderBoxModel != previousRenderBoxModel) {
RenderObject? parentRenderObject;
RenderBox? after;
if (previousRenderBoxModel != null) {
parentRenderObject = previousRenderBoxModel.parent;
if (previousRenderBoxModel.parentData is ContainerParentDataMixin<RenderBox>) {
after = (previousRenderBoxModel.parentData as ContainerParentDataMixin<RenderBox>).previousSibling;
}
RenderBoxModel.detachRenderBox(previousRenderBoxModel);
if (parentRenderObject != null) {
RenderBoxModel.attachRenderBox(parentRenderObject, nextRenderBoxModel, after: after);
}
SchedulerBinding.instance.addPostFrameCallback((timeStamp) {
if (!previousRenderBoxModel.disposed && !managedByFlutterWidget) {
previousRenderBoxModel.dispose();
}
});
}
renderBoxModel = nextRenderBoxModel;
assert(renderBoxModel!.renderStyle.renderBoxModel == renderBoxModel);
// Ensure that the event responder is bound.
ensureEventResponderBound();
}
}