From a0a853a32ffde56c7ac84863dc2429a2060cba1e Mon Sep 17 00:00:00 2001 From: Jun Gu Date: Fri, 14 Jun 2019 16:25:39 +0800 Subject: [PATCH] Fix ImageSpan not update on Hot reload --- lib/real_rich_text.dart | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/real_rich_text.dart b/lib/real_rich_text.dart index 5ddca3d..c5a2a34 100644 --- a/lib/real_rich_text.dart +++ b/lib/real_rich_text.dart @@ -160,6 +160,18 @@ class ImageSpan extends TextSpan { double get width => imageWidth + (margin == null ? 0 : margin.horizontal); double get height => imageHeight + (margin == null ? 0 : margin.vertical); + + @override + RenderComparison compareTo(covariant ImageSpan other) { + RenderComparison comparison = super.compareTo(other); + if (other.imageProvider != imageProvider || + other.imageWidth != imageWidth || + other.imageHeight != imageHeight || + other.margin != margin) { + comparison = RenderComparison.layout; + } + return comparison; + } } typedef ImageResolverListener = void Function(