notifyChangedDelegate method

void notifyChangedDelegate(
  1. BaseBoxyDelegate<Object, BaseBoxyChild> oldDelegate
)

Marks the object for needing layout, paint, build. or compositing bits update as a result of the delegate changing.

Implementation

void notifyChangedDelegate(BaseBoxyDelegate oldDelegate) {
  if (delegate == oldDelegate) {
    return;
  }

  final neededCompositing = oldDelegate.needsCompositing;

  if (delegate.runtimeType != oldDelegate.runtimeType ||
      delegate.shouldRelayout(oldDelegate)) {
    markNeedsLayout();
  } else if (delegate.shouldRepaint(oldDelegate)) {
    markNeedsPaint();
  }

  if (neededCompositing != delegate.needsCompositing) {
    markNeedsCompositingBitsUpdate();
  }

  if (attached) {
    oldDelegate._relayout?.removeListener(markNeedsLayout);
    oldDelegate._repaint?.removeListener(markNeedsPaint);
    delegate._relayout?.addListener(markNeedsLayout);
    delegate._repaint?.addListener(markNeedsPaint);
  }
}