@@ -484,6 +484,35 @@ class PaintModel with EquatableMixin, SerializableMixin {
484484 }
485485 }
486486
487+ /// [PaintModel] s differentiate themselves with an [id] , so we
488+ /// need to manually compare the other fields.
489+ bool isEquivalentTo (PaintModel ? other) {
490+ if (other == null ) return false ;
491+ if (type != other.type) return false ;
492+ if (visible != other.visible) return false ;
493+ if (opacity != other.opacity) return false ;
494+ if (color != other.color) return false ;
495+ if (blendMode != other.blendMode) return false ;
496+ if (gradientTransform != other.gradientTransform) return false ;
497+ if (gradientStops != other.gradientStops) return false ;
498+ if (imageTransform != other.imageTransform) return false ;
499+ if (hasImageBytes != other.hasImageBytes) return false ;
500+ if (downloadUrl != other.downloadUrl) return false ;
501+ if (imageName != other.imageName) return false ;
502+ if (imageHash != other.imageHash) return false ;
503+ if (fit != other.fit) return false ;
504+ if (alignment != other.alignment) return false ;
505+ if (scaleX != other.scaleX) return false ;
506+ if (scaleY != other.scaleY) return false ;
507+ if (imageRepeat != other.imageRepeat) return false ;
508+ if (assetID != other.assetID) return false ;
509+ if (sourceWidth != other.sourceWidth) return false ;
510+ if (sourceHeight != other.sourceHeight) return false ;
511+ if (cropData != other.cropData) return false ;
512+ if (croppedImageURL != other.croppedImageURL) return false ;
513+ return true ;
514+ }
515+
487516 @override
488517 List <Object ?> get props => [
489518 id,
@@ -498,17 +527,17 @@ class PaintModel with EquatableMixin, SerializableMixin {
498527 hasImageBytes,
499528 downloadUrl,
500529 imageName,
501- scaleX,
502- scaleY,
503530 imageHash,
504- alignment,
505531 fit,
506- cropData,
507- croppedImageURL,
508- sourceWidth,
509- sourceHeight,
532+ alignment,
533+ scaleX,
534+ scaleY,
510535 imageRepeat,
511536 assetID,
537+ sourceWidth,
538+ sourceHeight,
539+ cropData,
540+ croppedImageURL,
512541 ];
513542
514543 /// Factory constructor for creating [PaintModel] instance from a JSON data.
0 commit comments