shouldRelayout method

  1. @override
bool shouldRelayout(
  1. SliverWaterfallFlowDelegate oldDelegate
)
override

Return true when the children need to be laid out.

This should compare the fields of the current delegate and the given oldDelegate and return true if the fields are such that the layout would be different.

Implementation

@override
bool shouldRelayout(SliverWaterfallFlowDelegate oldDelegate) {
  if (oldDelegate.runtimeType != runtimeType) {
    return true;
  }

  return oldDelegate is SliverWaterfallFlowDelegateWithMaxCrossAxisExtent &&
      (oldDelegate.maxCrossAxisExtent != maxCrossAxisExtent ||
          super.shouldRelayout(oldDelegate));
}